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

Unified Diff: chrome/browser/android/data_usage/external_data_use_observer_bridge.cc

Issue 2834463005: Fix race with google variation ID registration (Closed)
Patch Set: rebased Created 3 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 | « chrome/browser/android/data_usage/external_data_use_observer_bridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
diff --git a/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc b/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
index 70ed4eca57cf5a5ec89fa30fb5643fe3ecc37745..3ec90ed67a07ab49c4e8c3fe4e32f66f4b619600 100644
--- a/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
+++ b/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
@@ -60,8 +60,7 @@ namespace android {
ExternalDataUseObserverBridge::ExternalDataUseObserverBridge()
: construct_time_(base::TimeTicks::Now()),
- is_first_matching_rule_fetch_(true),
- register_google_variation_id_(false) {
+ is_first_matching_rule_fetch_(true) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
// Detach from IO thread since rest of ExternalDataUseObserverBridge lives on
@@ -208,20 +207,22 @@ void ExternalDataUseObserverBridge::ShouldRegisterAsDataUseObserver(
FROM_HERE,
base::Bind(&ExternalDataUseObserver::ShouldRegisterAsDataUseObserver,
external_data_use_observer_, should_register));
+}
- if (!register_google_variation_id_)
- return;
-
+void ExternalDataUseObserverBridge::RegisterGoogleVariationID(
+ bool should_register) {
+ DCHECK(thread_checker_.CalledOnValidThread());
variations::VariationID variation_id = GetGoogleVariationID();
if (variation_id != variations::EMPTY_ID) {
// Set variation id for the enabled group if |should_register| is true.
// Otherwise clear the variation id for the enabled group by setting to
// EMPTY_ID.
- variations::AssociateGoogleVariationID(
- variations::GOOGLE_WEB_PROPERTIES, kSyntheticFieldTrial,
- kSyntheticFieldTrialEnabledGroup,
- should_register ? variation_id : variations::EMPTY_ID);
+ if (should_register) {
+ variations::AssociateGoogleVariationID(
+ variations::GOOGLE_WEB_PROPERTIES, kSyntheticFieldTrial,
+ kSyntheticFieldTrialEnabledGroup, variation_id);
+ }
ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial(
kSyntheticFieldTrial, should_register
? kSyntheticFieldTrialEnabledGroup
@@ -229,12 +230,6 @@ void ExternalDataUseObserverBridge::ShouldRegisterAsDataUseObserver(
}
}
-void ExternalDataUseObserverBridge::SetRegisterGoogleVariationID(
- bool register_google_variation_id) {
- DCHECK(thread_checker_.CalledOnValidThread());
- register_google_variation_id_ = register_google_variation_id;
-}
-
bool RegisterExternalDataUseObserver(JNIEnv* env) {
return RegisterNativesImpl(env);
}
« no previous file with comments | « chrome/browser/android/data_usage/external_data_use_observer_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698