Restrict SetDispAcquireFence's nsIWidget access to Gonk. (bug 1269653 part 2, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Tue, 03 May 2016 17:37:34 -0700
changeset 295962 2872b9050cab51f33bc0d95b72461a990b80dd34
parent 295961 3a4e68d0112b13c94e47e0f11b73aafdeebd844a
child 295963 a5086ab888367112761074071ce56ce95ca7a113
push id76156
push userdanderson@mozilla.com
push dateWed, 04 May 2016 00:38:26 +0000
treeherdermozilla-inbound@2872b9050cab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1269653
milestone49.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
Restrict SetDispAcquireFence's nsIWidget access to Gonk. (bug 1269653 part 2, r=kats)
gfx/layers/Compositor.cpp
gfx/layers/Compositor.h
gfx/layers/composite/LayerManagerComposite.cpp
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -407,29 +407,28 @@ Compositor::SetInvalid()
 bool
 Compositor::IsValid() const
 {
   return !mParent;
 }
 
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
 void
-Compositor::SetDispAcquireFence(Layer* aLayer, nsIWidget* aWidget)
+Compositor::SetDispAcquireFence(Layer* aLayer)
 {
   // OpenGL does not provide ReleaseFence for rendering.
   // Instead use DispAcquireFence as layer buffer's ReleaseFence
   // to prevent flickering and tearing.
   // DispAcquireFence is DisplaySurface's AcquireFence.
   // AcquireFence will be signaled when a buffer's content is available.
   // See Bug 974152.
-
-  if (!aLayer || !aWidget) {
+  if (!aLayer || !mWidget) {
     return;
   }
-  nsWindow* window = static_cast<nsWindow*>(aWidget);
+  nsWindow* window = static_cast<nsWindow*>(mWidget->RealWidget());
   RefPtr<FenceHandle::FdObj> fence = new FenceHandle::FdObj(
       window->GetScreen()->GetPrevDispAcquireFd());
   mReleaseFenceHandle.Merge(FenceHandle(fence));
 }
 
 FenceHandle
 Compositor::GetReleaseFence()
 {
@@ -438,17 +437,17 @@ Compositor::GetReleaseFence()
   }
 
   RefPtr<FenceHandle::FdObj> fdObj = mReleaseFenceHandle.GetDupFdObj();
   return FenceHandle(fdObj);
 }
 
 #else
 void
-Compositor::SetDispAcquireFence(Layer* aLayer, nsIWidget* aWidget)
+Compositor::SetDispAcquireFence(Layer* aLayer)
 {
 }
 
 FenceHandle
 Compositor::GetReleaseFence()
 {
   return FenceHandle();
 }
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -384,17 +384,17 @@ public:
                           gfx::Rect* aClipRectOut = nullptr,
                           gfx::Rect* aRenderBoundsOut = nullptr) = 0;
 
   /**
    * Flush the current frame to the screen and tidy up.
    */
   virtual void EndFrame() = 0;
 
-  virtual void SetDispAcquireFence(Layer* aLayer, nsIWidget* aWidget);
+  virtual void SetDispAcquireFence(Layer* aLayer);
 
   virtual FenceHandle GetReleaseFence();
 
   /**
    * Post-rendering stuff if the rendering is done outside of this Compositor
    * e.g., by Composer2D.
    * aTransform is the transform from user space to window space.
    */
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -940,17 +940,17 @@ LayerManagerComposite::Render(const nsIn
 
   {
     PROFILER_LABEL("LayerManagerComposite", "EndFrame",
       js::ProfileEntry::Category::GRAPHICS);
 
     mCompositor->EndFrame();
 
     // Call after EndFrame()
-    mCompositor->SetDispAcquireFence(mRoot, mCompositor->GetWidget()->RealWidget());
+    mCompositor->SetDispAcquireFence(mRoot);
   }
 
   if (composer2D) {
     composer2D->Render(mCompositor->GetWidget()->RealWidget());
   }
 
   mCompositor->GetWidget()->PostRender(this);