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

Unified Diff: android_webview/browser/aw_metrics_service_client.cc

Issue 1584483004: Fix race condition-y Finalize w/ extreme predjudice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « android_webview/browser/aw_metrics_service_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_metrics_service_client.cc
diff --git a/android_webview/browser/aw_metrics_service_client.cc b/android_webview/browser/aw_metrics_service_client.cc
index db921c2646be5958bfc95f41e66bb33116ecc969..c5de1a4aaca2b49a4552846c361650058a1d3d69 100644
--- a/android_webview/browser/aw_metrics_service_client.cc
+++ b/android_webview/browser/aw_metrics_service_client.cc
@@ -64,6 +64,7 @@ void GetOrCreateGUID(const base::FilePath guid_file_path, std::string* guid) {
// static
AwMetricsServiceClient* AwMetricsServiceClient::GetInstance() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
return g_lazy_instance_.Pointer();
}
@@ -71,6 +72,7 @@ void AwMetricsServiceClient::Initialize(
PrefService* pref_service,
net::URLRequestContextGetter* request_context,
const base::FilePath guid_file_path) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!is_initialized_);
pref_service_ = pref_service;
@@ -90,6 +92,7 @@ void AwMetricsServiceClient::Initialize(
}
void AwMetricsServiceClient::InitializeWithGUID(std::string* guid) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!is_initialized_);
pref_service_->SetString(metrics::prefs::kMetricsClientID, *guid);
@@ -129,12 +132,9 @@ void AwMetricsServiceClient::InitializeWithGUID(std::string* guid) {
metrics_service_->Start();
}
-void AwMetricsServiceClient::Finalize() {
- DCHECK(is_initialized_);
- metrics_service_->Stop();
-}
-
void AwMetricsServiceClient::SetMetricsEnabled(bool enabled) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
// If the client is already initialized, apply the setting immediately.
// Otherwise, it will be applied on initialization.
if (is_initialized_ && is_enabled_ != enabled) {
« no previous file with comments | « android_webview/browser/aw_metrics_service_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698