1From 9da3b9e3faad471278f4d42c17a69ce2ca9e6b03 Mon Sep 17 00:00:00 2001
2From: Takuro Ashie <ashie@clear-code.com>
3Date: Sun, 17 Feb 2019 16:36:53 +0900
4Subject: [PATCH] Enable to suppress multiple compositors
5
6Because embedded devices might not support multiple EGL windows.
7
8Upstream-Status: Inappropriate [embedded specific]
9
10Signed-off-by: Takuro Ashie <ashie@clear-code.com>
11---
12 widget/nsBaseWidget.cpp | 7 +++++++
13 1 file changed, 7 insertions(+)
14
15diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp
16index 00411c736dd3..6f9ff218b8b7 100644
17--- a/widget/nsBaseWidget.cpp
18+++ b/widget/nsBaseWidget.cpp
19@@ -131,6 +131,8 @@ int32_t nsIWidget::sPointerIdCounter = 0;
20 // milliseconds.
21 const uint32_t kAsyncDragDropTimeout = 1000;
22
23+static nsBaseWidget *sSingleCompositorWidget = nullptr;
24+
25 namespace mozilla {
26 namespace widget {
27
28@@ -278,6 +280,9 @@ void nsBaseWidget::DestroyCompositor() {
29     RefPtr<CompositorSession> session = mCompositorSession.forget();
30     session->Shutdown();
31   }
32+
33+  if (sSingleCompositorWidget == this)
34+    sSingleCompositorWidget = nullptr;
35 }
36
37 // This prevents the layer manager from starting a new transaction during
38@@ -1335,6 +1340,8 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) {
39     gfxPlatform::GetPlatform()->NotifyCompositorCreated(
40         mLayerManager->GetCompositorBackendType());
41   }
42+
43+  sSingleCompositorWidget = this;
44 }
45
46 void nsBaseWidget::NotifyCompositorSessionLost(CompositorSession* aSession) {
47--
482.17.1
49
50