Bug 1492011 Remove now-unused Console::mStatus r=baku
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 24 Mar 2020 09:00:49 +0000
changeset 520314 2ffea3b36683d899950541a75273edf8855432da
parent 520313 b422b439d74840c1628e6dad12cf934b2d914040
child 520315 25d1b2fe703d7adf198daa80690e9c0c0db367bf
push id37247
push userbtara@mozilla.com
push dateWed, 25 Mar 2020 09:34:57 +0000
treeherdermozilla-central@2abd352490a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1492011
milestone76.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 1492011 Remove now-unused Console::mStatus r=baku Depends on D67990 Differential Revision: https://phabricator.services.mozilla.com/D67991
dom/console/Console.cpp
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.cpp
@@ -94,18 +94,17 @@ class ConsoleCallData final {
         mStartTimerValue(0),
         mStartTimerStatus(Console::eTimerUnknown),
         mLogTimerDuration(0),
         mLogTimerStatus(Console::eTimerUnknown),
         mCountValue(MAX_PAGE_COUNTERS),
         mIDType(eUnknown),
         mOuterIDNumber(0),
         mInnerIDNumber(0),
-        mMethodString(aString),
-        mStatus(eUnused) {}
+        mMethodString(aString) {}
 
   void SetIDs(uint64_t aOuterID, uint64_t aInnerID) {
     MOZ_ASSERT(mIDType == eUnknown);
 
     mOuterIDNumber = aOuterID;
     mInnerIDNumber = aInnerID;
     mIDType = eNumber;
   }
@@ -190,32 +189,18 @@ class ConsoleCallData final {
   // 1)  mTopStackFrame is initialized whenever we have any JS on the stack
   // 2)  mReifiedStack is initialized if we're created in a worker.
   // 3)  mStack is set (possibly to null if there is no JS on the stack) if
   //     we're created on main thread.
   Maybe<ConsoleStackEntry> mTopStackFrame;
   Maybe<nsTArray<ConsoleStackEntry>> mReifiedStack;
   nsCOMPtr<nsIStackFrame> mStack;
 
-  // mStatus is about the lifetime of this object.
-  enum {
-    // If the object is created but it is not owned by some runnable, this is
-    // its status.
-    eUnused,
-
-    // When a runnable takes ownership of a ConsoleCallData and send it to
-    // different thread, this is its status.
-    eInUse
-  } mStatus;
-
  private:
-  ~ConsoleCallData() {
-    AssertIsOnOwningThread();
-    MOZ_ASSERT(mStatus != eInUse);
-  }
+  ~ConsoleCallData() { AssertIsOnOwningThread(); }
 };
 
 // This base class must be extended for Worker and for Worklet.
 class ConsoleRunnable : public StructuredCloneHolderBase {
  public:
   ~ConsoleRunnable() override {
     // Clear the StructuredCloneHolderBase class.
     Clear();
@@ -273,17 +258,17 @@ class ConsoleRunnable : public Structure
 
     if (NS_WARN_IF(!JS_WriteString(aWriter, jsString))) {
       return false;
     }
 
     return true;
   }
 
-  // Helper methods for CallData
+  // Helper method for CallData
   void ProcessCallData(JSContext* aCx, Console* aConsole,
                        ConsoleCallData* aCallData) {
     AssertIsOnMainThread();
 
     ConsoleCommon::ClearException ce(aCx);
 
     JS::Rooted<JS::Value> argumentsValue(aCx);
     if (!Read(aCx, &argumentsValue)) {
@@ -314,23 +299,16 @@ class ConsoleRunnable : public Structure
       }
     }
 
     MOZ_ASSERT(values.Length() == length);
 
     aConsole->ProcessCallData(aCx, aCallData, values);
   }
 
-  void ReleaseCallData(Console* aConsole, ConsoleCallData* aCallData) {
-    aConsole->AssertIsOnOwningThread();
-
-    MOZ_ASSERT(aCallData->mStatus == ConsoleCallData::eInUse);
-    aCallData->mStatus = ConsoleCallData::eUnused;
-  }
-
   // Generic
   bool WriteArguments(JSContext* aCx, const Sequence<JS::Value>& aArguments) {
     ConsoleCommon::ClearException ce(aCx);
 
     JS::Rooted<JSObject*> arguments(
         aCx, JS::NewArrayObject(aCx, aArguments.Length()));
     if (NS_WARN_IF(!arguments)) {
       return false;
@@ -344,17 +322,17 @@ class ConsoleRunnable : public Structure
         return false;
       }
     }
 
     JS::Rooted<JS::Value> value(aCx, JS::ObjectValue(*arguments));
     return WriteData(aCx, value);
   }
 
-  // Helper methods for Profile calls
+  // Helper method for Profile calls
   void ProcessProfileData(JSContext* aCx, Console::MethodName aMethodName,
                           const nsAString& aAction) {
     AssertIsOnMainThread();
 
     ConsoleCommon::ClearException ce(aCx);
 
     JS::Rooted<JS::Value> argumentsValue(aCx);
     bool ok = Read(aCx, &argumentsValue);
@@ -479,19 +457,16 @@ class ConsoleCallDataWorkletRunnable fin
   ConsoleCallDataWorkletRunnable(Console* aConsole, ConsoleCallData* aCallData)
       : ConsoleWorkletRunnable(aConsole), mCallData(aCallData) {
     WorkletThread::AssertIsOnWorkletThread();
     MOZ_ASSERT(aCallData);
     aCallData->AssertIsOnOwningThread();
 
     const WorkletLoadInfo& loadInfo = mWorkletImpl->LoadInfo();
     mCallData->SetIDs(loadInfo.OuterWindowID(), loadInfo.InnerWindowID());
-
-    // Marking this CallData as in use.
-    mCallData->mStatus = ConsoleCallData::eInUse;
   }
 
   ~ConsoleCallDataWorkletRunnable() override { MOZ_ASSERT(!mCallData); }
 
   void RunOnMainThread() override {
     AutoSafeJSContext cx;
 
     JSObject* sandbox =
@@ -508,20 +483,17 @@ class ConsoleCallDataWorkletRunnable fin
     JSAutoRealm ar(cx, global);
 
     // We don't need to set a parent object in mCallData bacause there are not
     // DOM objects exposed to worklet.
 
     ProcessCallData(cx, mConsole, mCallData);
   }
 
-  virtual void ReleaseData() override {
-    ReleaseCallData(mConsole, mCallData);
-    mCallData = nullptr;
-  }
+  virtual void ReleaseData() override { mCallData = nullptr; }
 
   RefPtr<ConsoleCallData> mCallData;
 };
 
 class ConsoleWorkerRunnable : public WorkerProxyToMainThreadRunnable,
                               public ConsoleRunnable {
  public:
   explicit ConsoleWorkerRunnable(Console* aConsole) : mConsole(aConsole) {}
@@ -648,19 +620,16 @@ class ConsoleWorkerRunnable : public Wor
 // This runnable appends a CallData object into the Console queue running on
 // the main-thread.
 class ConsoleCallDataWorkerRunnable final : public ConsoleWorkerRunnable {
  public:
   ConsoleCallDataWorkerRunnable(Console* aConsole, ConsoleCallData* aCallData)
       : ConsoleWorkerRunnable(aConsole), mCallData(aCallData) {
     MOZ_ASSERT(aCallData);
     mCallData->AssertIsOnOwningThread();
-
-    // Marking this CallData as in use.
-    mCallData->mStatus = ConsoleCallData::eInUse;
   }
 
  private:
   ~ConsoleCallDataWorkerRunnable() override { MOZ_ASSERT(!mCallData); }
 
   void RunConsole(JSContext* aCx, nsIGlobalObject* aGlobal,
                   WorkerPrivate* aWorkerPrivate,
                   nsPIDOMWindowOuter* aOuterWindow,
@@ -698,20 +667,17 @@ class ConsoleCallDataWorkerRunnable fina
 
     mClonedData.mGlobal = aGlobal;
 
     ProcessCallData(aCx, mConsole, mCallData);
 
     mClonedData.mGlobal = nullptr;
   }
 
-  virtual void ReleaseData() override {
-    ReleaseCallData(mConsole, mCallData);
-    mCallData = nullptr;
-  }
+  virtual void ReleaseData() override { mCallData = nullptr; }
 
   RefPtr<ConsoleCallData> mCallData;
 };
 
 // This runnable calls ProfileMethod() on the console on the main-thread.
 class ConsoleProfileWorkletRunnable final : public ConsoleWorkletRunnable {
  public:
   static already_AddRefed<ConsoleProfileWorkletRunnable> Create(