Bug 1488808 Part 7 - Keep track of the PID of the recording process, r=froydnj.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 17 Oct 2018 10:02:02 -0600
changeset 490274 b6ca168b7e52bff9f36a6ca07c1dab6750c87882
parent 490273 5b5ae360b887bc49a765f43a8b38f400d52cb3cc
child 490275 0130de663e9f9006da9381d89967758af9974224
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersfroydnj
bugs1488808
milestone64.0a1
Bug 1488808 Part 7 - Keep track of the PID of the recording process, r=froydnj.
toolkit/recordreplay/ProcessRecordReplay.cpp
toolkit/recordreplay/ProcessRecordReplay.h
--- a/toolkit/recordreplay/ProcessRecordReplay.cpp
+++ b/toolkit/recordreplay/ProcessRecordReplay.cpp
@@ -46,16 +46,19 @@ char* gInitializationFailureMessage;
 
 bool gInitialized;
 ProcessKind gProcessKind;
 char* gRecordingFilename;
 
 // Current process ID.
 static int gPid;
 
+// ID of the process which produced the recording.
+static int gRecordingPid;
+
 // Whether to spew record/replay messages to stderr.
 static bool gSpewEnabled;
 
 extern "C" {
 
 MOZ_EXPORT void
 RecordReplayInterface_Initialize(int aArgc, char* aArgv[])
 {
@@ -149,16 +152,17 @@ RecordReplayInterface_Initialize(int aAr
 
   // Don't create a stylo thread pool when recording or replaying.
   putenv((char*) "STYLO_THREADS=1");
 
   thread->SetPassThrough(false);
 
   Lock::InitializeLocks();
   InitializeRewindState();
+  gRecordingPid = RecordReplayValue(gPid);
 
   gInitialized = true;
 }
 
 MOZ_EXPORT size_t
 RecordReplayInterface_InternalRecordReplayValue(size_t aValue)
 {
   Thread* thread = Thread::Current();
@@ -322,16 +326,22 @@ ThreadEventName(ThreadEvent aEvent)
     ForEachThreadEvent(EnumToString)
 #undef EnumToString
   case ThreadEvent::CallStart: break;
   }
   size_t callId = (size_t) aEvent - (size_t) ThreadEvent::CallStart;
   return gRedirections[callId].mName;
 }
 
+int
+GetRecordingPid()
+{
+  return gRecordingPid;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 // Record/Replay Assertions
 ///////////////////////////////////////////////////////////////////////////////
 
 extern "C" {
 
 MOZ_EXPORT void
 RecordReplayInterface_InternalRecordReplayAssert(const char* aFormat, va_list aArgs)
--- a/toolkit/recordreplay/ProcessRecordReplay.h
+++ b/toolkit/recordreplay/ProcessRecordReplay.h
@@ -227,16 +227,19 @@ void InternalPrint(const char* aFormat, 
 // the recording and will be printed by any recording, replaying, or middleman
 // process. Spew is only printed when enabled via the RECORD_REPLAY_SPEW
 // environment variable.
 MOZ_MakeRecordReplayPrinter(Print, false)
 MOZ_MakeRecordReplayPrinter(PrintSpew, true)
 
 #undef MOZ_MakeRecordReplayPrinter
 
+// Get the ID of the process that produced the recording.
+int GetRecordingPid();
+
 ///////////////////////////////////////////////////////////////////////////////
 // Profiling
 ///////////////////////////////////////////////////////////////////////////////
 
 void InitializeCurrentTime();
 
 // Get a current timestamp, in microseconds.
 double CurrentTime();