Bug 801176 - part7-v1: Don't remove TextureClient until the frame update is done. r=roc

---
 gfx/layers/client/CanvasClient.cpp | 10 ++++++++--
 gfx/layers/client/CanvasClient.h   |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)
This commit is contained in:
vincentliu 2016-03-04 15:24:19 +08:00
Родитель 8f02812e74
Коммит 34112c9d96
2 изменённых файлов: 10 добавлений и 2 удалений

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

@ -87,7 +87,6 @@ CanvasClient2D::UpdateAsync(AsyncCanvasRenderer* aRenderer)
void
CanvasClient2D::UpdateRenderer(gfx::IntSize aSize, Renderer& aRenderer)
{
AutoRemoveTexture autoRemove(this);
ClientCanvasLayer* layer = nullptr;
AsyncCanvasRenderer* asyncRenderer = nullptr;
if (aRenderer.constructed<ClientCanvasLayer*>()) {
@ -98,7 +97,7 @@ CanvasClient2D::UpdateRenderer(gfx::IntSize aSize, Renderer& aRenderer)
if (mBuffer &&
(mBuffer->IsImmutable() || mBuffer->GetSize() != aSize)) {
autoRemove.mTexture = mBuffer;
mPrevBuffer = mBuffer;
mBuffer = nullptr;
}
@ -155,6 +154,13 @@ CanvasClient2D::UpdateRenderer(gfx::IntSize aSize, Renderer& aRenderer)
void
CanvasClient2D::Updated()
{
AutoRemoveTexture autoRemove(this);
if (mPrevBuffer) {
autoRemove.mTexture = mPrevBuffer;
mPrevBuffer = nullptr;
}
if (mBufferCreated && !AddTextureClient(mBuffer)) {
mBuffer = nullptr;
return;

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

@ -89,6 +89,7 @@ public:
CanvasClient2D(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags)
: CanvasClient(aLayerForwarder, aFlags),
mPrevBuffer(nullptr),
mBufferCreated(false),
mUpdated(false)
{
@ -128,6 +129,7 @@ private:
TextureFlags aFlags,
ClientCanvasLayer* aLayer);
RefPtr<TextureClient> mPrevBuffer;
RefPtr<TextureClient> mBuffer;
bool mBufferCreated;
bool mUpdated;