Bug 1295570 - Entries API - part 6 - Rename Entries Callbacks, r=smaug

This commit is contained in:
Andrea Marchesini 2016-08-18 09:19:15 +02:00
parent 8fb5264eef
commit 87b1535dbc
11 changed files with 55 additions and 38 deletions

View File

@ -17,7 +17,7 @@
namespace mozilla {
namespace dom {
EntryCallbackRunnable::EntryCallbackRunnable(EntryCallback* aCallback,
EntryCallbackRunnable::EntryCallbackRunnable(FileSystemEntryCallback* aCallback,
FileSystemEntry* aEntry)
: mCallback(aCallback)
, mEntry(aEntry)
@ -58,7 +58,7 @@ ErrorCallbackRunnable::Run()
return NS_OK;
}
EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(EntriesCallback* aCallback)
EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(FileSystemEntriesCallback* aCallback)
: mCallback(aCallback)
{
MOZ_ASSERT(aCallback);
@ -74,7 +74,7 @@ EmptyEntriesCallbackRunnable::Run()
GetEntryHelper::GetEntryHelper(nsIGlobalObject* aGlobalObject,
FileSystem* aFileSystem,
EntryCallback* aSuccessCallback,
FileSystemEntryCallback* aSuccessCallback,
ErrorCallback* aErrorCallback,
FileSystemDirectoryEntry::GetInternalType aType)
: mGlobal(aGlobalObject)

View File

@ -19,14 +19,14 @@ 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;
};
@ -49,13 +49,13 @@ private:
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
@ -65,7 +65,7 @@ public:
GetEntryHelper(nsIGlobalObject* aGlobalObject,
FileSystem* aFileSystem,
EntryCallback* aSuccessCallback,
FileSystemEntryCallback* aSuccessCallback,
ErrorCallback* aErrorCallback,
FileSystemDirectoryEntry::GetInternalType aType);
@ -83,7 +83,7 @@ private:
nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<FileSystem> mFileSystem;
RefPtr<EntryCallback> mSuccessCallback;
RefPtr<FileSystemEntryCallback> mSuccessCallback;
RefPtr<ErrorCallback> mErrorCallback;
FileSystemDirectoryEntry::GetInternalType mType;
};

View File

@ -68,7 +68,7 @@ FileSystemDirectoryEntry::CreateReader() const
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
{

View File

@ -46,7 +46,7 @@ public:
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);
@ -54,7 +54,7 @@ public:
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);
@ -68,7 +68,7 @@ public:
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;

View File

@ -26,7 +26,7 @@ public:
PromiseHandler(nsIGlobalObject* aGlobalObject,
FileSystem* aFileSystem,
EntriesCallback* aSuccessCallback,
FileSystemEntriesCallback* aSuccessCallback,
ErrorCallback* aErrorCallback)
: mGlobal(aGlobalObject)
, mFileSystem(aFileSystem)
@ -108,7 +108,7 @@ private:
nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<FileSystem> mFileSystem;
RefPtr<EntriesCallback> mSuccessCallback;
RefPtr<FileSystemEntriesCallback> mSuccessCallback;
RefPtr<ErrorCallback> mErrorCallback;
};
@ -150,7 +150,7 @@ FileSystemDirectoryReader::WrapObject(JSContext* aCx,
}
void
FileSystemDirectoryReader::ReadEntries(EntriesCallback& aSuccessCallback,
FileSystemDirectoryReader::ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
ErrorResult& aRv)
{

View File

@ -43,7 +43,7 @@ public:
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
virtual void
ReadEntries(EntriesCallback& aSuccessCallback,
ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
ErrorResult& aRv);

View File

@ -56,7 +56,7 @@ FileSystemRootDirectoryEntry::CreateReader() const
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
{

View File

@ -36,7 +36,7 @@ private:
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;

View File

@ -16,7 +16,7 @@ namespace {
class EntriesCallbackRunnable final : public Runnable
{
public:
EntriesCallbackRunnable(EntriesCallback* aCallback,
EntriesCallbackRunnable(FileSystemEntriesCallback* aCallback,
const Sequence<RefPtr<FileSystemEntry>>& aEntries)
: mCallback(aCallback)
, mEntries(aEntries)
@ -39,7 +39,7 @@ public:
}
private:
RefPtr<EntriesCallback> mCallback;
RefPtr<FileSystemEntriesCallback> mCallback;
Sequence<RefPtr<FileSystemEntry>> mEntries;
};
@ -71,7 +71,7 @@ FileSystemRootDirectoryReader::~FileSystemRootDirectoryReader()
{}
void
FileSystemRootDirectoryReader::ReadEntries(EntriesCallback& aSuccessCallback,
FileSystemRootDirectoryReader::ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
ErrorResult& aRv)
{

View File

@ -24,7 +24,7 @@ public:
const Sequence<RefPtr<FileSystemEntry>>& aEntries);
virtual void
ReadEntries(EntriesCallback& aSuccessCallback,
ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
ErrorResult& aRv) override;

View File

@ -18,12 +18,19 @@ interface FileSystemEntry {
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);
*/
};
@ -32,7 +39,7 @@ dictionary FileSystemFlags {
boolean exclusive = false;
};
callback interface EntryCallback {
callback interface FileSystemEntryCallback {
void handleEvent(FileSystemEntry entry);
};
@ -44,16 +51,23 @@ callback interface VoidCallback {
interface FileSystemDirectoryEntry : FileSystemEntry {
FileSystemDirectoryReader createReader();
void getFile(DOMString? path, optional FileSystemFlags options, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
void getFile(DOMString? path,
optional FileSystemFlags options,
optional FileSystemEntryCallback successCallback,
optional ErrorCallback errorCallback);
void getDirectory(DOMString? path, optional FileSystemFlags options, optional EntryCallback 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);
// 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);
};
@ -68,7 +82,8 @@ 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 {
@ -80,10 +95,12 @@ 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]