зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 3ceb919e7e82 (bug 1406328) for build bustage at dom/media/MediaCache.cpp:301: 'ShutdownPhase' has not been declared. r=backout
This commit is contained in:
Родитель
f3c2c7d40d
Коммит
6c8164a609
|
@ -151,7 +151,7 @@ public:
|
|||
// file backing will be provided.
|
||||
static RefPtr<MediaCache> GetMediaCache(int64_t aContentLength);
|
||||
|
||||
nsIEventTarget* OwnerThread() const { return sThread; }
|
||||
nsIEventTarget* OwnerThread() const { return mThread; }
|
||||
|
||||
// Brutally flush the cache contents. Main thread only.
|
||||
void Flush();
|
||||
|
@ -266,15 +266,6 @@ public:
|
|||
uint32_t mNext;
|
||||
};
|
||||
|
||||
// Called during shutdown to clear sThread.
|
||||
void operator=(std::nullptr_t)
|
||||
{
|
||||
nsCOMPtr<nsIThread> thread = sThread.forget();
|
||||
if (thread) {
|
||||
thread->Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit MediaCache(MediaBlockCacheBase* aCache)
|
||||
: mNextResourceID(1)
|
||||
|
@ -288,17 +279,9 @@ protected:
|
|||
NS_ASSERTION(NS_IsMainThread(), "Only construct MediaCache on main thread");
|
||||
MOZ_COUNT_CTOR(MediaCache);
|
||||
MediaCacheFlusher::RegisterMediaCache(this);
|
||||
|
||||
if (!sThreadInit) {
|
||||
sThreadInit = true;
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
nsresult rv = NS_NewNamedThread("MediaCache", getter_AddRefs(thread));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to create a thread for MediaCache.");
|
||||
return;
|
||||
}
|
||||
sThread = thread.forget();
|
||||
ClearOnShutdown(this, ShutdownPhase::ShutdownThreads);
|
||||
nsresult rv = NS_NewNamedThread("MediaCache", getter_AddRefs(mThread));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to create a thread for MediaCache.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,6 +314,11 @@ protected:
|
|||
Truncate();
|
||||
NS_ASSERTION(mIndex.Length() == 0, "Blocks leaked?");
|
||||
|
||||
nsCOMPtr<nsIThread> thread = mThread.forget();
|
||||
if (thread) {
|
||||
thread->Shutdown();
|
||||
}
|
||||
|
||||
MOZ_COUNT_DTOR(MediaCache);
|
||||
}
|
||||
|
||||
|
@ -460,20 +448,13 @@ protected:
|
|||
// A list of resource IDs to notify about the change in suspended status.
|
||||
nsTArray<int64_t> mSuspendedStatusToNotify;
|
||||
// The thread on which we will run data callbacks from the channels.
|
||||
// Could be null if failing to create the thread. Note this thread is shared
|
||||
// among all MediaCache instances.
|
||||
static StaticRefPtr<nsIThread> sThread;
|
||||
// True if we've tried to init sThread. Note we try once only so it is safe
|
||||
// to access sThread on all threads.
|
||||
static bool sThreadInit;
|
||||
// Could be null if failing to create the thread.
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
};
|
||||
|
||||
// Initialized to nullptr by non-local static initialization.
|
||||
/* static */ MediaCache* MediaCache::gMediaCache;
|
||||
|
||||
/* static */ StaticRefPtr<nsIThread> MediaCache::sThread;
|
||||
/* static */ bool MediaCache::sThreadInit = false;
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaCacheFlusher::Observe(nsISupports *aSubject, char const *aTopic, char16_t const *aData)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче