Bug 1295570 - Entries API - part 3 - Rename FileEntry to FileSystemFileEntry, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 18 Aug 2016 09:17:48 +0200
changeset 310077 a5f5a110ff9eb8cb86419e4bf3e453873fca96d0
parent 310076 ad743a3522d4d0aa48198946c201a68e03f8df5b
child 310078 e3deb006faab39474833bc3e08540e3f3b123c19
push id30576
push userryanvm@gmail.com
push dateFri, 19 Aug 2016 13:53:39 +0000
treeherdermozilla-central@74f332c38a69 [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 3 - Rename FileEntry to FileSystemFileEntry, r=smaug
dom/events/DataTransferItem.cpp
dom/filesystem/compat/CallbackRunnables.cpp
dom/filesystem/compat/DirectoryReader.cpp
dom/filesystem/compat/FileEntry.cpp
dom/filesystem/compat/FileEntry.h
dom/filesystem/compat/FileSystemEntry.cpp
dom/filesystem/compat/FileSystemFileEntry.cpp
dom/filesystem/compat/FileSystemFileEntry.h
dom/filesystem/compat/moz.build
dom/webidl/FileSystem.webidl
--- a/dom/events/DataTransferItem.cpp
+++ b/dom/events/DataTransferItem.cpp
@@ -7,18 +7,18 @@
 #include "DataTransferItemList.h"
 
 #include "mozilla/ContentEvents.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/dom/DataTransferItemBinding.h"
 #include "mozilla/dom/Directory.h"
 #include "mozilla/dom/DirectoryEntry.h"
 #include "mozilla/dom/Event.h"
-#include "mozilla/dom/FileEntry.h"
 #include "mozilla/dom/FileSystem.h"
+#include "mozilla/dom/FileSystemFileEntry.h"
 #include "nsIClipboard.h"
 #include "nsISupportsPrimitives.h"
 #include "nsNetUtil.h"
 #include "nsQueryObject.h"
 #include "nsContentUtils.h"
 #include "nsVariant.h"
 
 namespace {
@@ -326,17 +326,17 @@ DataTransferItem::GetAsEntry(ErrorResult
                                         true, getter_AddRefs(directoryFile));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return nullptr;
     }
 
     RefPtr<Directory> directory = Directory::Create(global, directoryFile);
     entry = new DirectoryEntry(global, directory, fs);
   } else {
-    entry = new FileEntry(global, file, fs);
+    entry = new FileSystemFileEntry(global, file, fs);
   }
 
   Sequence<RefPtr<FileSystemEntry>> entries;
   if (!entries.AppendElement(entry, fallible)) {
     return nullptr;
   }
 
   fs->CreateRoot(entries);
--- a/dom/filesystem/compat/CallbackRunnables.cpp
+++ b/dom/filesystem/compat/CallbackRunnables.cpp
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "CallbackRunnables.h"
 #include "mozilla/dom/DirectoryBinding.h"
 #include "mozilla/dom/DOMError.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/FileBinding.h"
-#include "mozilla/dom/FileEntry.h"
+#include "mozilla/dom/FileSystemFileEntry.h"
 #include "mozilla/dom/Promise.h"
 #include "nsIGlobalObject.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 
 EntryCallbackRunnable::EntryCallbackRunnable(EntryCallback* aCallback,
@@ -102,17 +102,18 @@ GetEntryHelper::ResolvedCallback(JSConte
 
   if (mType == DirectoryEntry::eGetFile) {
     RefPtr<File> file;
     if (NS_FAILED(UNWRAP_OBJECT(File, obj, file))) {
       Error(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
       return;
     }
 
-    RefPtr<FileEntry> entry = new FileEntry(mGlobal, file, mFileSystem);
+    RefPtr<FileSystemFileEntry> entry =
+      new FileSystemFileEntry(mGlobal, file, mFileSystem);
     mSuccessCallback->HandleEvent(*entry);
     return;
   }
 
   MOZ_ASSERT(mType == DirectoryEntry::eGetDirectory);
 
   RefPtr<Directory> directory;
   if (NS_FAILED(UNWRAP_OBJECT(Directory, obj, directory))) {
--- a/dom/filesystem/compat/DirectoryReader.cpp
+++ b/dom/filesystem/compat/DirectoryReader.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DirectoryReader.h"
 #include "CallbackRunnables.h"
-#include "FileEntry.h"
+#include "FileSystemFileEntry.h"
 #include "mozilla/dom/FileBinding.h"
 #include "mozilla/dom/Directory.h"
 #include "mozilla/dom/DirectoryBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "nsIGlobalObject.h"
 
 namespace mozilla {
@@ -66,17 +66,18 @@ public:
       if(NS_WARN_IF(!value.isObject())) {
         return;
       }
 
       JS::Rooted<JSObject*> valueObj(aCx, &value.toObject());
 
       RefPtr<File> file;
       if (NS_SUCCEEDED(UNWRAP_OBJECT(File, valueObj, file))) {
-        RefPtr<FileEntry> entry = new FileEntry(mGlobal, file, mFileSystem);
+        RefPtr<FileSystemFileEntry> entry =
+          new FileSystemFileEntry(mGlobal, file, mFileSystem);
         sequence[i] = entry;
         continue;
       }
 
       RefPtr<Directory> directory;
       if (NS_WARN_IF(NS_FAILED(UNWRAP_OBJECT(Directory, valueObj,
                                              directory)))) {
         return;
--- a/dom/filesystem/compat/FileSystemEntry.cpp
+++ b/dom/filesystem/compat/FileSystemEntry.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FileSystemEntry.h"
 #include "DirectoryEntry.h"
-#include "FileEntry.h"
+#include "FileSystemFileEntry.h"
 #include "mozilla/dom/UnionTypes.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileSystemEntry, mParent, mFileSystem)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(FileSystemEntry)
@@ -27,19 +27,19 @@ FileSystemEntry::Create(nsIGlobalObject*
                         const OwningFileOrDirectory& aFileOrDirectory,
                         FileSystem* aFileSystem)
 {
   MOZ_ASSERT(aGlobalObject);
   MOZ_ASSERT(aFileSystem);
 
   RefPtr<FileSystemEntry> entry;
   if (aFileOrDirectory.IsFile()) {
-    entry = new FileEntry(aGlobalObject,
-                          aFileOrDirectory.GetAsFile(),
-                          aFileSystem);
+    entry = new FileSystemFileEntry(aGlobalObject,
+                                    aFileOrDirectory.GetAsFile(),
+                                    aFileSystem);
   } else {
     MOZ_ASSERT(aFileOrDirectory.IsDirectory());
     entry = new DirectoryEntry(aGlobalObject,
                                aFileOrDirectory.GetAsDirectory(),
                                aFileSystem);
   }
 
   return entry.forget();
rename from dom/filesystem/compat/FileEntry.cpp
rename to dom/filesystem/compat/FileSystemFileEntry.cpp
--- a/dom/filesystem/compat/FileEntry.cpp
+++ b/dom/filesystem/compat/FileSystemFileEntry.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "FileEntry.h"
+#include "FileSystemFileEntry.h"
 #include "CallbackRunnables.h"
 #include "mozilla/dom/File.h"
 
 namespace mozilla {
 namespace dom {
 
 namespace {
 
@@ -33,76 +33,77 @@ public:
 
 private:
   RefPtr<BlobCallback> mCallback;
   RefPtr<File> mFile;
 };
 
 } // anonymous namespace
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED(FileEntry, FileSystemEntry, mFile)
+NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemFileEntry, FileSystemEntry, mFile)
 
-NS_IMPL_ADDREF_INHERITED(FileEntry, FileSystemEntry)
-NS_IMPL_RELEASE_INHERITED(FileEntry, FileSystemEntry)
+NS_IMPL_ADDREF_INHERITED(FileSystemFileEntry, FileSystemEntry)
+NS_IMPL_RELEASE_INHERITED(FileSystemFileEntry, FileSystemEntry)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileEntry)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileSystemFileEntry)
 NS_INTERFACE_MAP_END_INHERITING(FileSystemEntry)
 
-FileEntry::FileEntry(nsIGlobalObject* aGlobal,
-                     File* aFile,
-                     FileSystem* aFileSystem)
+FileSystemFileEntry::FileSystemFileEntry(nsIGlobalObject* aGlobal,
+                                         File* aFile,
+                                         FileSystem* aFileSystem)
   : FileSystemEntry(aGlobal, aFileSystem)
   , mFile(aFile)
 {
   MOZ_ASSERT(aGlobal);
   MOZ_ASSERT(mFile);
 }
 
-FileEntry::~FileEntry()
+FileSystemFileEntry::~FileSystemFileEntry()
 {}
 
 JSObject*
-FileEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+FileSystemFileEntry::WrapObject(JSContext* aCx,
+                                JS::Handle<JSObject*> aGivenProto)
 {
-  return FileEntryBinding::Wrap(aCx, this, aGivenProto);
+  return FileSystemFileEntryBinding::Wrap(aCx, this, aGivenProto);
 }
 
 void
-FileEntry::GetName(nsAString& aName, ErrorResult& aRv) const
+FileSystemFileEntry::GetName(nsAString& aName, ErrorResult& aRv) const
 {
   mFile->GetName(aName);
 }
 
 void
-FileEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
+FileSystemFileEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
 {
   mFile->GetPath(aPath);
   if (aPath.IsEmpty()) {
     // We're under the root directory. webkitRelativePath
     // (implemented as GetPath) is for cases when file is selected because its
     // ancestor directory is selected. But that is not the case here, so need to
     // manually prepend '/'.
     nsAutoString name;
     mFile->GetName(name);
     aPath.AssignLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
     aPath.Append(name);
   }
 }
 
 void
-FileEntry::CreateWriter(VoidCallback& aSuccessCallback,
-                        const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
+FileSystemFileEntry::CreateWriter(VoidCallback& aSuccessCallback,
+                                  const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
 {
   ErrorCallbackHelper::Call(GetParentObject(), aErrorCallback,
                             NS_ERROR_DOM_SECURITY_ERR);
 }
 
 void
-FileEntry::GetFile(BlobCallback& aSuccessCallback,
-                   const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
+FileSystemFileEntry::GetFile(BlobCallback& aSuccessCallback,
+                             const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
 {
   RefPtr<BlobCallbackRunnable> runnable =
     new BlobCallbackRunnable(&aSuccessCallback, mFile);
   nsresult rv = NS_DispatchToMainThread(runnable);
   NS_WARN_IF(NS_FAILED(rv));
 }
 
 } // dom namespace
rename from dom/filesystem/compat/FileEntry.h
rename to dom/filesystem/compat/FileSystemFileEntry.h
--- a/dom/filesystem/compat/FileEntry.h
+++ b/dom/filesystem/compat/FileSystemFileEntry.h
@@ -1,32 +1,32 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_dom_FileEntry_h
-#define mozilla_dom_FileEntry_h
+#ifndef mozilla_dom_FileSystemFileEntry_h
+#define mozilla_dom_FileSystemFileEntry_h
 
 #include "mozilla/dom/FileSystemEntry.h"
 
 namespace mozilla {
 namespace dom {
 
 class File;
 
-class FileEntry final : public FileSystemEntry
+class FileSystemFileEntry final : public FileSystemEntry
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileEntry, FileSystemEntry)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemFileEntry, FileSystemEntry)
 
-  FileEntry(nsIGlobalObject* aGlobalObject, File* aFile,
-            FileSystem* aFileSystem);
+  FileSystemFileEntry(nsIGlobalObject* aGlobalObject, File* aFile,
+                      FileSystem* aFileSystem);
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   virtual bool
   IsFile() const override
   {
     return true;
@@ -42,17 +42,17 @@ public:
   CreateWriter(VoidCallback& aSuccessCallback,
                const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
 
   void
   GetFile(BlobCallback& aSuccessCallback,
           const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
 
 private:
-  ~FileEntry();
+  ~FileSystemFileEntry();
 
   RefPtr<File> mFile;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_FileEntry_h
+#endif // mozilla_dom_FileSystemFileEntry_h
--- a/dom/filesystem/compat/moz.build
+++ b/dom/filesystem/compat/moz.build
@@ -4,27 +4,27 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 TEST_DIRS += ['tests']
 
 EXPORTS.mozilla.dom += [
     'DirectoryEntry.h',
     'DirectoryReader.h',
-    'FileEntry.h',
     'FileSystem.h',
     'FileSystemEntry.h',
+    'FileSystemFileEntry.h',
 ]
 
 UNIFIED_SOURCES += [
     'CallbackRunnables.cpp',
     'DirectoryEntry.cpp',
     'DirectoryReader.cpp',
-    'FileEntry.cpp',
     'FileSystem.cpp',
     'FileSystemEntry.cpp',
+    'FileSystemFileEntry.cpp',
     'RootDirectoryEntry.cpp',
     'RootDirectoryReader.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/dom/webidl/FileSystem.webidl
+++ b/dom/webidl/FileSystem.webidl
@@ -71,17 +71,17 @@ interface DirectoryReader {
     void readEntries (EntriesCallback successCallback, optional ErrorCallback errorCallback);
 };
 
 callback interface BlobCallback {
     void handleEvent(Blob? blob);
 };
 
 [NoInterfaceObject]
-interface FileEntry : FileSystemEntry {
+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);
 
     [BinaryName="GetFile"]
     void file (BlobCallback successCallback, optional ErrorCallback errorCallback);
 };