зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1647112 - P2. Remove static method. r=mattwoodrow
Allows to remove the dance around the compositor thread just to perform the assertion. The use of an in-line lambda avoid all ambiguity on which thread this is called. Differential Revision: https://phabricator.services.mozilla.com/D80635
This commit is contained in:
Родитель
28c6755d49
Коммит
9356971435
|
@ -69,22 +69,6 @@ already_AddRefed<CanvasThreadHolder> CanvasThreadHolder::EnsureCanvasThread() {
|
|||
return do_AddRef(lockedCanvasThreadHolder.ref());
|
||||
}
|
||||
|
||||
/* static */
|
||||
void CanvasThreadHolder::StaticRelease(
|
||||
already_AddRefed<CanvasThreadHolder> aCanvasThreadHolder) {
|
||||
RefPtr<CanvasThreadHolder> threadHolder = aCanvasThreadHolder;
|
||||
// Note we can't just use NS_IsInCompositorThread() here because
|
||||
// sCompositorThreadHolder might have already gone.
|
||||
MOZ_ASSERT(threadHolder->mCompositorThreadKeepAlive->GetCompositorThread()
|
||||
->IsOnCurrentThread());
|
||||
threadHolder = nullptr;
|
||||
|
||||
auto lockedCanvasThreadHolder = sCanvasThreadHolder.Lock();
|
||||
if (lockedCanvasThreadHolder.ref()->mRefCnt == 1) {
|
||||
lockedCanvasThreadHolder.ref() = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void CanvasThreadHolder::ReleaseOnCompositorThread(
|
||||
already_AddRefed<CanvasThreadHolder> aCanvasThreadHolder) {
|
||||
|
@ -95,7 +79,14 @@ void CanvasThreadHolder::ReleaseOnCompositorThread(
|
|||
->Dispatch(NS_NewRunnableFunction(
|
||||
"CanvasThreadHolder::StaticRelease",
|
||||
[canvasThreadHolder = std::move(canvasThreadHolder)]() mutable {
|
||||
CanvasThreadHolder::StaticRelease(canvasThreadHolder.forget());
|
||||
RefPtr<CanvasThreadHolder> threadHolder =
|
||||
canvasThreadHolder.forget();
|
||||
threadHolder = nullptr;
|
||||
|
||||
auto lockedCanvasThreadHolder = sCanvasThreadHolder.Lock();
|
||||
if (lockedCanvasThreadHolder.ref()->mRefCnt == 1) {
|
||||
lockedCanvasThreadHolder.ref() = nullptr;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -77,9 +77,6 @@ class CanvasThreadHolder final {
|
|||
already_AddRefed<TaskQueue> CreateWorkerTaskQueue();
|
||||
|
||||
private:
|
||||
static void StaticRelease(
|
||||
already_AddRefed<CanvasThreadHolder> aCanvasThreadHolder);
|
||||
|
||||
static StaticDataMutex<StaticRefPtr<CanvasThreadHolder>> sCanvasThreadHolder;
|
||||
|
||||
CanvasThreadHolder(already_AddRefed<nsISerialEventTarget> aCanvasThread,
|
||||
|
|
Загрузка…
Ссылка в новой задаче