Bug 1366502 - Make sure all wrapped textureHosts doesn't use TextureFlags::DEALLOCATE_CLIENT flag. v2. r=sotaro
authorJerryShih <hshih@mozilla.com>
Wed, 07 Jun 2017 23:44:05 +0800
changeset 413199 185a1ac1e2813b9d92fa069e63ef0315093c2ab3
parent 413198 7627b9aa45d2897c6a2ee35e6e6f2d75a60b2548
child 413200 00db286bf5b57ca0e46a62c22cd301c74278fd79
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1366502
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1366502 - Make sure all wrapped textureHosts doesn't use TextureFlags::DEALLOCATE_CLIENT flag. v2. r=sotaro MozReview-Commit-ID: KjZIGRzRomT
gfx/layers/wr/WebRenderTextureHost.cpp
--- a/gfx/layers/wr/WebRenderTextureHost.cpp
+++ b/gfx/layers/wr/WebRenderTextureHost.cpp
@@ -22,16 +22,25 @@ namespace layers {
 WebRenderTextureHost::WebRenderTextureHost(const SurfaceDescriptor& aDesc,
                                            TextureFlags aFlags,
                                            TextureHost* aTexture,
                                            wr::ExternalImageId& aExternalImageId)
   : TextureHost(aFlags)
   , mExternalImageId(aExternalImageId)
   , mIsWrappingNativeHandle(false)
 {
+  // The wrapped textureHost will be used in WebRender, and the WebRender could
+  // run at another thread. It's hard to control the life-time when gecko
+  // receives PTextureParent destroy message. It's possible that textureHost is
+  // still used by WebRender. So, we only accept the textureHost without
+  // DEALLOCATE_CLIENT flag here. If the buffer deallocation is controlled by
+  // parent, we could do something to make sure the wrapped textureHost is not
+  // used by WebRender and then release it.
+  MOZ_ASSERT(!(aFlags & TextureFlags::DEALLOCATE_CLIENT));
+
   MOZ_COUNT_CTOR(WebRenderTextureHost);
   mWrappedTextureHost = aTexture;
 
   CreateRenderTextureHost(aDesc, aTexture);
 }
 
 WebRenderTextureHost::~WebRenderTextureHost()
 {