Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc

Issue 1905293003: Use CONTINUE_ON_SHUTDOWN for IncidentReportingService tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed to feature Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/chrome_features.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
index ecd5aea00c37a709850e1d041e917bebcd7026b6..a2fe1ad198d496d4ea9ed059a93751e161376c90 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <algorithm>
+#include <string>
#include <utility>
#include <vector>
@@ -33,6 +34,7 @@
#include "chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h"
#include "chrome/browser/safe_browsing/incident_reporting/state_store.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "components/prefs/pref_service.h"
@@ -146,6 +148,15 @@ bool ProfileCanAcceptIncident(Profile* profile, const Incident& incident) {
return false;
}
+// Returns the shutdown behavior for the task runners of the incident reporting
+// service. Current metrics suggest that CONTINUE_ON_SHUTDOWN will reduce the
+// number of browser hangs on shutdown.
+base::SequencedWorkerPool::WorkerShutdown GetShutdownBehavior() {
+ return base::FeatureList::IsEnabled(features::kBrowserHangFixesExperiment)
+ ? base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN
+ : base::SequencedWorkerPool::SKIP_ON_SHUTDOWN;
+}
+
} // namespace
struct IncidentReportingService::ProfileContext {
@@ -338,8 +349,7 @@ IncidentReportingService::IncidentReportingService(
collect_environment_data_fn_(&CollectEnvironmentData),
environment_collection_task_runner_(
content::BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
+ ->GetTaskRunnerWithShutdownBehavior(GetShutdownBehavior())),
environment_collection_pending_(),
collation_timeout_pending_(),
collation_timer_(FROM_HERE,
@@ -349,13 +359,11 @@ IncidentReportingService::IncidentReportingService(
delayed_analysis_callbacks_(
base::TimeDelta::FromMilliseconds(kDefaultCallbackIntervalMs),
content::BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
+ ->GetTaskRunnerWithShutdownBehavior(GetShutdownBehavior())),
extended_reporting_only_delayed_analysis_callbacks_(
base::TimeDelta::FromMilliseconds(kDefaultCallbackIntervalMs),
content::BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
+ ->GetTaskRunnerWithShutdownBehavior(GetShutdownBehavior())),
download_metadata_manager_(content::BrowserThread::GetBlockingPool()),
receiver_weak_ptr_factory_(this),
weak_ptr_factory_(this) {
@@ -463,8 +471,7 @@ IncidentReportingService::IncidentReportingService(
collect_environment_data_fn_(&CollectEnvironmentData),
environment_collection_task_runner_(
content::BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
+ ->GetTaskRunnerWithShutdownBehavior(GetShutdownBehavior())),
environment_collection_pending_(),
collation_timeout_pending_(),
collation_timer_(FROM_HERE,
@@ -497,8 +504,7 @@ void IncidentReportingService::SetCollectEnvironmentHook(
collect_environment_data_fn_ = &CollectEnvironmentData;
environment_collection_task_runner_ =
content::BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
+ ->GetTaskRunnerWithShutdownBehavior(GetShutdownBehavior());
}
}
« no previous file with comments | « no previous file | chrome/common/chrome_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698