Bug 1295570 - Entries API - part 6 - Rename Entries Callbacks, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 18 Aug 2016 09:19:15 +0200
changeset 309932 b0e250259a5a6b1d65b03a4ef49889377aabe4ec
parent 309931 4a589e795dcf0942de5cef5361ec41c8b9d73a5a
child 309933 af544cf7fa1ce04a88d3084d8d40ff61f4fc961f
push id80713
push useramarchesini@mozilla.com
push dateThu, 18 Aug 2016 07:21:50 +0000
treeherdermozilla-inbound@ae927fbd31e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1295570
milestone51.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 1295570 - Entries API - part 6 - Rename Entries Callbacks, r=smaug
dom/filesystem/compat/CallbackRunnables.cpp
dom/filesystem/compat/CallbackRunnables.h
dom/filesystem/compat/FileSystemDirectoryEntry.cpp
dom/filesystem/compat/FileSystemDirectoryEntry.h
dom/filesystem/compat/FileSystemDirectoryReader.cpp
dom/filesystem/compat/FileSystemDirectoryReader.h
dom/filesystem/compat/FileSystemRootDirectoryEntry.cpp
dom/filesystem/compat/FileSystemRootDirectoryEntry.h
dom/filesystem/compat/FileSystemRootDirectoryReader.cpp
dom/filesystem/compat/FileSystemRootDirectoryReader.h
dom/webidl/FileSystem.webidl
--- a/dom/filesystem/compat/CallbackRunnables.cpp
+++ b/dom/filesystem/compat/CallbackRunnables.cpp
@@ -12,17 +12,17 @@
 #include "mozilla/dom/FileSystemFileEntry.h"
 #include "mozilla/dom/Promise.h"
 #include "nsIGlobalObject.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 
-EntryCallbackRunnable::EntryCallbackRunnable(EntryCallback* aCallback,
+EntryCallbackRunnable::EntryCallbackRunnable(FileSystemEntryCallback* aCallback,
                                              FileSystemEntry* aEntry)
   : mCallback(aCallback)
   , mEntry(aEntry)
 {
   MOZ_ASSERT(aCallback);
   MOZ_ASSERT(aEntry);
 }
 
@@ -53,33 +53,33 @@ ErrorCallbackRunnable::Run()
     return NS_ERROR_FAILURE;
   }
 
   RefPtr<DOMError> error = new DOMError(window, mError);
   mCallback->HandleEvent(*error);
   return NS_OK;
 }
 
-EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(EntriesCallback* aCallback)
+EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(FileSystemEntriesCallback* aCallback)
   : mCallback(aCallback)
 {
   MOZ_ASSERT(aCallback);
 }
 
 NS_IMETHODIMP
 EmptyEntriesCallbackRunnable::Run()
 {
   Sequence<OwningNonNull<FileSystemEntry>> sequence;
   mCallback->HandleEvent(sequence);
   return NS_OK;
 }
 
 GetEntryHelper::GetEntryHelper(nsIGlobalObject* aGlobalObject,
                                FileSystem* aFileSystem,
-                               EntryCallback* aSuccessCallback,
+                               FileSystemEntryCallback* aSuccessCallback,
                                ErrorCallback* aErrorCallback,
                                FileSystemDirectoryEntry::GetInternalType aType)
   : mGlobal(aGlobalObject)
   , mFileSystem(aFileSystem)
   , mSuccessCallback(aSuccessCallback)
   , mErrorCallback(aErrorCallback)
   , mType(aType)
 {
--- a/dom/filesystem/compat/CallbackRunnables.h
+++ b/dom/filesystem/compat/CallbackRunnables.h
@@ -14,24 +14,24 @@
 class nsIGlobalObject;
 
 namespace mozilla {
 namespace dom {
 
 class EntryCallbackRunnable final : public Runnable
 {
 public:
-  EntryCallbackRunnable(EntryCallback* aCallback,
+  EntryCallbackRunnable(FileSystemEntryCallback* aCallback,
                         FileSystemEntry* aEntry);
 
   NS_IMETHOD
   Run() override;
 
 private:
-  RefPtr<EntryCallback> mCallback;
+  RefPtr<FileSystemEntryCallback> mCallback;
   RefPtr<FileSystemEntry> mEntry;
 };
 
 class ErrorCallbackRunnable final : public Runnable
 {
 public:
   ErrorCallbackRunnable(nsIGlobalObject* aGlobalObject,
                         ErrorCallback* aCallback,
@@ -44,33 +44,33 @@ private:
   nsCOMPtr<nsIGlobalObject> mGlobal;
   RefPtr<ErrorCallback> mCallback;
   nsresult mError;
 };
 
 class EmptyEntriesCallbackRunnable final : public Runnable
 {
 public:
-  explicit EmptyEntriesCallbackRunnable(EntriesCallback* aCallback);
+  explicit EmptyEntriesCallbackRunnable(FileSystemEntriesCallback* aCallback);
 
   NS_IMETHOD
   Run() override;
 
 private:
-  RefPtr<EntriesCallback> mCallback;
+  RefPtr<FileSystemEntriesCallback> mCallback;
 };
 
 class GetEntryHelper final : public PromiseNativeHandler
 {
 public:
   NS_DECL_ISUPPORTS
 
   GetEntryHelper(nsIGlobalObject* aGlobalObject,
                  FileSystem* aFileSystem,
-                 EntryCallback* aSuccessCallback,
+                 FileSystemEntryCallback* aSuccessCallback,
                  ErrorCallback* aErrorCallback,
                  FileSystemDirectoryEntry::GetInternalType aType);
 
   virtual void
   ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
 
   virtual void
   RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
@@ -78,17 +78,17 @@ public:
 private:
   ~GetEntryHelper();
 
   void
   Error(nsresult aError);
 
   nsCOMPtr<nsIGlobalObject> mGlobal;
   RefPtr<FileSystem> mFileSystem;
-  RefPtr<EntryCallback> mSuccessCallback;
+  RefPtr<FileSystemEntryCallback> mSuccessCallback;
   RefPtr<ErrorCallback> mErrorCallback;
   FileSystemDirectoryEntry::GetInternalType mType;
 };
 
 class ErrorCallbackHelper
 {
 public:
   static void
--- a/dom/filesystem/compat/FileSystemDirectoryEntry.cpp
+++ b/dom/filesystem/compat/FileSystemDirectoryEntry.cpp
@@ -63,17 +63,17 @@ FileSystemDirectoryEntry::CreateReader()
   RefPtr<FileSystemDirectoryReader> reader =
     new FileSystemDirectoryReader(GetParentObject(), Filesystem(), mDirectory);
   return reader.forget();
 }
 
 void
 FileSystemDirectoryEntry::GetInternal(const nsAString& aPath,
                                       const FileSystemFlags& aFlag,
-                                      const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
+                                      const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
                                       const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
                                       GetInternalType aType) const
 {
   MOZ_ASSERT(mDirectory);
 
   if (!aSuccessCallback.WasPassed() && !aErrorCallback.WasPassed()) {
     return;
   }
--- a/dom/filesystem/compat/FileSystemDirectoryEntry.h
+++ b/dom/filesystem/compat/FileSystemDirectoryEntry.h
@@ -41,39 +41,39 @@ public:
   virtual void
   GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const override;
 
   virtual already_AddRefed<FileSystemDirectoryReader>
   CreateReader() const;
 
   void
   GetFile(const nsAString& aPath, const FileSystemFlags& aFlag,
-          const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
+          const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
           const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
   {
     GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetFile);
   }
 
   void
   GetDirectory(const nsAString& aPath, const FileSystemFlags& aFlag,
-               const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
+               const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
                const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
   {
     GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetDirectory);
   }
 
   void
   RemoveRecursively(VoidCallback& aSuccessCallback,
                     const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
 
   enum GetInternalType { eGetFile, eGetDirectory };
 
   virtual void
   GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
-              const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
+              const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
               const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
               GetInternalType aType) const;
 
 protected:
   virtual ~FileSystemDirectoryEntry();
 
 private:
   RefPtr<Directory> mDirectory;
--- a/dom/filesystem/compat/FileSystemDirectoryReader.cpp
+++ b/dom/filesystem/compat/FileSystemDirectoryReader.cpp
@@ -21,17 +21,17 @@ namespace {
 
 class PromiseHandler final : public PromiseNativeHandler
 {
 public:
   NS_DECL_ISUPPORTS
 
   PromiseHandler(nsIGlobalObject* aGlobalObject,
                  FileSystem* aFileSystem,
-                 EntriesCallback* aSuccessCallback,
+                 FileSystemEntriesCallback* aSuccessCallback,
                  ErrorCallback* aErrorCallback)
     : mGlobal(aGlobalObject)
     , mFileSystem(aFileSystem)
     , mSuccessCallback(aSuccessCallback)
     , mErrorCallback(aErrorCallback)
   {
     MOZ_ASSERT(aGlobalObject);
     MOZ_ASSERT(aFileSystem);
@@ -103,17 +103,17 @@ public:
     }
   }
 
 private:
   ~PromiseHandler() {}
 
   nsCOMPtr<nsIGlobalObject> mGlobal;
   RefPtr<FileSystem> mFileSystem;
-  RefPtr<EntriesCallback> mSuccessCallback;
+  RefPtr<FileSystemEntriesCallback> mSuccessCallback;
   RefPtr<ErrorCallback> mErrorCallback;
 };
 
 NS_IMPL_ISUPPORTS0(PromiseHandler);
 
 } // anonymous namespace
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileSystemDirectoryReader, mParent,
@@ -145,17 +145,17 @@ FileSystemDirectoryReader::~FileSystemDi
 JSObject*
 FileSystemDirectoryReader::WrapObject(JSContext* aCx,
                                       JS::Handle<JSObject*> aGivenProto)
 {
   return FileSystemDirectoryReaderBinding::Wrap(aCx, this, aGivenProto);
 }
 
 void
-FileSystemDirectoryReader::ReadEntries(EntriesCallback& aSuccessCallback,
+FileSystemDirectoryReader::ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
                                        const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
                                        ErrorResult& aRv)
 {
   MOZ_ASSERT(mDirectory);
 
   if (mAlreadyRead) {
     RefPtr<EmptyEntriesCallbackRunnable> runnable =
       new EmptyEntriesCallbackRunnable(&aSuccessCallback);
--- a/dom/filesystem/compat/FileSystemDirectoryReader.h
+++ b/dom/filesystem/compat/FileSystemDirectoryReader.h
@@ -38,17 +38,17 @@ public:
   {
     return mParent;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   virtual void
-  ReadEntries(EntriesCallback& aSuccessCallback,
+  ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
               const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
               ErrorResult& aRv);
 
 protected:
   virtual ~FileSystemDirectoryReader();
 
 private:
   nsCOMPtr<nsIGlobalObject> mParent;
--- a/dom/filesystem/compat/FileSystemRootDirectoryEntry.cpp
+++ b/dom/filesystem/compat/FileSystemRootDirectoryEntry.cpp
@@ -51,17 +51,17 @@ FileSystemRootDirectoryEntry::CreateRead
     new FileSystemRootDirectoryReader(GetParentObject(), Filesystem(),
                                       mEntries);
   return reader.forget();
 }
 
 void
 FileSystemRootDirectoryEntry::GetInternal(const nsAString& aPath,
                                           const FileSystemFlags& aFlag,
-                                          const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
+                                          const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
                                           const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
                                           GetInternalType aType) const
 {
   if (!aSuccessCallback.WasPassed() && !aErrorCallback.WasPassed()) {
     return;
   }
 
   if (aFlag.mCreate) {
--- a/dom/filesystem/compat/FileSystemRootDirectoryEntry.h
+++ b/dom/filesystem/compat/FileSystemRootDirectoryEntry.h
@@ -31,17 +31,17 @@ public:
   virtual already_AddRefed<FileSystemDirectoryReader>
   CreateReader() const override;
 
 private:
   ~FileSystemRootDirectoryEntry();
 
   virtual void
   GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
-              const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
+              const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
               const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
               GetInternalType aType) const override;
 
   void
   Error(const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
         nsresult aError) const;
 
   Sequence<RefPtr<FileSystemEntry>> mEntries;
--- a/dom/filesystem/compat/FileSystemRootDirectoryReader.cpp
+++ b/dom/filesystem/compat/FileSystemRootDirectoryReader.cpp
@@ -11,17 +11,17 @@
 namespace mozilla {
 namespace dom {
 
 namespace {
 
 class EntriesCallbackRunnable final : public Runnable
 {
 public:
-  EntriesCallbackRunnable(EntriesCallback* aCallback,
+  EntriesCallbackRunnable(FileSystemEntriesCallback* aCallback,
                           const Sequence<RefPtr<FileSystemEntry>>& aEntries)
     : mCallback(aCallback)
     , mEntries(aEntries)
   {
     MOZ_ASSERT(aCallback);
   }
 
   NS_IMETHOD
@@ -34,17 +34,17 @@ public:
       }
     }
 
     mCallback->HandleEvent(entries);
     return NS_OK;
   }
 
 private:
-  RefPtr<EntriesCallback> mCallback;
+  RefPtr<FileSystemEntriesCallback> mCallback;
   Sequence<RefPtr<FileSystemEntry>> mEntries;
 };
 
 } // anonymous namespace
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemRootDirectoryReader,
                                    FileSystemDirectoryReader, mEntries)
 
@@ -66,17 +66,17 @@ FileSystemRootDirectoryReader::FileSyste
   MOZ_ASSERT(aGlobal);
   MOZ_ASSERT(aFileSystem);
 }
 
 FileSystemRootDirectoryReader::~FileSystemRootDirectoryReader()
 {}
 
 void
-FileSystemRootDirectoryReader::ReadEntries(EntriesCallback& aSuccessCallback,
+FileSystemRootDirectoryReader::ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
                                            const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
                                            ErrorResult& aRv)
 {
   if (mAlreadyRead) {
     RefPtr<EmptyEntriesCallbackRunnable> runnable =
       new EmptyEntriesCallbackRunnable(&aSuccessCallback);
     aRv = NS_DispatchToMainThread(runnable);
     NS_WARN_IF(aRv.Failed());
--- a/dom/filesystem/compat/FileSystemRootDirectoryReader.h
+++ b/dom/filesystem/compat/FileSystemRootDirectoryReader.h
@@ -19,17 +19,17 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemRootDirectoryReader,
                                            FileSystemDirectoryReader)
 
   explicit FileSystemRootDirectoryReader(nsIGlobalObject* aGlobalObject,
                                                    FileSystem* aFileSystem,
                                                    const Sequence<RefPtr<FileSystemEntry>>& aEntries);
 
   virtual void
-  ReadEntries(EntriesCallback& aSuccessCallback,
+  ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
               const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
               ErrorResult& aRv) override;
 
 private:
   ~FileSystemRootDirectoryReader();
 
   Sequence<RefPtr<FileSystemEntry>> mEntries;
   bool mAlreadyRead;
--- a/dom/webidl/FileSystem.webidl
+++ b/dom/webidl/FileSystem.webidl
@@ -13,81 +13,98 @@ interface FileSystemEntry {
     readonly attribute DOMString name;
 
     [GetterThrows]
     readonly attribute DOMString fullPath;
 
     readonly attribute FileSystem filesystem;
 
 /** Not implemented:
- *  void getMetadata(MetadataCallback successCallback, optional ErrorCallback errorCallback);
- *  void moveTo(FileSystemDirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
- *  void copyTo(FileSystemDirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
+ *  void getMetadata(MetadataCallback successCallback,
+ *                   optional ErrorCallback errorCallback);
+ *  void moveTo(FileSystemDirectoryEntry parent, optional DOMString? name,
+ *              optional FileSystemEntryCallback successCallback,
+ *              optional ErrorCallback errorCallback);
+ *  void copyTo(FileSystemDirectoryEntry parent, optional DOMString? name,
+ *              optional FileSystemEntryCallback successCallback,
+ *              optional ErrorCallback errorCallback);
  *  DOMString toURL();
- *  void remove(VoidCallback successCallback, optional ErrorCallback errorCallback);
- *  void getParent(optional EntryCallback successCallback, optional ErrorCallback errorCallback);
+ *  void remove(VoidCallback successCallback,
+ *              optional ErrorCallback errorCallback);
+ *  void getParent(optional FileSystemEntryCallback successCallback,
+ *                 optional ErrorCallback errorCallback);
  */
 };
 
 dictionary FileSystemFlags {
     boolean create = false;
     boolean exclusive = false;
 };
 
-callback interface EntryCallback {
+callback interface FileSystemEntryCallback {
     void handleEvent(FileSystemEntry entry);
 };
 
 callback interface VoidCallback {
     void handleEvent();
 };
 
 [NoInterfaceObject]
 interface FileSystemDirectoryEntry : FileSystemEntry {
     FileSystemDirectoryReader createReader();
 
-    void getFile(DOMString? path, optional FileSystemFlags options, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
-
-    void getDirectory(DOMString? path, optional FileSystemFlags options, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
+    void getFile(DOMString? path,
+                 optional FileSystemFlags options,
+                 optional FileSystemEntryCallback successCallback,
+                 optional ErrorCallback errorCallback);
 
-    // This method is not implemented. ErrorCallback will be called with
-    // NS_ERROR_DOM_NOT_SUPPORTED_ERR.
-    void removeRecursively(VoidCallback successCallback, optional ErrorCallback errorCallback);
+    void getDirectory(DOMString? path,
+                      optional FileSystemFlags options,
+                      optional FileSystemEntryCallback successCallback,
+                      optional ErrorCallback errorCallback);
+
+    // This method is not implemented. ErrorCallback will be called
+    // with NS_ERROR_DOM_NOT_SUPPORTED_ERR.
+    void removeRecursively(VoidCallback successCallback,
+                           optional ErrorCallback errorCallback);
 };
 
-callback interface EntriesCallback {
+callback interface FileSystemEntriesCallback {
     void handleEvent(sequence<FileSystemEntry> entries);
 };
 
 callback interface ErrorCallback {
     // This should be FileError but we are implementing just a subset of this API.
     void handleEvent(DOMError error);
 };
 
 [NoInterfaceObject]
 interface FileSystemDirectoryReader {
 
     // readEntries can be called just once. The second time it returns no data.
 
     [Throws]
-    void readEntries (EntriesCallback successCallback, optional ErrorCallback errorCallback);
+    void readEntries(FileSystemEntriesCallback successCallback,
+                     optional ErrorCallback errorCallback);
 };
 
 callback interface BlobCallback {
     void handleEvent(Blob? blob);
 };
 
 [NoInterfaceObject]
 interface FileSystemFileEntry : FileSystemEntry {
     // the successCallback should be a FileWriteCallback but this method is not
     // implemented. ErrorCallback will be called with
     // NS_ERROR_DOM_NOT_SUPPORTED_ERR.
-    void createWriter (VoidCallback successCallback, optional ErrorCallback errorCallback);
+    void createWriter (VoidCallback successCallback,
+                       optional ErrorCallback errorCallback);
 
     [BinaryName="GetFile"]
-    void file (BlobCallback successCallback, optional ErrorCallback errorCallback);
+    void file (BlobCallback successCallback,
+               optional ErrorCallback errorCallback);
 };
 
 [NoInterfaceObject]
 interface FileSystem {
     readonly    attribute DOMString name;
     readonly    attribute FileSystemDirectoryEntry root;
 };