Bug 1743972 - Reduce Runnable usage in RenderThread::AddRenderTextureOp() r=gfx-reviewers,nical

Differential Revision: https://phabricator.services.mozilla.com/D132666
This commit is contained in:
sotaro 2021-12-06 23:23:20 +00:00
Родитель e589a4b731
Коммит a1fc801ef7
2 изменённых файлов: 15 добавлений и 2 удалений

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

@ -737,8 +737,17 @@ void RenderThread::AddRenderTextureOp(
RefPtr<RenderTextureHost> texture = it->second;
mRenderTextureOps.emplace_back(aOp, std::move(texture));
PostRunnable(NewRunnableMethod("RenderThread::HandleRenderTextureOps", this,
&RenderThread::HandleRenderTextureOps));
if (mRenderTextureOpsRunnable) {
// Runnable was already triggered
return;
}
RefPtr<nsIRunnable> runnable =
NewRunnableMethod("RenderThread::HandleRenderTextureOps", this,
&RenderThread::HandleRenderTextureOps);
mRenderTextureOpsRunnable = runnable;
PostRunnable(runnable.forget());
}
void RenderThread::HandleRenderTextureOps() {
@ -749,6 +758,7 @@ void RenderThread::HandleRenderTextureOps() {
{
MutexAutoLock lock(mRenderTextureMapLock);
mRenderTextureOps.swap(renderTextureOps);
mRenderTextureOpsRunnable = nullptr;
}
for (auto& it : renderTextureOps) {

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

@ -375,6 +375,9 @@ class RenderThread final {
// callback. On device reset we have to remove all GL related resources right
// away.
std::list<RefPtr<RenderTextureHost>> mRenderTexturesDeferred;
RefPtr<nsIRunnable> mRenderTextureOpsRunnable;
bool mHasShutdown;
bool mHandlingDeviceReset;