Bug 1366502 - Make sure all wrapped textureHosts doesn't use TextureFlags::DEALLOCATE_CLIENT flag. v2. r=sotaro
☠☠ backed out by b6e861dcd4c2 ☠ ☠
authorJerryShih <hshih@mozilla.com>
Tue, 06 Jun 2017 19:18:41 +0800
changeset 410686 42350bacb0bc3aa1f6c5daeb1377af74fb32001c
parent 410685 7f98b7f60e5885589af43fa130c90c1b9ffe65c5
child 410687 0148cb8a72728c4e16a58659a97c30aaf9e218a5
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [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()
 {