Bug 1224596 part 10. Switch DataStoreCursor to using the new WorkerMainThreadRunnable::Dispatch signature. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 24 Nov 2015 00:04:21 -0500
changeset 273876 123a397f5b7bbe0979ee2dc3146f4e12e46690d9
parent 273875 fe15418497fc4f30f256bd6c6585de259fdea2a7
child 273877 a9f7956706f47f9d03bee0f1288919a1d3d3d281
push id68416
push userbzbarsky@mozilla.com
push dateTue, 24 Nov 2015 05:04:42 +0000
treeherdermozilla-inbound@227989411ad6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1224596
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 1224596 part 10. Switch DataStoreCursor to using the new WorkerMainThreadRunnable::Dispatch signature. r=khuey
dom/workers/DataStoreCursor.cpp
--- a/dom/workers/DataStoreCursor.cpp
+++ b/dom/workers/DataStoreCursor.cpp
@@ -84,26 +84,25 @@ public:
   {
     MOZ_ASSERT(aWorkerPrivate);
     aWorkerPrivate->AssertIsOnWorkerThread();
 
     mPromiseWorkerProxy =
       PromiseWorkerProxy::Create(aWorkerPrivate, aWorkerPromise);
   }
 
-  bool Dispatch(JSContext* aCx)
+  void Dispatch(ErrorResult& aRv)
   {
     if (mPromiseWorkerProxy) {
-      return DataStoreCursorRunnable::Dispatch(aCx);
+      DataStoreCursorRunnable::Dispatch(aRv);
     }
 
     // If the creation of mProxyWorkerProxy failed, the worker is terminating.
     // In this case we don't want to dispatch the runnable and we should stop
     // the promise chain here.
-    return true;
   }
 
 protected:
   virtual bool
   MainThreadRun() override
   {
     AssertIsOnMainThread();
 
@@ -168,31 +167,34 @@ WorkerDataStoreCursor::Next(JSContext* a
     return nullptr;
   }
 
   RefPtr<DataStoreCursorNextRunnable> runnable =
     new DataStoreCursorNextRunnable(workerPrivate,
                                     mBackingCursor,
                                     promise,
                                     aRv);
-  runnable->Dispatch(aCx);
+  runnable->Dispatch(aRv);
+  if (aRv.Failed()) {
+    return nullptr;
+  }
 
   return promise.forget();
 }
 
 void
 WorkerDataStoreCursor::Close(JSContext* aCx, ErrorResult& aRv)
 {
   WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
   MOZ_ASSERT(workerPrivate);
   workerPrivate->AssertIsOnWorkerThread();
 
   RefPtr<DataStoreCursorCloseRunnable> runnable =
     new DataStoreCursorCloseRunnable(workerPrivate, mBackingCursor, aRv);
-  runnable->Dispatch(aCx);
+  runnable->Dispatch(aRv);
 }
 
 void
 WorkerDataStoreCursor::SetBackingDataStoreCursor(
   const nsMainThreadPtrHandle<DataStoreCursor>& aBackingCursor)
 {
   mBackingCursor = aBackingCursor;
 }