Bug 1476514 remove WorkleThread::Get() usage from Console r=baku
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 28 Nov 2018 17:31:20 +0000
changeset 505125 68b992118fd3dc3d5ef8b568c1a1449778e8c2f3
parent 505124 ef4fa2ede44ceb17477001e90a1e0a833887782a
child 505126 8c2f7b067abe8e54cfd046effb77bc2ff52cf181
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)
reviewersbaku
bugs1476514
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 1476514 remove WorkleThread::Get() usage from Console r=baku Depends on D13213 Differential Revision: https://phabricator.services.mozilla.com/D13214
dom/console/Console.cpp
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.cpp
@@ -586,25 +586,24 @@ protected:
 };
 
 // This runnable appends a CallData object into the Console queue running on
 // the main-thread.
 class ConsoleCallDataWorkletRunnable final : public ConsoleWorkletRunnable
 {
 public:
   static already_AddRefed<ConsoleCallDataWorkletRunnable>
-  Create(Console* aConsole, ConsoleCallData* aConsoleData)
+  Create(JSContext* aCx, Console* aConsole, ConsoleCallData* aConsoleData)
   {
     WorkletThread::AssertIsOnWorkletThread();
 
     RefPtr<ConsoleCallDataWorkletRunnable> runnable =
       new ConsoleCallDataWorkletRunnable(aConsole, aConsoleData);
 
-    if (!runnable->StoreConsoleData(WorkletThread::Get()->GetJSContext(),
-                                    aConsoleData)) {
+    if (!runnable->StoreConsoleData(aCx, aConsoleData)) {
       return nullptr;
     }
 
     return runnable.forget();
   }
 
 private:
   ConsoleCallDataWorkletRunnable(Console* aConsole,
@@ -878,26 +877,26 @@ private:
   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(Console* aConsole, Console::MethodName aName, const nsAString& aAction,
+  Create(JSContext* aCx, Console* aConsole,
+         Console::MethodName aName, const nsAString& aAction,
          const Sequence<JS::Value>& aArguments)
   {
     WorkletThread::AssertIsOnWorkletThread();
 
     RefPtr<ConsoleProfileWorkletRunnable> runnable =
       new ConsoleProfileWorkletRunnable(aConsole, aName, aAction);
 
-    if (!runnable->StoreProfileData(WorkletThread::Get()->GetJSContext(),
-                                    aArguments)) {
+    if (!runnable->StoreProfileData(aCx, aArguments)) {
       return nullptr;
     }
 
     return runnable.forget();
   }
 
 private:
   ConsoleProfileWorkletRunnable(Console* aConsole, Console::MethodName aName,
@@ -1375,17 +1374,18 @@ Console::ProfileMethodInternal(JSContext
   if (!ShouldProceed(aMethodName)) {
     return;
   }
 
   MaybeExecuteDumpFunction(aCx, aAction, aData, nullptr);
 
   if (WorkletThread::IsOnWorkletThread()) {
     RefPtr<ConsoleProfileWorkletRunnable> runnable =
-      ConsoleProfileWorkletRunnable::Create(this, aMethodName, aAction, aData);
+      ConsoleProfileWorkletRunnable::Create(aCx, this,
+                                            aMethodName, aAction, aData);
     if (!runnable) {
       return;
     }
 
     NS_DispatchToMainThread(runnable.forget());
     return;
   }
 
@@ -1692,17 +1692,17 @@ Console::MethodInternal(JSContext* aCx, 
     // retrieveConsoleEvents/setConsoleEventHandler to main-thread, we can
     // cleanup the mCallDataStorage:
     UnstoreCallData(callData);
     return;
   }
 
   if (WorkletThread::IsOnWorkletThread()) {
     RefPtr<ConsoleCallDataWorkletRunnable> runnable =
-      ConsoleCallDataWorkletRunnable::Create(this, callData);
+      ConsoleCallDataWorkletRunnable::Create(aCx, this, callData);
     if (!runnable) {
       return;
     }
 
     NS_DispatchToMainThread(runnable);
     return;
   }