Bug 1064669 - Move casting initialization to delayed startup. r=rnewman
☠☠ backed out by 23776909e3ae ☠ ☠
authorWes Johnston <wjohnston@mozilla.com>
Fri, 19 Sep 2014 16:55:18 -0700
changeset 206277 ba244ef9dead194a2b6791545c64d13e64c7a7b6
parent 206276 dad1d0099623b58ff9eae8d1d01fdb83a8ac6ad8
child 206302 d1e5c67ead37c55a83cb8a7e0a32d78e57c8b3ef
push id8873
push userwjohnston@mozilla.com
push dateFri, 19 Sep 2014 23:56:53 +0000
treeherderfx-team@ba244ef9dead [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1064669
milestone35.0a1
Bug 1064669 - Move casting initialization to delayed startup. r=rnewman
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -650,26 +650,16 @@ public class BrowserApp extends GeckoApp
             public void onEnabledChanged(boolean enabled) {
                 setDynamicToolbarEnabled(enabled);
             }
         });
 
         // Set the maximum bits-per-pixel the favicon system cares about.
         IconDirectoryEntry.setMaxBPP(GeckoAppShell.getScreenDepth());
 
-        Class<?> mediaManagerClass = getMediaPlayerManager();
-        if (mediaManagerClass != null) {
-            try {
-                Method init = mediaManagerClass.getMethod("init", Context.class);
-                init.invoke(null, this);
-            } catch(Exception ex) {
-                Log.e(LOGTAG, "Error initializing media manager", ex);
-            }
-        }
-
         if (getProfile().inGuestMode()) {
             GuestSession.showNotification(this);
         } else {
             // If we're restarting, we won't destroy the activity. Make sure we remove any guest notifications that might have been shown.
             GuestSession.hideNotification(this);
         }
     }
 
@@ -1497,28 +1487,42 @@ public class BrowserApp extends GeckoApp
                     @Override
                     public void run() {
                         // Force tabs panel inflation once the initial
                         // pageload is finished.
                         ensureTabsPanelExists();
                     }
                 });
 
+                if (AppConstants.MOZ_MEDIA_PLAYER) {
+                    // If casting is disabled, these classes aren't built. We use reflection to initialize them.
+                    Class<?> mediaManagerClass = getMediaPlayerManager();
+                    if (mediaManagerClass != null) {
+                        try {
+                            Method init = mediaManagerClass.getMethod("init", Context.class);
+                            init.invoke(null, this);
+                        } catch(Exception ex) {
+                            Log.e(LOGTAG, "Error initializing media manager", ex);
+                        }
+                    }
+                }
+
                 if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
                     // Start (this acts as ping if started already) the stumbler lib; if the stumbler has queued data it will upload it.
                     // Stumbler operates on its own thread, and startup impact is further minimized by delaying work (such as upload) a few seconds.
                     // Avoid any potential startup CPU/thread contention by delaying the pref broadcast.
                     final long oneSecondInMillis = 1000;
                     ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() {
                         @Override
                         public void run() {
                              GeckoPreferences.broadcastStumblerPref(BrowserApp.this);
                         }
                     }, oneSecondInMillis);
                 }
+
                 super.handleMessage(event, message);
             } else if (event.equals("Gecko:Ready")) {
                 // Handle this message in GeckoApp, but also enable the Settings
                 // menuitem, which is specific to BrowserApp.
                 super.handleMessage(event, message);
                 final Menu menu = mMenu;
                 ThreadUtils.postToUiThread(new Runnable() {
                     @Override