mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 785597 - Allow the compositor to be registered earlier in the startup process and prevent creating multiple LayerManager instances. r=snorp
This commit is contained in:
parent
a752c5511f
commit
513d67161a
@ -118,6 +118,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
|
||||
mPanZoomController = new PanZoomController(this, eventDispatcher);
|
||||
mView = view;
|
||||
mView.setListener(this);
|
||||
}
|
||||
|
||||
/** Attaches to root layer so that Gecko appears. */
|
||||
@ -127,7 +128,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
mRootLayer = new VirtualLayer(new IntSize(mView.getWidth(), mView.getHeight()));
|
||||
mLayerRenderer = mView.getRenderer();
|
||||
|
||||
mView.setListener(this);
|
||||
sendResizeEventIfNecessary(true);
|
||||
|
||||
DisplayPortCalculator.initPrefs();
|
||||
|
@ -174,7 +174,11 @@ nsWindow::~nsWindow()
|
||||
if (top->mFocus == this)
|
||||
top->mFocus = nullptr;
|
||||
ALOG("nsWindow %p destructor", (void*)this);
|
||||
SetCompositor(NULL, NULL);
|
||||
if (mLayerManager == sLayerManager) {
|
||||
// If this window was the one that created the global OMTC layer manager
|
||||
// and compositor, then we should null those out.
|
||||
SetCompositor(NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -697,9 +701,14 @@ nsWindow::GetLayerManager(PLayersChild*, LayersBackend, LayerManagerPersistence,
|
||||
bool useCompositor = UseOffMainThreadCompositing();
|
||||
|
||||
if (useCompositor) {
|
||||
if (sLayerManager) {
|
||||
return sLayerManager;
|
||||
}
|
||||
CreateCompositor();
|
||||
if (mLayerManager) {
|
||||
SetCompositor(mCompositorParent, mCompositorChild);
|
||||
// for OMTC create a single layer manager and compositor that will be
|
||||
// used for all windows.
|
||||
SetCompositor(mLayerManager, mCompositorParent, mCompositorChild);
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
@ -2276,16 +2285,19 @@ nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
|
||||
|
||||
// off-main-thread compositor fields and functions
|
||||
|
||||
nsRefPtr<mozilla::layers::LayerManager> nsWindow::sLayerManager = 0;
|
||||
nsRefPtr<mozilla::layers::CompositorParent> nsWindow::sCompositorParent = 0;
|
||||
nsRefPtr<mozilla::layers::CompositorChild> nsWindow::sCompositorChild = 0;
|
||||
bool nsWindow::sCompositorPaused = false;
|
||||
|
||||
void
|
||||
nsWindow::SetCompositor(mozilla::layers::CompositorParent* aCompositorParent,
|
||||
nsWindow::SetCompositor(mozilla::layers::LayerManager* aLayerManager,
|
||||
mozilla::layers::CompositorParent* aCompositorParent,
|
||||
mozilla::layers::CompositorChild* aCompositorChild)
|
||||
{
|
||||
bool sizeChangeNeeded = (aCompositorParent && !sCompositorParent && gAndroidBounds.width != 0);
|
||||
|
||||
sLayerManager = aLayerManager;
|
||||
sCompositorParent = aCompositorParent;
|
||||
sCompositorChild = aCompositorChild;
|
||||
|
||||
|
@ -150,7 +150,8 @@ public:
|
||||
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect);
|
||||
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect);
|
||||
|
||||
static void SetCompositor(mozilla::layers::CompositorParent* aCompositorParent,
|
||||
static void SetCompositor(mozilla::layers::LayerManager* aLayerManager,
|
||||
mozilla::layers::CompositorParent* aCompositorParent,
|
||||
mozilla::layers::CompositorChild* aCompositorChild);
|
||||
static void ScheduleComposite();
|
||||
static void SchedulePauseComposition();
|
||||
@ -231,6 +232,7 @@ private:
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
mozilla::AndroidLayerRendererFrame mLayerRendererFrame;
|
||||
|
||||
static nsRefPtr<mozilla::layers::LayerManager> sLayerManager;
|
||||
static nsRefPtr<mozilla::layers::CompositorParent> sCompositorParent;
|
||||
static nsRefPtr<mozilla::layers::CompositorChild> sCompositorChild;
|
||||
static bool sCompositorPaused;
|
||||
|
Loading…
Reference in New Issue
Block a user