Bug 1280594 - Pause the compositor directly instead of bouncing off the Gecko thread. r=snorp

This commit is contained in:
Dylan Roeh 2016-06-17 16:03:57 +01:00
parent 367f33f78d
commit 35f22f7ca8
2 changed files with 10 additions and 5 deletions

View File

@ -64,11 +64,9 @@ public class GLController extends JNIObject {
public GLController() {
}
synchronized void serverSurfaceDestroyed() {
void serverSurfaceDestroyed() {
ThreadUtils.assertOnUiThread();
mServerSurfaceValid = false;
// We need to coordinate with Gecko when pausing composition, to ensure
// that Gecko never executes a draw event while the compositor is paused.
// This is sent synchronously to make sure that we don't attempt to use
@ -80,6 +78,10 @@ public class GLController extends JNIObject {
if (mCompositorCreated) {
pauseCompositor();
}
synchronized (this) {
mServerSurfaceValid = false;
}
}
void serverSurfaceChanged(int newWidth, int newHeight) {

View File

@ -908,14 +908,17 @@ public:
template<class Functor>
static void OnNativeCall(Functor&& aCall)
{
if (aCall.IsTarget(&GLControllerSupport::CreateCompositor) ||
aCall.IsTarget(&GLControllerSupport::PauseCompositor)) {
if (aCall.IsTarget(&GLControllerSupport::CreateCompositor)) {
// These calls are blocking.
nsAppShell::SyncRunEvent(WindowEvent<Functor>(
mozilla::Move(aCall)), &GLControllerEvent::MakeEvent);
return;
} else if (aCall.IsTarget(&GLControllerSupport::PauseCompositor)) {
aCall.SetTarget(&GLControllerSupport::SyncPauseCompositor);
(Functor(aCall))();
return;
} else if (aCall.IsTarget(
&GLControllerSupport::SyncResumeResizeCompositor)) {
// This call is synchronous. Perform the original call using a copy