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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java

Issue 2612263003: Don't run the variations broadcast receiver more than once. (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java b/chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java
index fc021528f5dadcaaaa1433e64ce964da9cee6b2f..a4835818eea5efe4527de6b06626dd528e699f7c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java
@@ -93,6 +93,8 @@ class NativeInitializationController {
public void startBackgroundTasks(final boolean allocateChildConnection) {
ThreadUtils.assertOnUiThread();
+ // TODO(asvitkine): Consider moving this logic to a singleton, like
+ // ChromeBrowserInitializer.
if (shouldFetchVariationsSeedBeforeFRE()) {
Context context = ContextUtils.getApplicationContext();
Intent initialIntent = mActivityDelegate.getInitialIntent();
@@ -105,6 +107,10 @@ class NativeInitializationController {
new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
+ // This check is needed because onReceive() can be called multiple
+ // times even after having unregistered below if two broadcasts
+ // arrive in rapid succession.
+ if (!mWaitingForVariationsFetch) return;
mWaitingForVariationsFetch = false;
manager.unregisterReceiver(this);
signalNativeLibraryLoadedIfReady();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698