Bug 1272557 - Delay initializing PushService and DLC; r=snorp
authorJim Chen <nchen@mozilla.com>
Fri, 27 May 2016 14:29:46 -0400
changeset 338383 e97d36a133b711e97b11c5b790b49cdb44efae70
parent 338382 1ece2881d7b68ad3119803f1db6d66a4e403c5c7
child 338384 b12fe0ea05d6669181144ad17652cc0d92a81de8
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1272557 - Delay initializing PushService and DLC; r=snorp Delay initialization of PushService and DLC in GeckoApplication to after the Gecko:Ready message. That way, hopefully they give up some CPU time to other initialization tasks.
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -692,16 +692,18 @@ public abstract class GeckoApp
                 // know that mHealthRecorder will exist. That doesn't stop us being
                 // paranoid.
                 // This method is cheap, so don't spawn a new runnable.
                 final HealthRecorder rec = mHealthRecorder;
                 if (rec != null) {
+                GeckoApplication.get().onDelayedStartup();
             } else if (event.equals("Gecko:Exited")) {
                 // Gecko thread exited first; let GeckoApp die too.
             } else if (event.equals("Accessibility:Event")) {
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
@@ -172,17 +172,19 @@ public class GeckoApplication extends Ap
                 // its own thing.
                 return new LocalBrowserDB(profileName);
+    }
+    public void onDelayedStartup() {
         if (AppConstants.MOZ_ANDROID_GCM) {
             // TODO: only run in main process.
             ThreadUtils.postToBackgroundThread(new Runnable() {
                 public void run() {
                     // It's fine to throw GCM initialization onto a background thread; the registration process requires
                     // network access, so is naturally asynchronous.  This, of course, races against Gecko page load of
                     // content requiring GCM-backed services, like Web Push.  There's nothing to be done here.