Bug 1532457 - Gracefully handle non WebRenderTextureHost case r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Thu, 07 Mar 2019 16:15:17 +0000
changeset 520911 4a8244ddd0c470edf74c6ea0927aa154be89651d
parent 520910 c26d4a8d43c4d0d6f6e13135b8f35924123fe99e
child 520912 59d1e67be63c082fcc6c3ccf486f999a38e20e28
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1532457
milestone67.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 1532457 - Gracefully handle non WebRenderTextureHost case r=nical Differential Revision: https://phabricator.services.mozilla.com/D22256
gfx/layers/wr/AsyncImagePipelineManager.cpp
gfx/layers/wr/AsyncImagePipelineManager.h
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -222,16 +222,20 @@ Maybe<TextureHost::ResourceUpdateOp> Asy
       HoldExternalImage(aPipelineId, aEpoch, aPipeline->mWrTextureWrapper);
     }
     return Nothing();
   }
 
   aPipeline->mCurrentTexture = texture;
 
   WebRenderTextureHost* wrTexture = texture->AsWebRenderTextureHost();
+  MOZ_ASSERT(wrTexture);
+  if (!wrTexture) {
+    gfxCriticalNote << "WebRenderTextureHost is not used";
+  }
 
   bool useExternalImage = !gfxEnv::EnableWebRenderRecording() && wrTexture;
   aPipeline->mUseExternalImage = useExternalImage;
 
   // Use WebRenderTextureHostWrapper only for video.
   // And WebRenderTextureHostWrapper could be used only with
   // WebRenderTextureHost that supports NativeTexture
   bool useWrTextureWrapper = useExternalImage && wrTexture &&
@@ -381,17 +385,17 @@ void AsyncImagePipelineManager::ApplyAsy
     // because the previous one is still up to date. We may, however, have
     // updated some resources.
 
     // Use transaction of scene builder thread to notify epoch.
     // It is for making epoch update consistent.
     aSceneBuilderTxn.UpdateEpoch(aPipelineId, aEpoch);
     if (aPipeline->mCurrentTexture) {
       HoldExternalImage(aPipelineId, aEpoch,
-                        aPipeline->mCurrentTexture->AsWebRenderTextureHost());
+                        aPipeline->mCurrentTexture);
     }
     return;
   }
 
   aPipeline->mIsChanged = false;
 
   wr::LayoutSize contentSize{aPipeline->mScBounds.Width(),
                              aPipeline->mScBounds.Height()};
@@ -424,17 +428,17 @@ void AsyncImagePipelineManager::ApplyAsy
 
     if (aPipeline->mUseExternalImage) {
       MOZ_ASSERT(aPipeline->mCurrentTexture->AsWebRenderTextureHost());
       Range<wr::ImageKey> range_keys(&keys[0], keys.Length());
       aPipeline->mCurrentTexture->PushDisplayItems(
           builder, wr::ToRoundedLayoutRect(rect), wr::ToRoundedLayoutRect(rect),
           aPipeline->mFilter, range_keys);
       HoldExternalImage(aPipelineId, aEpoch,
-                        aPipeline->mCurrentTexture->AsWebRenderTextureHost());
+                        aPipeline->mCurrentTexture);
     } else {
       MOZ_ASSERT(keys.Length() == 1);
       builder.PushImage(wr::ToRoundedLayoutRect(rect),
                         wr::ToRoundedLayoutRect(rect), true, aPipeline->mFilter,
                         keys[0]);
     }
   }
 
@@ -505,17 +509,17 @@ void AsyncImagePipelineManager::SetEmpty
   txn.SetDisplayList(
       gfx::Color(0.f, 0.f, 0.f, 0.f), epoch,
       LayerSize(pipeline->mScBounds.Width(), pipeline->mScBounds.Height()),
       aPipelineId, builderContentSize, dl.dl_desc, dl.dl);
 }
 
 void AsyncImagePipelineManager::HoldExternalImage(
     const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch,
-    WebRenderTextureHost* aTexture) {
+    TextureHost* aTexture) {
   if (mDestroyed) {
     return;
   }
   MOZ_ASSERT(aTexture);
 
   PipelineTexturesHolder* holder =
       mPipelineTexturesHolders.Get(wr::AsUint64(aPipelineId));
   MOZ_ASSERT(holder);
--- a/gfx/layers/wr/AsyncImagePipelineManager.h
+++ b/gfx/layers/wr/AsyncImagePipelineManager.h
@@ -49,17 +49,17 @@ class AsyncImagePipelineManager final {
   void AddPipeline(const wr::PipelineId& aPipelineId,
                    WebRenderBridgeParent* aWrBridge);
   void RemovePipeline(const wr::PipelineId& aPipelineId,
                       const wr::Epoch& aEpoch);
   WebRenderBridgeParent* GetWrBridge(const wr::PipelineId& aPipelineId);
 
   void HoldExternalImage(const wr::PipelineId& aPipelineId,
                          const wr::Epoch& aEpoch,
-                         WebRenderTextureHost* aTexture);
+                         TextureHost* aTexture);
   void HoldExternalImage(const wr::PipelineId& aPipelineId,
                          const wr::Epoch& aEpoch,
                          WebRenderTextureHostWrapper* aWrTextureWrapper);
   void HoldExternalImage(const wr::PipelineId& aPipelineId,
                          const wr::Epoch& aEpoch,
                          const wr::ExternalImageId& aImageId);
 
   // This is called from the Renderer thread to notify this class about the