Skip to content

Commit

Permalink
Bug 1295570 - Entries API - part 1 - Rename DOMFileSystem to FileSyst…
Browse files Browse the repository at this point in the history
…em, r=smaug
  • Loading branch information
bakulf committed Aug 18, 2016
1 parent 5f2dfe2 commit b07e623
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 59 deletions.
4 changes: 2 additions & 2 deletions dom/events/DataTransferItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "mozilla/dom/DataTransferItemBinding.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DirectoryEntry.h"
#include "mozilla/dom/DOMFileSystem.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/FileEntry.h"
#include "mozilla/dom/FileSystem.h"
#include "nsIClipboard.h"
#include "nsISupportsPrimitives.h"
#include "nsNetUtil.h"
Expand Down Expand Up @@ -308,7 +308,7 @@ DataTransferItem::GetAsEntry(ErrorResult& aRv)
return nullptr;
}

RefPtr<DOMFileSystem> fs = DOMFileSystem::Create(global);
RefPtr<FileSystem> fs = FileSystem::Create(global);
RefPtr<Entry> entry;
BlobImpl* impl = file->Impl();
MOZ_ASSERT(impl);
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/CallbackRunnables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ EmptyEntriesCallbackRunnable::Run()
}

GetEntryHelper::GetEntryHelper(nsIGlobalObject* aGlobalObject,
DOMFileSystem* aFileSystem,
FileSystem* aFileSystem,
EntryCallback* aSuccessCallback,
ErrorCallback* aErrorCallback,
DirectoryEntry::GetInternalType aType)
Expand Down
4 changes: 2 additions & 2 deletions dom/filesystem/compat/CallbackRunnables.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class GetEntryHelper final : public PromiseNativeHandler
NS_DECL_ISUPPORTS

GetEntryHelper(nsIGlobalObject* aGlobalObject,
DOMFileSystem* aFileSystem,
FileSystem* aFileSystem,
EntryCallback* aSuccessCallback,
ErrorCallback* aErrorCallback,
DirectoryEntry::GetInternalType aType);
Expand All @@ -82,7 +82,7 @@ class GetEntryHelper final : public PromiseNativeHandler
Error(nsresult aError);

nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<DOMFileSystem> mFileSystem;
RefPtr<FileSystem> mFileSystem;
RefPtr<EntryCallback> mSuccessCallback;
RefPtr<ErrorCallback> mErrorCallback;
DirectoryEntry::GetInternalType mType;
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/DirectoryEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ NS_INTERFACE_MAP_END_INHERITING(Entry)

DirectoryEntry::DirectoryEntry(nsIGlobalObject* aGlobal,
Directory* aDirectory,
DOMFileSystem* aFileSystem)
FileSystem* aFileSystem)
: Entry(aGlobal, aFileSystem)
, mDirectory(aDirectory)
{
Expand Down
4 changes: 2 additions & 2 deletions dom/filesystem/compat/DirectoryEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define mozilla_dom_DirectoryEntry_h

#include "mozilla/dom/Entry.h"
#include "mozilla/dom/DOMFileSystemBinding.h"
#include "mozilla/dom/FileSystemBinding.h"

namespace mozilla {
namespace dom {
Expand All @@ -22,7 +22,7 @@ class DirectoryEntry : public Entry
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DirectoryEntry, Entry)

DirectoryEntry(nsIGlobalObject* aGlobalObject, Directory* aDirectory,
DOMFileSystem* aFileSystem);
FileSystem* aFileSystem);

virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
Expand Down
6 changes: 3 additions & 3 deletions dom/filesystem/compat/DirectoryReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PromiseHandler final : public PromiseNativeHandler
NS_DECL_ISUPPORTS

PromiseHandler(nsIGlobalObject* aGlobalObject,
DOMFileSystem* aFileSystem,
FileSystem* aFileSystem,
EntriesCallback* aSuccessCallback,
ErrorCallback* aErrorCallback)
: mGlobal(aGlobalObject)
Expand Down Expand Up @@ -106,7 +106,7 @@ class PromiseHandler final : public PromiseNativeHandler
~PromiseHandler() {}

nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<DOMFileSystem> mFileSystem;
RefPtr<FileSystem> mFileSystem;
RefPtr<EntriesCallback> mSuccessCallback;
RefPtr<ErrorCallback> mErrorCallback;
};
Expand All @@ -127,7 +127,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DirectoryReader)
NS_INTERFACE_MAP_END

DirectoryReader::DirectoryReader(nsIGlobalObject* aGlobal,
DOMFileSystem* aFileSystem,
FileSystem* aFileSystem,
Directory* aDirectory)
: mParent(aGlobal)
, mFileSystem(aFileSystem)
Expand Down
6 changes: 3 additions & 3 deletions dom/filesystem/compat/DirectoryReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace mozilla {
namespace dom {

class Directory;
class DOMFileSystem;
class FileSystem;

class DirectoryReader
: public nsISupports
Expand All @@ -30,7 +30,7 @@ class DirectoryReader
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DirectoryReader)

explicit DirectoryReader(nsIGlobalObject* aGlobalObject,
DOMFileSystem* aFileSystem,
FileSystem* aFileSystem,
Directory* aDirectory);

nsIGlobalObject*
Expand All @@ -52,7 +52,7 @@ class DirectoryReader

private:
nsCOMPtr<nsIGlobalObject> mParent;
RefPtr<DOMFileSystem> mFileSystem;
RefPtr<FileSystem> mFileSystem;
RefPtr<Directory> mDirectory;

bool mAlreadyRead;
Expand Down
4 changes: 2 additions & 2 deletions dom/filesystem/compat/Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ NS_INTERFACE_MAP_END
/* static */ already_AddRefed<Entry>
Entry::Create(nsIGlobalObject* aGlobalObject,
const OwningFileOrDirectory& aFileOrDirectory,
DOMFileSystem* aFileSystem)
FileSystem* aFileSystem)
{
MOZ_ASSERT(aGlobalObject);
MOZ_ASSERT(aFileSystem);
Expand All @@ -45,7 +45,7 @@ Entry::Create(nsIGlobalObject* aGlobalObject,
return entry.forget();
}

Entry::Entry(nsIGlobalObject* aGlobal, DOMFileSystem* aFileSystem)
Entry::Entry(nsIGlobalObject* aGlobal, FileSystem* aFileSystem)
: mParent(aGlobal)
, mFileSystem(aFileSystem)
{
Expand Down
10 changes: 5 additions & 5 deletions dom/filesystem/compat/Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace mozilla {
namespace dom {

class DOMFileSystem;
class FileSystem;
class OwningFileOrDirectory;

class Entry
Expand All @@ -31,7 +31,7 @@ class Entry
static already_AddRefed<Entry>
Create(nsIGlobalObject* aGlobalObject,
const OwningFileOrDirectory& aFileOrDirectory,
DOMFileSystem* aFileSystem);
FileSystem* aFileSystem);

nsIGlobalObject*
GetParentObject() const
Expand Down Expand Up @@ -60,20 +60,20 @@ class Entry
virtual void
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const = 0;

DOMFileSystem*
FileSystem*
Filesystem() const
{
return mFileSystem;
}

protected:
Entry(nsIGlobalObject* aGlobalObject,
DOMFileSystem* aFileSystem);
FileSystem* aFileSystem);
virtual ~Entry();

private:
nsCOMPtr<nsIGlobalObject> mParent;
RefPtr<DOMFileSystem> mFileSystem;
RefPtr<FileSystem> mFileSystem;
};

} // namespace dom
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/FileEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ NS_INTERFACE_MAP_END_INHERITING(Entry)

FileEntry::FileEntry(nsIGlobalObject* aGlobal,
File* aFile,
DOMFileSystem* aFileSystem)
FileSystem* aFileSystem)
: Entry(aGlobal, aFileSystem)
, mFile(aFile)
{
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/FileEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FileEntry final : public Entry
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileEntry, Entry)

FileEntry(nsIGlobalObject* aGlobalObject, File* aFile,
DOMFileSystem* aFileSystem);
FileSystem* aFileSystem);

virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
* 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 "DOMFileSystem.h"
#include "FileSystem.h"
#include "RootDirectoryEntry.h"
#include "mozilla/dom/DOMFileSystemBinding.h"
#include "mozilla/dom/FileSystemBinding.h"
#include "nsContentUtils.h"

namespace mozilla {
namespace dom {

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMFileSystem, mParent, mRoot)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileSystem, mParent, mRoot)

NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMFileSystem)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMFileSystem)
NS_IMPL_CYCLE_COLLECTING_ADDREF(FileSystem)
NS_IMPL_CYCLE_COLLECTING_RELEASE(FileSystem)

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMFileSystem)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileSystem)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END

/* static */ already_AddRefed<DOMFileSystem>
DOMFileSystem::Create(nsIGlobalObject* aGlobalObject)
/* static */ already_AddRefed<FileSystem>
FileSystem::Create(nsIGlobalObject* aGlobalObject)

{
MOZ_ASSERT(aGlobalObject);
Expand All @@ -42,31 +42,30 @@ DOMFileSystem::Create(nsIGlobalObject* aGlobalObject)
// UUID in this format '{' + UUID + '}'. We remove them with these +1 and -2.
nsAutoCString name(Substring(chars + 1, chars + NSID_LENGTH - 2));

RefPtr<DOMFileSystem> fs =
new DOMFileSystem(aGlobalObject, NS_ConvertUTF8toUTF16(name));
RefPtr<FileSystem> fs =
new FileSystem(aGlobalObject, NS_ConvertUTF8toUTF16(name));

return fs.forget();
}

DOMFileSystem::DOMFileSystem(nsIGlobalObject* aGlobal,
const nsAString& aName)
FileSystem::FileSystem(nsIGlobalObject* aGlobal, const nsAString& aName)
: mParent(aGlobal)
, mName(aName)
{
MOZ_ASSERT(aGlobal);
}

DOMFileSystem::~DOMFileSystem()
FileSystem::~FileSystem()
{}

JSObject*
DOMFileSystem::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
FileSystem::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return DOMFileSystemBinding::Wrap(aCx, this, aGivenProto);
return FileSystemBinding::Wrap(aCx, this, aGivenProto);
}

void
DOMFileSystem::CreateRoot(const Sequence<RefPtr<Entry>>& aEntries)
FileSystem::CreateRoot(const Sequence<RefPtr<Entry>>& aEntries)
{
MOZ_ASSERT(!mRoot);
mRoot = new RootDirectoryEntry(mParent, aEntries, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* 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_DOMFileSystem_h
#define mozilla_dom_DOMFileSystem_h
#ifndef mozilla_dom_FileSystem_h
#define mozilla_dom_FileSystem_h

#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
Expand All @@ -22,15 +22,15 @@ class DirectoryEntry;
class Entry;
class OwningFileOrDirectory;

class DOMFileSystem final
class FileSystem final
: public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMFileSystem)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystem)

static already_AddRefed<DOMFileSystem>
static already_AddRefed<FileSystem>
Create(nsIGlobalObject* aGlobalObject);

nsIGlobalObject*
Expand Down Expand Up @@ -58,9 +58,9 @@ class DOMFileSystem final
CreateRoot(const Sequence<RefPtr<Entry>>& aEntries);

private:
explicit DOMFileSystem(nsIGlobalObject* aGlobalObject,
const nsAString& aName);
~DOMFileSystem();
explicit FileSystem(nsIGlobalObject* aGlobalObject,
const nsAString& aName);
~FileSystem();

nsCOMPtr<nsIGlobalObject> mParent;
RefPtr<DirectoryEntry> mRoot;
Expand All @@ -70,4 +70,4 @@ class DOMFileSystem final
} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_DOMFileSystem_h
#endif // mozilla_dom_FileSystem_h
2 changes: 1 addition & 1 deletion dom/filesystem/compat/RootDirectoryEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NS_INTERFACE_MAP_END_INHERITING(DirectoryEntry)

RootDirectoryEntry::RootDirectoryEntry(nsIGlobalObject* aGlobal,
const Sequence<RefPtr<Entry>>& aEntries,
DOMFileSystem* aFileSystem)
FileSystem* aFileSystem)
: DirectoryEntry(aGlobal, nullptr, aFileSystem)
, mEntries(aEntries)
{
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/RootDirectoryEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RootDirectoryEntry final : public DirectoryEntry

RootDirectoryEntry(nsIGlobalObject* aGlobalObject,
const Sequence<RefPtr<Entry>>& aEntries,
DOMFileSystem* aFileSystem);
FileSystem* aFileSystem);

virtual void
GetName(nsAString& aName, ErrorResult& aRv) const override;
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/RootDirectoryReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RootDirectoryReader)
NS_INTERFACE_MAP_END_INHERITING(DirectoryReader)

RootDirectoryReader::RootDirectoryReader(nsIGlobalObject* aGlobal,
DOMFileSystem* aFileSystem,
FileSystem* aFileSystem,
const Sequence<RefPtr<Entry>>& aEntries)
: DirectoryReader(aGlobal, aFileSystem, nullptr)
, mEntries(aEntries)
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/RootDirectoryReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RootDirectoryReader final : public DirectoryReader
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RootDirectoryReader, DirectoryReader)

explicit RootDirectoryReader(nsIGlobalObject* aGlobalObject,
DOMFileSystem* aFileSystem,
FileSystem* aFileSystem,
const Sequence<RefPtr<Entry>>& aEntries);

virtual void
Expand Down
4 changes: 2 additions & 2 deletions dom/filesystem/compat/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ TEST_DIRS += ['tests']
EXPORTS.mozilla.dom += [
'DirectoryEntry.h',
'DirectoryReader.h',
'DOMFileSystem.h',
'Entry.h',
'FileEntry.h',
'FileSystem.h',
]

UNIFIED_SOURCES += [
'CallbackRunnables.cpp',
'DirectoryEntry.cpp',
'DirectoryReader.cpp',
'DOMFileSystem.cpp',
'Entry.cpp',
'FileEntry.cpp',
'FileSystem.cpp',
'RootDirectoryEntry.cpp',
'RootDirectoryReader.cpp',
]
Expand Down
Loading

0 comments on commit b07e623

Please sign in to comment.