Bug 1499186 Part 1 - Allow recording/replaying processes to ignore vsyncs, r=nical.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 17 Oct 2018 10:18:50 -0600
changeset 490285 0fba5665bc65c55a4d1f27905a2a60396dbe2bb8
parent 490284 7f2e0b3603b4edd4b540ba394943b65e5e44fb41
child 490286 b341213ecf95d1448abc0a38ef058138b41324ee
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersnical
bugs1499186
milestone64.0a1
Bug 1499186 Part 1 - Allow recording/replaying processes to ignore vsyncs, r=nical.
gfx/layers/ipc/ShadowLayers.cpp
layout/ipc/VsyncChild.cpp
toolkit/recordreplay/ipc/ChildIPC.h
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -766,35 +766,30 @@ ShadowLayerForwarder::EndTransaction(con
     mPaintTiming.serializeMs() = (TimeStamp::Now() - startTime.value()).ToMilliseconds();
     startTime = Some(TimeStamp::Now());
   }
 
   // We delay at the last possible minute, to give the paint thread a chance to
   // finish. If it does we don't have to delay messages at all.
   GetCompositorBridgeChild()->PostponeMessagesIfAsyncPainting();
 
-  if (recordreplay::IsRecordingOrReplaying()) {
-    recordreplay::child::NotifyPaintStart();
-  }
-
   MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
   RenderTraceScope rendertrace3("Forward Transaction", "000093");
   if (!mShadowManager->SendUpdate(info)) {
     MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
     return false;
   }
 
   if (startTime) {
     mPaintTiming.sendMs() = (TimeStamp::Now() - startTime.value()).ToMilliseconds();
     mShadowManager->SendRecordPaintTimes(mPaintTiming);
   }
 
-  // Create a record/replay checkpoint after each paint.
   if (recordreplay::IsRecordingOrReplaying()) {
-    recordreplay::child::CreateCheckpoint();
+    recordreplay::child::NotifyPaintStart();
   }
 
   *aSent = true;
   mIsFirstPaint = false;
   mFocusTarget = FocusTarget();
   MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
   return true;
 }
--- a/layout/ipc/VsyncChild.cpp
+++ b/layout/ipc/VsyncChild.cpp
@@ -64,18 +64,18 @@ VsyncChild::ActorDestroy(ActorDestroyRea
 mozilla::ipc::IPCResult
 VsyncChild::RecvNotify(const TimeStamp& aVsyncTimestamp)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!mIsShutdown);
 
   SchedulerGroup::MarkVsyncRan();
   if (mObservingVsync && mObserver) {
-    if (recordreplay::IsRecordingOrReplaying()) {
-      recordreplay::child::OnVsync();
+    if (recordreplay::IsRecordingOrReplaying() && !recordreplay::child::OnVsync()) {
+      return IPC_OK();
     }
 
     mObserver->NotifyVsync(aVsyncTimestamp);
   }
   return IPC_OK();
 }
 
 void
--- a/toolkit/recordreplay/ipc/ChildIPC.h
+++ b/toolkit/recordreplay/ipc/ChildIPC.h
@@ -38,18 +38,19 @@ void CreateCheckpoint();
 // Painting Coordination
 ///////////////////////////////////////////////////////////////////////////////
 
 // Tell the child code about any singleton vsync observer that currently
 // exists. This is used to trigger artifical vsyncs that paint the current
 // graphics when paused.
 void SetVsyncObserver(VsyncObserver* aObserver);
 
-// Called before processing incoming vsyncs from the UI process.
-void OnVsync();
+// Called before processing incoming vsyncs from the UI process. Returns false
+// if the vsync should be ignored.
+bool OnVsync();
 
 // Tell the child code about any ongoing painting activity. When a paint is
 // about to happen, the main thread calls NotifyPaintStart, and when the
 // compositor thread finishes the paint it calls NotifyPaintComplete.
 void NotifyPaintStart();
 void NotifyPaintComplete();
 
 // Get a draw target which the compositor thread can paint to.