Skip to content

Commit

Permalink
Bug 1295570 - Entries API - part 2 - Rename Entry to FileSystemEntry,…
Browse files Browse the repository at this point in the history
… r=smaug
  • Loading branch information
bakulf committed Aug 18, 2016
1 parent b07e623 commit 31348eb
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 78 deletions.
6 changes: 3 additions & 3 deletions dom/events/DataTransferItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ DataTransferItem::GetAsFile(ErrorResult& aRv)
return file.forget();
}

already_AddRefed<Entry>
already_AddRefed<FileSystemEntry>
DataTransferItem::GetAsEntry(ErrorResult& aRv)
{
RefPtr<File> file = GetAsFile(aRv);
Expand Down Expand Up @@ -309,7 +309,7 @@ DataTransferItem::GetAsEntry(ErrorResult& aRv)
}

RefPtr<FileSystem> fs = FileSystem::Create(global);
RefPtr<Entry> entry;
RefPtr<FileSystemEntry> entry;
BlobImpl* impl = file->Impl();
MOZ_ASSERT(impl);

Expand All @@ -334,7 +334,7 @@ DataTransferItem::GetAsEntry(ErrorResult& aRv)
entry = new FileEntry(global, file, fs);
}

Sequence<RefPtr<Entry>> entries;
Sequence<RefPtr<FileSystemEntry>> entries;
if (!entries.AppendElement(entry, fallible)) {
return nullptr;
}
Expand Down
4 changes: 2 additions & 2 deletions dom/events/DataTransferItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace mozilla {
namespace dom {

class Entry;
class FileSystemEntry;
class FunctionStringCallback;

class DataTransferItem final : public nsISupports
Expand Down Expand Up @@ -75,7 +75,7 @@ class DataTransferItem final : public nsISupports

already_AddRefed<File> GetAsFile(ErrorResult& aRv);

already_AddRefed<Entry> GetAsEntry(ErrorResult& aRv);
already_AddRefed<FileSystemEntry> GetAsEntry(ErrorResult& aRv);

DataTransferItemList* GetParentObject() const
{
Expand Down
4 changes: 2 additions & 2 deletions dom/filesystem/compat/CallbackRunnables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace mozilla {
namespace dom {

EntryCallbackRunnable::EntryCallbackRunnable(EntryCallback* aCallback,
Entry* aEntry)
FileSystemEntry* aEntry)
: mCallback(aCallback)
, mEntry(aEntry)
{
Expand Down Expand Up @@ -67,7 +67,7 @@ EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(EntriesCallback* aCal
NS_IMETHODIMP
EmptyEntriesCallbackRunnable::Run()
{
Sequence<OwningNonNull<Entry>> sequence;
Sequence<OwningNonNull<FileSystemEntry>> sequence;
mCallback->HandleEvent(sequence);
return NS_OK;
}
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 @@ -20,14 +20,14 @@ class EntryCallbackRunnable final : public Runnable
{
public:
EntryCallbackRunnable(EntryCallback* aCallback,
Entry* aEntry);
FileSystemEntry* aEntry);

NS_IMETHOD
Run() override;

private:
RefPtr<EntryCallback> mCallback;
RefPtr<Entry> mEntry;
RefPtr<FileSystemEntry> mEntry;
};

class ErrorCallbackRunnable final : public Runnable
Expand Down
10 changes: 5 additions & 5 deletions dom/filesystem/compat/DirectoryEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
namespace mozilla {
namespace dom {

NS_IMPL_CYCLE_COLLECTION_INHERITED(DirectoryEntry, Entry, mDirectory)
NS_IMPL_CYCLE_COLLECTION_INHERITED(DirectoryEntry, FileSystemEntry, mDirectory)

NS_IMPL_ADDREF_INHERITED(DirectoryEntry, Entry)
NS_IMPL_RELEASE_INHERITED(DirectoryEntry, Entry)
NS_IMPL_ADDREF_INHERITED(DirectoryEntry, FileSystemEntry)
NS_IMPL_RELEASE_INHERITED(DirectoryEntry, FileSystemEntry)

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DirectoryEntry)
NS_INTERFACE_MAP_END_INHERITING(Entry)
NS_INTERFACE_MAP_END_INHERITING(FileSystemEntry)

DirectoryEntry::DirectoryEntry(nsIGlobalObject* aGlobal,
Directory* aDirectory,
FileSystem* aFileSystem)
: Entry(aGlobal, aFileSystem)
: FileSystemEntry(aGlobal, aFileSystem)
, mDirectory(aDirectory)
{
MOZ_ASSERT(aGlobal);
Expand Down
6 changes: 3 additions & 3 deletions dom/filesystem/compat/DirectoryEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
#ifndef mozilla_dom_DirectoryEntry_h
#define mozilla_dom_DirectoryEntry_h

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

namespace mozilla {
namespace dom {

class Directory;

class DirectoryEntry : public Entry
class DirectoryEntry : public FileSystemEntry
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DirectoryEntry, Entry)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DirectoryEntry, FileSystemEntry)

DirectoryEntry(nsIGlobalObject* aGlobalObject, Directory* aDirectory,
FileSystem* aFileSystem);
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/DirectoryReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PromiseHandler final : public PromiseNativeHandler
return;
}

Sequence<OwningNonNull<Entry>> sequence;
Sequence<OwningNonNull<FileSystemEntry>> sequence;
if (NS_WARN_IF(!sequence.SetLength(length, fallible))) {
return;
}
Expand Down
10 changes: 5 additions & 5 deletions dom/filesystem/compat/FileEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ class BlobCallbackRunnable final : public Runnable

} // anonymous namespace

NS_IMPL_CYCLE_COLLECTION_INHERITED(FileEntry, Entry, mFile)
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileEntry, FileSystemEntry, mFile)

NS_IMPL_ADDREF_INHERITED(FileEntry, Entry)
NS_IMPL_RELEASE_INHERITED(FileEntry, Entry)
NS_IMPL_ADDREF_INHERITED(FileEntry, FileSystemEntry)
NS_IMPL_RELEASE_INHERITED(FileEntry, FileSystemEntry)

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileEntry)
NS_INTERFACE_MAP_END_INHERITING(Entry)
NS_INTERFACE_MAP_END_INHERITING(FileSystemEntry)

FileEntry::FileEntry(nsIGlobalObject* aGlobal,
File* aFile,
FileSystem* aFileSystem)
: Entry(aGlobal, aFileSystem)
: FileSystemEntry(aGlobal, aFileSystem)
, mFile(aFile)
{
MOZ_ASSERT(aGlobal);
Expand Down
6 changes: 3 additions & 3 deletions dom/filesystem/compat/FileEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
#ifndef mozilla_dom_FileEntry_h
#define mozilla_dom_FileEntry_h

#include "mozilla/dom/Entry.h"
#include "mozilla/dom/FileSystemEntry.h"

namespace mozilla {
namespace dom {

class File;

class FileEntry final : public Entry
class FileEntry final : public FileSystemEntry
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileEntry, Entry)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileEntry, FileSystemEntry)

FileEntry(nsIGlobalObject* aGlobalObject, File* aFile,
FileSystem* aFileSystem);
Expand Down
2 changes: 1 addition & 1 deletion dom/filesystem/compat/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ FileSystem::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
}

void
FileSystem::CreateRoot(const Sequence<RefPtr<Entry>>& aEntries)
FileSystem::CreateRoot(const Sequence<RefPtr<FileSystemEntry>>& aEntries)
{
MOZ_ASSERT(!mRoot);
mRoot = new RootDirectoryEntry(mParent, aEntries, this);
Expand Down
4 changes: 2 additions & 2 deletions dom/filesystem/compat/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace mozilla {
namespace dom {

class DirectoryEntry;
class Entry;
class FileSystemEntry;
class OwningFileOrDirectory;

class FileSystem final
Expand Down Expand Up @@ -55,7 +55,7 @@ class FileSystem final
}

void
CreateRoot(const Sequence<RefPtr<Entry>>& aEntries);
CreateRoot(const Sequence<RefPtr<FileSystemEntry>>& aEntries);

private:
explicit FileSystem(nsIGlobalObject* aGlobalObject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@
* 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 "Entry.h"
#include "FileSystemEntry.h"
#include "DirectoryEntry.h"
#include "FileEntry.h"
#include "mozilla/dom/UnionTypes.h"

namespace mozilla {
namespace dom {

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Entry, mParent, mFileSystem)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileSystemEntry, mParent, mFileSystem)

NS_IMPL_CYCLE_COLLECTING_ADDREF(Entry)
NS_IMPL_CYCLE_COLLECTING_RELEASE(Entry)
NS_IMPL_CYCLE_COLLECTING_ADDREF(FileSystemEntry)
NS_IMPL_CYCLE_COLLECTING_RELEASE(FileSystemEntry)

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Entry)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileSystemEntry)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END

/* static */ already_AddRefed<Entry>
Entry::Create(nsIGlobalObject* aGlobalObject,
const OwningFileOrDirectory& aFileOrDirectory,
FileSystem* aFileSystem)
/* static */ already_AddRefed<FileSystemEntry>
FileSystemEntry::Create(nsIGlobalObject* aGlobalObject,
const OwningFileOrDirectory& aFileOrDirectory,
FileSystem* aFileSystem)
{
MOZ_ASSERT(aGlobalObject);
MOZ_ASSERT(aFileSystem);

RefPtr<Entry> entry;
RefPtr<FileSystemEntry> entry;
if (aFileOrDirectory.IsFile()) {
entry = new FileEntry(aGlobalObject,
aFileOrDirectory.GetAsFile(),
Expand All @@ -45,21 +45,22 @@ Entry::Create(nsIGlobalObject* aGlobalObject,
return entry.forget();
}

Entry::Entry(nsIGlobalObject* aGlobal, FileSystem* aFileSystem)
FileSystemEntry::FileSystemEntry(nsIGlobalObject* aGlobal,
FileSystem* aFileSystem)
: mParent(aGlobal)
, mFileSystem(aFileSystem)
{
MOZ_ASSERT(aGlobal);
MOZ_ASSERT(aFileSystem);
}

Entry::~Entry()
FileSystemEntry::~FileSystemEntry()
{}

JSObject*
Entry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
FileSystemEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return EntryBinding::Wrap(aCx, this, aGivenProto);
return FileSystemEntryBinding::Wrap(aCx, this, aGivenProto);
}

} // dom namespace
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_Entry_h
#define mozilla_dom_Entry_h
#ifndef mozilla_dom_FileSystemEntry_h
#define mozilla_dom_FileSystemEntry_h

#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
Expand All @@ -20,15 +20,15 @@ namespace dom {
class FileSystem;
class OwningFileOrDirectory;

class Entry
class FileSystemEntry
: public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Entry)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystemEntry)

static already_AddRefed<Entry>
static already_AddRefed<FileSystemEntry>
Create(nsIGlobalObject* aGlobalObject,
const OwningFileOrDirectory& aFileOrDirectory,
FileSystem* aFileSystem);
Expand Down Expand Up @@ -67,9 +67,9 @@ class Entry
}

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

private:
nsCOMPtr<nsIGlobalObject> mParent;
Expand All @@ -79,4 +79,4 @@ class Entry
} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_Entry_h
#endif // mozilla_dom_FileSystemEntry_h
4 changes: 2 additions & 2 deletions dom/filesystem/compat/RootDirectoryEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RootDirectoryEntry)
NS_INTERFACE_MAP_END_INHERITING(DirectoryEntry)

RootDirectoryEntry::RootDirectoryEntry(nsIGlobalObject* aGlobal,
const Sequence<RefPtr<Entry>>& aEntries,
const Sequence<RefPtr<FileSystemEntry>>& aEntries,
FileSystem* aFileSystem)
: DirectoryEntry(aGlobal, nullptr, aFileSystem)
, mEntries(aEntries)
Expand Down Expand Up @@ -76,7 +76,7 @@ RootDirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& a

MOZ_ASSERT(!parts.IsEmpty());

RefPtr<Entry> entry;
RefPtr<FileSystemEntry> entry;
for (uint32_t i = 0; i < mEntries.Length(); ++i) {
ErrorResult rv;
nsAutoString name;
Expand Down
4 changes: 2 additions & 2 deletions dom/filesystem/compat/RootDirectoryEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RootDirectoryEntry final : public DirectoryEntry
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RootDirectoryEntry, DirectoryEntry)

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

virtual void
Expand All @@ -44,7 +44,7 @@ class RootDirectoryEntry final : public DirectoryEntry
Error(const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
nsresult aError) const;

Sequence<RefPtr<Entry>> mEntries;
Sequence<RefPtr<FileSystemEntry>> mEntries;
};

} // namespace dom
Expand Down
Loading

0 comments on commit 31348eb

Please sign in to comment.