Bug 1227015 P2 Move mScriptSpec from registration job into script job base. r=ehsan
authorBen Kelly <ben@wanderview.com>
Fri, 11 Dec 2015 14:53:10 -0500
changeset 276233 1ebdba6df716d7c49457915aa3ec7bd4207b84c5
parent 276232 51d23f0cb661b264a79c789fabaf156d74f03cfe
child 276234 066ffdf89e63bf96b5dc5cbc974cff36275d6979
push id69085
push userbkelly@mozilla.com
push dateFri, 11 Dec 2015 19:53:22 +0000
treeherdermozilla-inbound@412e32773fbf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1227015
milestone45.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 1227015 P2 Move mScriptSpec from registration job into script job base. r=ehsan
dom/workers/ServiceWorkerManager.cpp
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -963,23 +963,27 @@ protected:
     }
   }
 };
 
 // Base type for jobs that work with a specific service worker script.
 class ServiceWorkerScriptJobBase : public ServiceWorkerJobBase
 {
 protected:
+  const nsCString mScriptSpec;
+
   ServiceWorkerScriptJobBase(ServiceWorkerJobQueue* aQueue,
                              ServiceWorkerJob::Type aJobType,
                              ServiceWorkerUpdateFinishCallback* aCallback,
                              ServiceWorkerRegistrationInfo* aRegistration,
-                             ServiceWorkerInfo* aServiceWorkerInfo)
+                             ServiceWorkerInfo* aServiceWorkerInfo,
+                             const nsACString& aScriptSpec)
     : ServiceWorkerJobBase(aQueue, aJobType, aCallback, aRegistration,
                            aServiceWorkerInfo)
+    , mScriptSpec(aScriptSpec)
   {
   }
 
   // This MUST only be called when the job is still performing actions related
   // to registration or update. After the spec resolves the update promise, use
   // Done() with the failure code instead.
   // Callers MUST hold a strong ref before calling this!
   void
@@ -1046,17 +1050,18 @@ class ServiceWorkerInstallJob final : pu
   friend class ContinueInstallTask;
 
 public:
   ServiceWorkerInstallJob(ServiceWorkerJobQueue* aQueue,
                           ServiceWorkerUpdateFinishCallback* aCallback,
                           ServiceWorkerRegistrationInfo* aRegistration,
                           ServiceWorkerInfo* aServiceWorkerInfo)
     : ServiceWorkerScriptJobBase(aQueue, Type::InstallJob, aCallback,
-                                 aRegistration, aServiceWorkerInfo)
+                                 aRegistration, aServiceWorkerInfo,
+                                 EmptyCString())
   {
     MOZ_ASSERT(aRegistration);
   }
 
   void
   Start()
   {
     AssertIsOnMainThread();
@@ -1177,17 +1182,16 @@ public:
 };
 
 class ServiceWorkerRegisterJob final : public ServiceWorkerScriptJobBase,
                                        public serviceWorkerScriptCache::CompareCallback
 {
   friend class ContinueUpdateRunnable;
 
   nsCString mScope;
-  nsCString mScriptSpec;
   nsCOMPtr<nsIPrincipal> mPrincipal;
   nsCOMPtr<nsILoadGroup> mLoadGroup;
 
   ~ServiceWorkerRegisterJob()
   { }
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
@@ -1195,33 +1199,32 @@ public:
   // [[Register]]
   ServiceWorkerRegisterJob(ServiceWorkerJobQueue* aQueue,
                            const nsCString& aScope,
                            const nsCString& aScriptSpec,
                            ServiceWorkerUpdateFinishCallback* aCallback,
                            nsIPrincipal* aPrincipal,
                            nsILoadGroup* aLoadGroup)
     : ServiceWorkerScriptJobBase(aQueue, Type::RegisterJob, aCallback, nullptr,
-                                 nullptr)
+                                 nullptr, aScriptSpec)
     , mScope(aScope)
-    , mScriptSpec(aScriptSpec)
     , mPrincipal(aPrincipal)
     , mLoadGroup(aLoadGroup)
   {
     AssertIsOnMainThread();
     MOZ_ASSERT(mLoadGroup);
     MOZ_ASSERT(aCallback);
   }
 
   // [[Update]]
   ServiceWorkerRegisterJob(ServiceWorkerJobQueue* aQueue,
                            ServiceWorkerRegistrationInfo* aRegistration,
                            ServiceWorkerUpdateFinishCallback* aCallback)
     : ServiceWorkerScriptJobBase(aQueue, Type::UpdateJob, aCallback,
-                                 aRegistration, nullptr)
+                                 aRegistration, nullptr, EmptyCString())
   {
     AssertIsOnMainThread();
   }
 
   void
   Start() override
   {
     AssertIsOnMainThread();