Bug 1455025 - Cleanup some private methods in WorkerPrivate.h, r=asuth
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 19 Apr 2018 00:02:08 +0200
changeset 467963 1c46524d2fbf42dfb53008b0e684d9f154200f2a
parent 467962 f93b12264c704d8779e00bbd635f66bfd50f7084
child 467964 c8b6fba2ae947808a8965b2e1254487dbe1b7d48
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1455025
milestone61.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 1455025 - Cleanup some private methods in WorkerPrivate.h, r=asuth
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -1772,17 +1772,17 @@ WorkerPrivate::Start()
     }
   }
 
   return false;
 }
 
 // aCx is null when called from the finalizer
 bool
-WorkerPrivate::NotifyPrivate(WorkerStatus aStatus)
+WorkerPrivate::Notify(WorkerStatus aStatus)
 {
   AssertIsOnParentThread();
 
   bool pending;
   {
     MutexAutoLock lock(mMutex);
 
     if (mParentStatus >= aStatus) {
@@ -4340,17 +4340,17 @@ WorkerPrivate::AssertValidSyncLoop(nsIEv
     }
   }
 
   MOZ_ASSERT(valid);
 }
 #endif
 
 void
-WorkerPrivate::PostMessageToParentInternal(
+WorkerPrivate::PostMessageToParent(
                             JSContext* aCx,
                             JS::Handle<JS::Value> aMessage,
                             const Sequence<JSObject*>& aTransferable,
                             ErrorResult& aRv)
 {
   AssertIsOnWorkerThread();
 
   JS::Rooted<JS::Value> transferable(aCx, JS::UndefinedValue());
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -153,38 +153,34 @@ public:
   }
 
   // May be called on any thread...
   bool
   Start();
 
   // Called on the parent thread.
   bool
-  Notify(WorkerStatus aStatus)
-  {
-    return NotifyPrivate(aStatus);
-  }
+  Notify(WorkerStatus aStatus);
 
   bool
   Cancel()
   {
     return Notify(Canceling);
   }
 
   bool
   Kill()
   {
     return Notify(Killing);
   }
 
   bool
   Terminate()
   {
-    AssertIsOnParentThread();
-    return TerminatePrivate();
+    return Notify(Terminating);
   }
 
   bool
   Close();
 
   // The passed principal must be the Worker principal in case of a
   // ServiceWorker and the loading principal for any other type.
   static void
@@ -286,20 +282,17 @@ public:
 
   void
   RemoveChildWorker(WorkerPrivate* aChildWorker);
 
   void
   PostMessageToParent(JSContext* aCx,
                       JS::Handle<JS::Value> aMessage,
                       const Sequence<JSObject*>& aTransferable,
-                      ErrorResult& aRv)
-  {
-    PostMessageToParentInternal(aCx, aMessage, aTransferable, aRv);
-  }
+                      ErrorResult& aRv);
 
   void
   PostMessageToParentMessagePort(JSContext* aCx,
                                  JS::Handle<JS::Value> aMessage,
                                  const Sequence<JSObject*>& aTransferable,
                                  ErrorResult& aRv);
 
   void
@@ -1215,25 +1208,16 @@ private:
                 const nsAString& aScriptURL, bool aIsChromeWorker,
                 WorkerType aWorkerType, const nsAString& aWorkerName,
                 const nsACString& aServiceWorkerScope,
                 WorkerLoadInfo& aLoadInfo);
 
   ~WorkerPrivate();
 
   bool
-  NotifyPrivate(WorkerStatus aStatus);
-
-  bool
-  TerminatePrivate()
-  {
-    return NotifyPrivate(Terminating);
-  }
-
-  bool
   MayContinueRunning()
   {
     AssertIsOnWorkerThread();
 
     WorkerStatus status;
     {
       MutexAutoLock lock(mMutex);
       status = mStatus;
@@ -1274,22 +1258,16 @@ private:
   EnableMemoryReporter();
 
   void
   DisableMemoryReporter();
 
   void
   WaitForWorkerEvents();
 
-  void
-  PostMessageToParentInternal(JSContext* aCx,
-                              JS::Handle<JS::Value> aMessage,
-                              const Sequence<JSObject*>& aTransferable,
-                              ErrorResult& aRv);
-
   // If the worker shutdown status is equal or greater then aFailStatus, this
   // operation will fail and nullptr will be returned. See WorkerHolder.h for
   // more information about the correct value to use.
   already_AddRefed<nsIEventTarget>
   CreateNewSyncLoop(WorkerStatus aFailStatus);
 
   bool
   RunCurrentSyncLoop();