Bug 1145403 - Don't open MediaManager on shutdown. r=jesup

This commit is contained in:
Jan-Ivar Bruaroey 2015-03-19 18:43:25 -04:00
Родитель 3dc26340ad
Коммит e9cc1b61ab
3 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -1982,8 +1982,8 @@ Navigator::OnNavigation()
}
#ifdef MOZ_MEDIA_NAVIGATOR
// Inform MediaManager in case there are live streams or pending callbacks.
MediaManager *manager = MediaManager::Get();
// If MediaManager is open let it inform any live streams or pending callbacks
MediaManager *manager = MediaManager::GetIfExists();
if (manager) {
manager->OnNavigation(mWindow->WindowID());
}

Просмотреть файл

@ -1418,7 +1418,11 @@ NS_IMPL_ISUPPORTS(MediaManager, nsIMediaManagerService, nsIObserver)
MediaManager::Get() {
if (!sSingleton) {
NS_ASSERTION(NS_IsMainThread(), "Only create MediaManager on main thread");
#ifdef DEBUG
static int timesCreated = 0;
timesCreated++;
MOZ_ASSERT(timesCreated == 1);
#endif
sSingleton = new MediaManager();
sSingleton->mMediaThread = new base::Thread("MediaManager");
@ -1454,6 +1458,11 @@ MediaManager::Get() {
return sSingleton;
}
/* static */ MediaManager*
MediaManager::GetIfExists() {
return sSingleton;
}
/* static */ already_AddRefed<MediaManager>
MediaManager::GetInstance()
{

Просмотреть файл

@ -554,6 +554,7 @@ public:
// thread from the MainThread, as we NS_DISPATCH_SYNC to MainThread
// from MediaManager thread.
static MediaManager* Get();
static MediaManager* GetIfExists();
static MessageLoop* GetMessageLoop();
static bool Exists()