Browse Source

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

* chore: cherry-pick 8089dbfc616f from chromium

* resolve conflicts
Jeremy Rose 3 years ago
parent
commit
a26758c44d
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

@@ -120,3 +120,4 @@ cherry-pick-e4abe032f3ad.patch
 add_crashkeys_to_identify_where_target_is_assigned_to_a_stale_value.patch
 add_weak_pointer_to_rwhier_framesinkidownermap_and_rwhier_targetmap.patch
 add_null_pointer_check_in_renderwidgethostinputeventrouter.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 7b84c62d0c89765941d2daf964adcd2f2d0f25ee..cfe5758f19546d43b370db075741c97fd660c914 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 335ad816c1ed2f96586474a4b52fa74f15365e41..f419cec7a1c4a350f0e1f4660888ce07914e70f2 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 13d74f7397c05870a758494d92d6ec8f012657a6..2f53ff57824751c6c8f2dcb4494af4870c9838bd 100644
+--- a/base/task/thread_pool/thread_group_impl.cc
++++ b/base/task/thread_pool/thread_group_impl.cc
+@@ -712,8 +712,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_);
+ }
+