Browse Source

chore: cherry-pick 8089dbfc616f from chromium (#29109)

* chore: cherry-pick 8089dbfc616f from chromium

* resolve conflicts
Jeremy Rose 3 years ago
parent
commit
9a4a049498
2 changed files with 60 additions and 0 deletions
  1. 1 0
      patches/chromium/.patches
  2. 59 0
      patches/chromium/cherry-pick-8089dbfc616f.patch

+ 1 - 0
patches/chromium/.patches

@@ -107,3 +107,4 @@ fix_add_check_for_sandbox_then_result.patch
 moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch
 fix_expose_decrementcapturercount_in_web_contents_impl.patch
 add_setter_for_browsermainloop_result_code.patch
+cherry-pick-8089dbfc616f.patch

+ 59 - 0
patches/chromium/cherry-pick-8089dbfc616f.patch

@@ -0,0 +1,59 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Francois Doray <[email protected]>
+Date: Mon, 26 Apr 2021 19:48:20 +0000
+Subject: Cleanup the "NoDetachBelowInitialCapacity" feature.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Motivation: The feature is not used since 2019.
+
+Bug: 847501
+Change-Id: Ic6fde174ef8d742f7beb57d0c67ae2477dc96cc2
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2845241
+Reviewed-by: Etienne Pierre-Doray <[email protected]>
+Commit-Queue: François Doray <[email protected]>
+Cr-Commit-Position: refs/heads/master@{#876279}
+
+diff --git a/base/task/task_features.cc b/base/task/task_features.cc
+index b7452cf330b71ce76fd63281fafc0618f652e8c6..4e498738ffeea1513aa475c69f29844e8d327d22 100644
+--- a/base/task/task_features.cc
++++ b/base/task/task_features.cc
+@@ -11,9 +11,6 @@ namespace base {
+ const Feature kAllTasksUserBlocking{"AllTasksUserBlocking",
+                                     FEATURE_DISABLED_BY_DEFAULT};
+ 
+-const Feature kNoDetachBelowInitialCapacity = {
+-    "NoDetachBelowInitialCapacity", base::FEATURE_DISABLED_BY_DEFAULT};
+-
+ const Feature kMayBlockWithoutDelay = {"MayBlockWithoutDelay",
+                                        base::FEATURE_DISABLED_BY_DEFAULT};
+ 
+diff --git a/base/task/task_features.h b/base/task/task_features.h
+index 4e361b8e6ba92e4db0614e7ae0daf60b9942bfb1..c80499566e18819172a38d7c7eef3a0080eac3da 100644
+--- a/base/task/task_features.h
++++ b/base/task/task_features.h
+@@ -15,10 +15,6 @@ struct Feature;
+ 
+ extern const BASE_EXPORT Feature kAllTasksUserBlocking;
+ 
+-// Under this feature, unused threads in ThreadGroup are only detached
+-// if the total number of threads in the pool is above the initial capacity.
+-extern const BASE_EXPORT Feature kNoDetachBelowInitialCapacity;
+-
+ // Under this feature, workers blocked with MayBlock are replaced immediately
+ // instead of waiting for a threshold in the foreground thread group.
+ extern const BASE_EXPORT Feature kMayBlockWithoutDelay;
+diff --git a/base/task/thread_pool/thread_group_impl.cc b/base/task/thread_pool/thread_group_impl.cc
+index 0aa268df2eff3de9f018ce6643f8690131395f4d..4f5b6f39231ab9c82dcb69b400360ff35b90dd6b 100644
+--- a/base/task/thread_pool/thread_group_impl.cc
++++ b/base/task/thread_pool/thread_group_impl.cc
+@@ -713,8 +713,6 @@ bool ThreadGroupImpl::WorkerThreadDelegateImpl::CanCleanupLockRequired(
+   return !last_used_time.is_null() &&
+          subtle::TimeTicksNowIgnoringOverride() - last_used_time >=
+              outer_->after_start().suggested_reclaim_time &&
+-         (outer_->workers_.size() > outer_->after_start().initial_max_tasks ||
+-          !FeatureList::IsEnabled(kNoDetachBelowInitialCapacity)) &&
+          LIKELY(!outer_->worker_cleanup_disallowed_for_testing_);
+ }
+