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 488997 777ef3d920f01a85b677dea8914fc38df9135814
parent 488996 e4220fa7a191903a814e8cf473cf544fe9762625
child 489014 8940f3ccdbd00b246dc41608545855580f675a90
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewerslsalzman
bugs1469486
milestone64.0a1
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