Bug 1469486 - Protect main thread in-process access to WinCompositorWidget transparent surface. r=lsalzman
authorRyan Hunt <rhunt@eqrion.net>
Thu, 27 Sep 2018 15:57:56 -0500
changeset 499156 777ef3d920f01a85b677dea8914fc38df9135814
parent 499113 e4220fa7a191903a814e8cf473cf544fe9762625
child 499157 8940f3ccdbd00b246dc41608545855580f675a90
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1469486
milestone64.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 1469486 - Protect main thread in-process access to WinCompositorWidget transparent surface. r=lsalzman Differential Revision: https://phabricator.services.mozilla.com/D7178
widget/windows/InProcessWinCompositorWidget.cpp
widget/windows/InProcessWinCompositorWidget.h
--- a/widget/windows/InProcessWinCompositorWidget.cpp
+++ b/widget/windows/InProcessWinCompositorWidget.cpp
@@ -32,16 +32,41 @@ InProcessWinCompositorWidget::InProcessW
                                                            const layers::CompositorOptions& aOptions,
                                                            nsWindow* aWindow)
  : WinCompositorWidget(aInitData, aOptions),
    mWindow(aWindow)
 {
   MOZ_ASSERT(mWindow);
 }
 
+void
+InProcessWinCompositorWidget::OnDestroyWindow()
+{
+  EnterPresentLock();
+  WinCompositorWidget::OnDestroyWindow();
+  LeavePresentLock();
+}
+
+void
+InProcessWinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode)
+{
+  EnterPresentLock();
+  WinCompositorWidget::UpdateTransparency(aMode);
+  LeavePresentLock();
+}
+
+void
+InProcessWinCompositorWidget::ClearTransparentWindow()
+{
+  EnterPresentLock();
+  WinCompositorWidget::ClearTransparentWindow();
+  LeavePresentLock();
+}
+
+
 nsIWidget*
 InProcessWinCompositorWidget::RealWidget()
 {
   return mWindow;
 }
 
 void
 InProcessWinCompositorWidget::ObserveVsync(VsyncObserver* aObserver)
--- a/widget/windows/InProcessWinCompositorWidget.h
+++ b/widget/windows/InProcessWinCompositorWidget.h
@@ -19,16 +19,20 @@ namespace widget {
 // with the compositor.
 class InProcessWinCompositorWidget final : public WinCompositorWidget
 {
 public:
   InProcessWinCompositorWidget(const WinCompositorWidgetInitData& aInitData,
                                const layers::CompositorOptions& aOptions,
                                nsWindow* aWindow);
 
+  void OnDestroyWindow() override;
+  void UpdateTransparency(nsTransparencyMode aMode) override;
+  void ClearTransparentWindow() override;
+
   void ObserveVsync(VsyncObserver* aObserver) override;
   nsIWidget* RealWidget() override;
 
 private:
   nsWindow* mWindow;
 };
 
 } // namespace widget