Bug 1416533 - Skip to generate frame if there is no update r=nical,kats

This commit is contained in:
sotaro
2017-11-30 21:38:47 +09:00
parent 5d1e23e728
commit 40d367fa96
6 changed files with 77 additions and 27 deletions

View File

@@ -9,6 +9,7 @@
#include "CompositableHost.h"
#include "gfxEnv.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/WebRenderImageHost.h"
#include "mozilla/layers/WebRenderTextureHost.h"
#include "mozilla/webrender/WebRenderAPI.h"
@@ -30,6 +31,7 @@ AsyncImagePipelineManager::AsyncImagePipelineManager(already_AddRefed<wr::WebRen
, mIdNamespace(mApi->GetNamespace())
, mResourceId(0)
, mAsyncImageEpoch(0)
, mWillGenerateFrame(false)
, mDestroyed(false)
{
MOZ_COUNT_CTOR(AsyncImagePipelineManager);
@@ -48,6 +50,24 @@ AsyncImagePipelineManager::Destroy()
mDestroyed = true;
}
void
AsyncImagePipelineManager::SetWillGenerateFrame()
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
mWillGenerateFrame = true;
}
bool
AsyncImagePipelineManager::GetAndResetWillGenerateFrame()
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
bool ret = mWillGenerateFrame;
mWillGenerateFrame = false;
return ret;
}
void
AsyncImagePipelineManager::AddPipeline(const wr::PipelineId& aPipelineId)
{
@@ -270,6 +290,11 @@ AsyncImagePipelineManager::ApplyAsyncImages()
(pipeline->mIsChanged || op == Some(TextureHost::ADD_IMAGE)) &&
!!pipeline->mCurrentTexture;
// Request to generate frame if there is an update.
if (updateDisplayList || !op.isNothing()) {
SetWillGenerateFrame();
}
if (!updateDisplayList) {
// We don't need to update the display list, either because we can't or because
// the previous one is still up to date.