Bug 1381748 - Cleanup FetchConsumer workflow - part 2 - cleanup RegisterWorkerHolder. r=catalinb, a=lizzard
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 04 Sep 2017 17:06:31 +0200
changeset 424043 32d8da2721a2d8072666f94fe4d4dbbd6ae224aa
parent 424042 cec5d3fc21b12cdd81c789c36ce40c2a05977162
child 424044 335fe07a77edada15fcf9f05366aa31a9d2ecc93
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscatalinb, lizzard
bugs1381748
milestone56.0
Bug 1381748 - Cleanup FetchConsumer workflow - part 2 - cleanup RegisterWorkerHolder. r=catalinb, a=lizzard
dom/fetch/FetchConsumer.cpp
dom/fetch/FetchConsumer.h
--- a/dom/fetch/FetchConsumer.cpp
+++ b/dom/fetch/FetchConsumer.cpp
@@ -338,17 +338,17 @@ FetchBodyConsumer<Derived>::Create(nsIGl
 
   RefPtr<FetchBodyConsumer<Derived>> consumer =
     new FetchBodyConsumer<Derived>(aMainThreadEventTarget, aGlobal,
                                    workerPrivate, aBody, bodyStream, promise,
                                    aType);
 
   if (!NS_IsMainThread()) {
     MOZ_ASSERT(workerPrivate);
-    if (NS_WARN_IF(!consumer->RegisterWorkerHolder(workerPrivate))) {
+    if (NS_WARN_IF(!consumer->RegisterWorkerHolder())) {
       aRv.Throw(NS_ERROR_FAILURE);
       return nullptr;
     }
   } else {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (NS_WARN_IF(!os)) {
       aRv.Throw(NS_ERROR_FAILURE);
       return nullptr;
@@ -446,25 +446,25 @@ template <class Derived>
 void
 FetchBodyConsumer<Derived>::AssertIsOnTargetThread() const
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mTargetThread);
 }
 
 template <class Derived>
 bool
-FetchBodyConsumer<Derived>::RegisterWorkerHolder(WorkerPrivate* aWorkerPrivate)
+FetchBodyConsumer<Derived>::RegisterWorkerHolder()
 {
-  MOZ_ASSERT(aWorkerPrivate);
-  aWorkerPrivate->AssertIsOnWorkerThread();
+  MOZ_ASSERT(mWorkerPrivate);
+  mWorkerPrivate->AssertIsOnWorkerThread();
 
   MOZ_ASSERT(!mWorkerHolder);
   mWorkerHolder.reset(new FetchBodyWorkerHolder<Derived>(this));
 
-  if (!mWorkerHolder->HoldWorker(aWorkerPrivate, Closing)) {
+  if (!mWorkerHolder->HoldWorker(mWorkerPrivate, Closing)) {
     NS_WARNING("Failed to add workerHolder");
     mWorkerHolder = nullptr;
     return false;
   }
 
   return true;
 }
 
--- a/dom/fetch/FetchConsumer.h
+++ b/dom/fetch/FetchConsumer.h
@@ -81,17 +81,17 @@ private:
                     FetchConsumeType aType);
 
   ~FetchBodyConsumer();
 
   void
   AssertIsOnTargetThread() const;
 
   bool
-  RegisterWorkerHolder(workers::WorkerPrivate* aWorkerPrivate);
+  RegisterWorkerHolder();
 
   nsCOMPtr<nsIThread> mTargetThread;
   nsCOMPtr<nsIEventTarget> mMainThreadEventTarget;
 
 #ifdef DEBUG
   // This is used only to check if the body has been correctly consumed.
   RefPtr<FetchBody<Derived>> mBody;
 #endif