Bug 1403981 - Clean up the return value of MutableBlobStorage::GetBlobWhenReady, r=qdot
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 29 Sep 2017 09:19:13 +0200
changeset 383787 3bf89af7b969d7b909abce0ef8df171a595e99b8
parent 383786 710b592482eea53c22ea092f5ec038524a539e9f
child 383788 c5e45bf14e9ab27b9cedac2b47d96bdb3725f3ca
push id32602
push userkwierso@gmail.com
push dateFri, 29 Sep 2017 21:47:40 +0000
treeherdermozilla-central@57f68296c350 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1403981
milestone58.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 1403981 - Clean up the return value of MutableBlobStorage::GetBlobWhenReady, r=qdot
dom/file/MutableBlobStorage.cpp
dom/file/MutableBlobStorage.h
--- a/dom/file/MutableBlobStorage.cpp
+++ b/dom/file/MutableBlobStorage.cpp
@@ -408,17 +408,17 @@ MutableBlobStorage::~MutableBlobStorage(
     DispatchToIOThread(runnable.forget());
   }
 
   if (mTaskQueue) {
     mTaskQueue->BeginShutdown();
   }
 }
 
-uint64_t
+void
 MutableBlobStorage::GetBlobWhenReady(nsISupports* aParent,
                                      const nsACString& aContentType,
                                      MutableBlobStorageCallback* aCallback)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aCallback);
 
   // GetBlob can be called just once.
@@ -428,34 +428,34 @@ MutableBlobStorage::GetBlobWhenReady(nsI
 
   if (previousState == eInTemporaryFile) {
     MOZ_ASSERT(mFD);
 
     if (NS_FAILED(mErrorResult)) {
       RefPtr<Runnable> runnable =
         new BlobCreationDoneRunnable(this, aCallback, nullptr, mErrorResult);
       EventTarget()->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL);
-      return 0;
+      return;
     }
 
     // We want to wait until all the WriteRunnable are completed. The way we do
     // this is to go to the I/O thread and then we come back: the runnables are
     // executed in order and this LastRunnable will be... the last one.
     RefPtr<Runnable> runnable =
       new LastRunnable(this, aParent, aContentType, aCallback);
     DispatchToIOThread(runnable.forget());
-    return mDataLen;
+    return;
   }
 
   // If we are waiting for the temporary file, it's better to wait...
   if (previousState == eWaitingForTemporaryFile) {
     mPendingParent = aParent;
     mPendingContentType = aContentType;
     mPendingCallback = aCallback;
-    return mDataLen;
+    return;
   }
 
   RefPtr<BlobImpl> blobImpl;
 
   if (mData) {
     blobImpl = new MemoryBlobImpl(mData, mDataLen,
                                   NS_ConvertUTF8toUTF16(aContentType));
 
@@ -467,20 +467,18 @@ MutableBlobStorage::GetBlobWhenReady(nsI
   }
 
   RefPtr<Blob> blob = Blob::Create(aParent, blobImpl);
   RefPtr<BlobCreationDoneRunnable> runnable =
     new BlobCreationDoneRunnable(this, aCallback, blob, NS_OK);
 
   nsresult error = EventTarget()->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL);
   if (NS_WARN_IF(NS_FAILED(error))) {
-    return 0;
+    return;
   }
-
-  return mDataLen;
 }
 
 nsresult
 MutableBlobStorage::Append(const void* aData, uint32_t aLength)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mStorageState != eClosed);
   NS_ENSURE_ARG_POINTER(aData);
--- a/dom/file/MutableBlobStorage.h
+++ b/dom/file/MutableBlobStorage.h
@@ -46,20 +46,19 @@ public:
 
   explicit MutableBlobStorage(MutableBlobStorageType aType,
                               nsIEventTarget* aEventTarget = nullptr);
 
   nsresult Append(const void* aData, uint32_t aLength);
 
   // This method can be called just once.
   // The callback will be called when the Blob is ready.
-  // The return value is the total size of the blob, when created.
-  uint64_t GetBlobWhenReady(nsISupports* aParent,
-                            const nsACString& aContentType,
-                            MutableBlobStorageCallback* aCallback);
+  void GetBlobWhenReady(nsISupports* aParent,
+                        const nsACString& aContentType,
+                        MutableBlobStorageCallback* aCallback);
 
   void TemporaryFileCreated(PRFileDesc* aFD);
 
   void  CreateBlobAndRespond(already_AddRefed<nsISupports> aParent,
                              const nsACString& aContentType,
                              already_AddRefed<MutableBlobStorageCallback> aCallback);
 
   void ErrorPropagated(nsresult aRv);