mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1155268 - Add checked methods to convert from an AbstractThread to a concrete type. r=cpearce
This commit is contained in:
parent
a2b628e20e
commit
8188a54287
@ -85,6 +85,8 @@ public:
|
||||
return mTailDispatcher.ref();
|
||||
}
|
||||
|
||||
virtual nsIThread* AsXPCOMThread() override { return mTarget; }
|
||||
|
||||
private:
|
||||
nsRefPtr<nsIThread> mTarget;
|
||||
Maybe<AutoTaskDispatcher> mTailDispatcher;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MediaTaskQueue;
|
||||
class TaskDispatcher;
|
||||
|
||||
/*
|
||||
@ -66,6 +67,9 @@ public:
|
||||
// tasks to go through the tail dispatcher.
|
||||
bool RequiresTailDispatch() const { return mRequireTailDispatch; }
|
||||
|
||||
virtual MediaTaskQueue* AsTaskQueue() { MOZ_CRASH("Not a task queue!"); }
|
||||
virtual nsIThread* AsXPCOMThread() { MOZ_CRASH("Not an XPCOM thread!"); }
|
||||
|
||||
// Convenience method for getting an AbstractThread for the main thread.
|
||||
static AbstractThread* MainThread();
|
||||
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
|
||||
TaskDispatcher& TailDispatcher() override;
|
||||
|
||||
MediaTaskQueue* AsTaskQueue() override { return this; }
|
||||
|
||||
void Dispatch(already_AddRefed<nsIRunnable> aRunnable,
|
||||
DispatchFailureHandling aFailureHandling = AssertDispatchSuccess,
|
||||
DispatchReason aReason = NormalDispatch) override
|
||||
|
@ -241,7 +241,7 @@ EMEDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
nsRefPtr<MediaDataDecoder> emeDecoder(new EMEDecryptor(decoder,
|
||||
aCallback,
|
||||
mProxy,
|
||||
static_cast<MediaTaskQueue*>(AbstractThread::GetCurrent())));
|
||||
AbstractThread::GetCurrent()->AsTaskQueue()));
|
||||
return emeDecoder.forget();
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ EMEDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
nsRefPtr<MediaDataDecoder> emeDecoder(new EMEDecryptor(decoder,
|
||||
aCallback,
|
||||
mProxy,
|
||||
static_cast<MediaTaskQueue*>(AbstractThread::GetCurrent())));
|
||||
AbstractThread::GetCurrent()->AsTaskQueue()));
|
||||
return emeDecoder.forget();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user