Bug 1465452 Part 8 - Don't record logging state, r=froydnj.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 21 Jul 2018 14:33:38 +0000
changeset 427680 3b091c71170a6f390d1693cc1c87a4a133762f11
parent 427679 554c3f761c64f0bc0bb706a481c9f6950025fe7c
child 427681 25957aa95ba319774782bac5e0211ef82be65ac3
push id105513
push userbhackett@mozilla.com
push dateSun, 22 Jul 2018 02:15:03 +0000
treeherdermozilla-inbound@b17cfac5aa3f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1465452
milestone63.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 1465452 Part 8 - Don't record logging state, r=froydnj.
xpcom/base/Logging.cpp
xpcom/base/Logging.h
--- a/xpcom/base/Logging.cpp
+++ b/xpcom/base/Logging.cpp
@@ -167,17 +167,19 @@ namespace {
     va_end(*va);
   }
 }
 
 class LogModuleManager
 {
 public:
   LogModuleManager()
-    : mModulesLock("logmodules")
+      // As for logging atomics, don't preserve behavior for this lock when
+      // recording/replaying.
+    : mModulesLock("logmodules", recordreplay::Behavior::DontPreserve)
     , mModules(kInitialModuleCount)
     , mPrintEntryCount(0)
     , mOutFile(nullptr)
     , mToReleaseFile(nullptr)
     , mOutFileNum(0)
     , mOutFilePath(strdup(""))
     , mMainThread(PR_GetCurrentThread())
     , mSetFromEnv(false)
--- a/xpcom/base/Logging.h
+++ b/xpcom/base/Logging.h
@@ -142,17 +142,21 @@ private:
     : mName(strdup(aName)), mLevel(aLevel)
   {
   }
 
   LogModule(LogModule&) = delete;
   LogModule& operator=(const LogModule&) = delete;
 
   char* mName;
-  Atomic<LogLevel, Relaxed> mLevel;
+
+  // Logging atomics and other state are not preserved by web replay, as they
+  // may be accessed during the GC and other areas where recorded events are
+  // not allowed.
+  Atomic<LogLevel, Relaxed, recordreplay::Behavior::DontPreserve> mLevel;
 };
 
 /**
  * Helper class that lazy loads the given log module. This is safe to use for
  * declaring static references to log modules and can be used as a replacement
  * for accessing a LogModule directly.
  *
  * Example usage:
@@ -171,17 +175,20 @@ public:
   {
   }
 
   operator LogModule*();
 
 private:
   const char* const mLogName;
   const CorruptionCanaryForStatics mCanary;
-  Atomic<LogModule*, ReleaseAcquire> mLog;
+
+  // As for LogModule::mLevel, don't preserve behavior for this atomic when
+  // recording/replaying.
+  Atomic<LogModule*, ReleaseAcquire, recordreplay::Behavior::DontPreserve> mLog;
 };
 
 namespace detail {
 
 inline bool log_test(const LogModule* module, LogLevel level) {
   MOZ_ASSERT(level != LogLevel::Disabled);
   return module && module->ShouldLog(level);
 }