b=752368; [android] random black screen when opening links from other apps; r=bgirard,ajuma

This commit is contained in:
Vladimir Vukicevic 2012-05-09 22:32:54 -04:00
Родитель a919d41936
Коммит a994367201
3 изменённых файлов: 28 добавлений и 3 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -71,6 +71,7 @@ CompositorParent::CompositorParent(nsIWidget* aWidget, MessageLoop* aMsgLoop,
, mThreadID(aThreadID)
, mRenderToEGLSurface(aRenderToEGLSurface)
, mEGLSurfaceSize(aSurfaceWidth, aSurfaceHeight)
, mPauseCompositionMonitor("PauseCompositionMonitor")
{
MOZ_COUNT_CTOR(CompositorParent);
}
@ -146,6 +147,9 @@ CompositorParent::PauseComposition()
{
NS_ABORT_IF_FALSE(CompositorThreadID() == PlatformThread::CurrentId(),
"PauseComposition() can only be called on the compositor thread");
mozilla::MonitorAutoLock lock(mPauseCompositionMonitor);
if (!mPaused) {
mPaused = true;
@ -153,6 +157,9 @@ CompositorParent::PauseComposition()
static_cast<LayerManagerOGL*>(mLayerManager.get())->gl()->ReleaseSurface();
#endif
}
// if anyone's waiting to make sure that composition really got paused, tell them
lock.NotifyAll();
}
void
@ -184,12 +191,21 @@ CompositorParent::ResumeCompositionAndResize(int width, int height)
ResumeComposition();
}
/*
* This will execute a pause synchronously, waiting to make sure that the compositor
* really is paused.
*/
void
CompositorParent::SchedulePauseOnCompositorThread()
{
mozilla::MonitorAutoLock lock(mPauseCompositionMonitor);
CancelableTask *pauseTask = NewRunnableMethod(this,
&CompositorParent::PauseComposition);
CompositorLoop()->PostTask(FROM_HERE, pauseTask);
// Wait until the pause has actually been processed by the compositor thread
lock.Wait();
}
void

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -52,6 +52,7 @@
#include "mozilla/layers/PCompositorParent.h"
#include "mozilla/layers/PLayersParent.h"
#include "base/thread.h"
#include "mozilla/Monitor.h"
#include "ShadowLayersManager.h"
class nsIWidget;
@ -170,6 +171,8 @@ private:
bool mRenderToEGLSurface;
nsIntSize mEGLSurfaceSize;
mozilla::Monitor mPauseCompositionMonitor;
DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
};

Просмотреть файл

@ -466,7 +466,13 @@ public class GeckoLayerClient implements GeckoEventResponder,
public void compositionPauseRequested() {
// We need to coordinate with Gecko when pausing composition, to ensure
// that Gecko never executes a draw event while the compositor is paused.
GeckoAppShell.sendEventToGecko(GeckoEvent.createCompositorPauseEvent());
// This is sent synchronously to make sure that we don't attempt to use
// any outstanding Surfaces after we call this (such as from a
// surfaceDestroyed notification), and to make sure that any in-flight
// Gecko draw events have been processed. When this returns, composition is
// definitely paused -- it'll synchronize with the Gecko event loop, which
// in turn will synchronize with the compositor thread.
GeckoAppShell.sendEventToGeckoSync(GeckoEvent.createCompositorPauseEvent());
}
/** Implementation of LayerView.Listener */