Bug 1510708 - Don't send OnPaused notification to debugger for intermediate checkpoint when warping, r=mccr8.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 28 Nov 2018 08:11:01 -1000
changeset 505574 d44f09e1a87bda1fbe51a05b8526cad6459ff07b
parent 505573 aa55c733298cd457d1f1af33dc5323233b67daae
child 505575 c435d7c0173e6b9bf699d80e370a657bdff248ed
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1510708
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1510708 - Don't send OnPaused notification to debugger for intermediate checkpoint when warping, r=mccr8.
toolkit/recordreplay/ipc/ParentIPC.cpp
--- a/toolkit/recordreplay/ipc/ParentIPC.cpp
+++ b/toolkit/recordreplay/ipc/ParentIPC.cpp
@@ -1037,16 +1037,19 @@ void Resume(bool aForward) {
 
     // Idle children might change their behavior as we run forward.
     PokeChildren();
   }
 
   gActiveChild->SendMessage(ResumeMessage(aForward));
 }
 
+// Whether the child is restoring an earlier checkpoint as part of a time warp.
+static bool gTimeWarpInProgress;
+
 void TimeWarp(const js::ExecutionPoint& aTarget) {
   MOZ_RELEASE_ASSERT(gActiveChild->IsPaused());
 
   // Make sure the active child can rewind to the checkpoint prior to the
   // warp target.
   MOZ_RELEASE_ASSERT(gTimeWarpTarget.isNothing());
   gTimeWarpTarget.emplace(aTarget.mCheckpoint);
 
@@ -1072,18 +1075,23 @@ void TimeWarp(const js::ExecutionPoint& 
 
     SwitchActiveChild(targetChild, /* aRecoverPosition = */ false);
   }
 
   gTimeWarpTarget.reset();
 
   if (!gActiveChild->IsPausedAtCheckpoint() ||
       gActiveChild->LastCheckpoint() != aTarget.mCheckpoint) {
+    MOZ_RELEASE_ASSERT(!gTimeWarpInProgress);
+    gTimeWarpInProgress = true;
+
     gActiveChild->SendMessage(RestoreCheckpointMessage(aTarget.mCheckpoint));
     gActiveChild->WaitUntilPaused();
+
+    gTimeWarpInProgress = false;
   }
 
   gActiveChild->SendMessage(RunToPointMessage(aTarget));
 
   gActiveChild->WaitUntilPaused();
   SendMessageToUIProcess("TimeWarpFinished");
 }
 
@@ -1094,16 +1102,23 @@ void ResumeBeforeWaitingForIPDLReply() {
   // recording child process. If the child is paused, resume it immediately so
   // that we don't deadlock.
   if (gActiveChild->IsPaused()) {
     Resume(true);
   }
 }
 
 static void RecvHitCheckpoint(const HitCheckpointMessage& aMsg) {
+  // Ignore HitCheckpoint messages received while doing a time warp. TimeWarp()
+  // will immediately resume the child and we don't want to tell the debugger
+  // it ever paused.
+  if (gTimeWarpInProgress) {
+    return;
+  }
+
   UpdateCheckpointTimes(aMsg);
   MaybeUpdateGraphicsAtCheckpoint(aMsg.mCheckpointId);
 
   // Immediately resume if the main thread is blocked. If there is no
   // debugger attached a resume is needed as well, but post a runnable so that
   // callers waiting for the child to pause (e.g. SaveRecording) don't starve.
   if (MainThreadIsWaitingForIPDLReply()) {
     Resume(true);