Bug 1241531 - Part 2: Move Cancel() to ServiceWorkerJob base class. r=ehsan, a=sylvestre
authorBen Kelly <ben@wanderview.com>
Thu, 21 Jan 2016 08:49:00 -0500
changeset 298510 e447e2dffa477e57a5337843595578c8d3cf0333
parent 298509 b0e72ac2a04a7527b8dfdabf5f63059e749f7f11
child 298511 ebe66fdceb897a09195bb59b79477200660fdaf6
push id8972
push usercbook@mozilla.com
push dateMon, 25 Jan 2016 11:05:12 +0000
treeherdermozilla-aurora@840b94bdff0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, sylvestre
bugs1241531
milestone45.0a2
Bug 1241531 - Part 2: Move Cancel() to ServiceWorkerJob base class. r=ehsan, a=sylvestre
dom/workers/ServiceWorkerManager.cpp
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -163,33 +163,42 @@ public:
     RegisterJob,
     UpdateJob,
     InstallJob,
     UnregisterJob
   };
 
   virtual void Start() = 0;
 
+  void
+  Cancel()
+  {
+    mQueue = nullptr;
+    mCanceled = true;
+  }
+
   bool
   IsRegisterOrInstallJob() const
   {
     return mJobType == RegisterJob || mJobType == UpdateJob ||
       mJobType == InstallJob;
   }
 
 protected:
   // The queue keeps the jobs alive, so they can hold a rawptr back to the
   // queue.
   ServiceWorkerJobQueue* mQueue;
 
   Type mJobType;
+  bool mCanceled;
 
   explicit ServiceWorkerJob(ServiceWorkerJobQueue* aQueue, Type aJobType)
     : mQueue(aQueue)
     , mJobType(aJobType)
+    , mCanceled(false)
   {}
 
   virtual ~ServiceWorkerJob()
   {}
 
   void
   Done(nsresult aStatus);
 };
@@ -948,23 +957,16 @@ public:
     , mCallback(aCallback)
     , mCanceled(false)
     , mRegistration(aRegistration)
     , mUpdateAndInstallInfo(aServiceWorkerInfo)
   {
     AssertIsOnMainThread();
   }
 
-  void
-  Cancel()
-  {
-    mQueue = nullptr;
-    mCanceled = true;
-  }
-
 protected:
   RefPtr<ServiceWorkerUpdateFinishCallback> mCallback;
   bool mCanceled;
   RefPtr<ServiceWorkerRegistrationInfo> mRegistration;
   RefPtr<ServiceWorkerInfo> mUpdateAndInstallInfo;
 
   ~ServiceWorkerJobBase()
   { }