From 43b3882d4854a68afc62dbc655ba873c9c383676 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Wed, 4 Jun 2014 07:49:14 -0700 Subject: [PATCH] Bug 1016805 - fix AsyncTransactionTracker handling r=nical --- gfx/layers/client/ImageClient.cpp | 4 ++-- gfx/layers/ipc/ImageBridgeChild.cpp | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gfx/layers/client/ImageClient.cpp b/gfx/layers/client/ImageClient.cpp index 374fbd19c2dc..c159bb803791 100644 --- a/gfx/layers/client/ImageClient.cpp +++ b/gfx/layers/client/ImageClient.cpp @@ -83,8 +83,8 @@ ImageClient::RemoveTextureWithTracker(TextureClient* aTexture, #ifdef MOZ_WIDGET_GONK // AsyncTransactionTracker is supported only on ImageBridge. // Use AsyncTransactionTracker only when TextureClient is recyeled. - if (GetForwarder()->IsImageBridgeChild() && - aTexture->HasRecycleCallback()) { + if (aAsyncTransactionTracker || + (GetForwarder()->IsImageBridgeChild() && aTexture->HasRecycleCallback())) { RefPtr request = aAsyncTransactionTracker; if (!request) { // Create AsyncTransactionTracker if it is not provided as argument. diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index c2c5f559f186..d88eae29cc6d 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -399,14 +399,14 @@ void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient, nsRefPtr >(&UpdateImageClientNow, aClient, aContainer)); } -static void FlushAllImagesSync(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront, AsyncTransactionTracker* aStatus) +static void FlushAllImagesSync(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront, AsyncTransactionTracker* aTracker) { MOZ_ASSERT(aClient); sImageBridgeChildSingleton->BeginTransaction(); if (aContainer && !aExceptFront) { aContainer->ClearCurrentImage(); } - aClient->FlushAllImages(aExceptFront, aStatus); + aClient->FlushAllImages(aExceptFront, aTracker); aClient->OnTransaction(); sImageBridgeChildSingleton->EndTransaction(); } @@ -425,13 +425,17 @@ void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aCon return; } - RefPtr status = aClient->PrepareFlushAllImages(); - + RefPtr tracker; +#ifdef MOZ_WIDGET_GONK + tracker = aClient->PrepareFlushAllImages(); +#endif sImageBridgeChildSingleton->GetMessageLoop()->PostTask( FROM_HERE, - NewRunnableFunction(&FlushAllImagesSync, aClient, aContainer, aExceptFront, status)); + NewRunnableFunction(&FlushAllImagesSync, aClient, aContainer, aExceptFront, tracker)); - status->WaitComplete(); + if (tracker) { + tracker->WaitComplete(); + } } void