mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1064669 - Initialize MediaPlayers in delayed startup. r=mfinkle
This commit is contained in:
parent
70cdee8a11
commit
524bb4dded
@ -662,16 +662,6 @@ public class BrowserApp extends GeckoApp
|
||||
// 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 {
|
||||
@ -1547,6 +1537,19 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
});
|
||||
|
||||
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.
|
||||
@ -1559,6 +1562,7 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
}, oneSecondInMillis);
|
||||
}
|
||||
|
||||
super.handleMessage(event, message);
|
||||
} else if (event.equals("Gecko:Ready")) {
|
||||
// Handle this message in GeckoApp, but also enable the Settings
|
||||
|
@ -191,6 +191,7 @@ public abstract class GeckoApp
|
||||
private Telemetry.Timer mGeckoReadyStartupTimer;
|
||||
|
||||
private String mPrivateBrowsingSession;
|
||||
private volatile boolean mIsPaused = true;
|
||||
|
||||
private volatile HealthRecorder mHealthRecorder;
|
||||
private volatile Locale mLastLocale;
|
||||
@ -246,7 +247,13 @@ public abstract class GeckoApp
|
||||
}
|
||||
|
||||
public void addAppStateListener(GeckoAppShell.AppStateListener listener) {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
mAppStateListeners.add(listener);
|
||||
|
||||
// If we're already resumed, make sure the listener gets a notification.
|
||||
if (!mIsPaused) {
|
||||
listener.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAppStateListener(GeckoAppShell.AppStateListener listener) {
|
||||
@ -1885,6 +1892,8 @@ public abstract class GeckoApp
|
||||
listener.onResume();
|
||||
}
|
||||
}
|
||||
// Setting this state will force any listeners added after this to have their onResume() method called
|
||||
mIsPaused = false;
|
||||
|
||||
// We use two times: a pseudo-unique wall-clock time to identify the
|
||||
// current session across power cycles, and the elapsed realtime to
|
||||
@ -1961,6 +1970,9 @@ public abstract class GeckoApp
|
||||
}
|
||||
});
|
||||
|
||||
// Setting this state will keep any listeners registered after this from having their onResume
|
||||
// method called.
|
||||
mIsPaused = true;
|
||||
if (mAppStateListeners != null) {
|
||||
for(GeckoAppShell.AppStateListener listener: mAppStateListeners) {
|
||||
listener.onPause();
|
||||
|
Loading…
Reference in New Issue
Block a user