Bug 1284987 - Entries API - part 6 - BlobCallback renamed, r=smaug

This commit is contained in:
Andrea Marchesini 2016-11-03 07:57:34 +01:00
parent a69d834b0d
commit 9188b61d96
8 changed files with 25 additions and 25 deletions

View File

@ -22,7 +22,7 @@ namespace dom {
void
CanvasRenderingContextHelper::ToBlob(JSContext* aCx,
nsIGlobalObject* aGlobal,
FileCallback& aCallback,
BlobCallback& aCallback,
const nsAString& aType,
JS::Handle<JS::Value> aParams,
ErrorResult& aRv)
@ -31,9 +31,9 @@ CanvasRenderingContextHelper::ToBlob(JSContext* aCx,
class EncodeCallback : public EncodeCompleteCallback
{
public:
EncodeCallback(nsIGlobalObject* aGlobal, FileCallback* aCallback)
EncodeCallback(nsIGlobalObject* aGlobal, BlobCallback* aCallback)
: mGlobal(aGlobal)
, mFileCallback(aCallback) {}
, mBlobCallback(aCallback) {}
// This is called on main thread.
nsresult ReceiveBlob(already_AddRefed<Blob> aBlob)
@ -53,16 +53,16 @@ CanvasRenderingContextHelper::ToBlob(JSContext* aCx,
RefPtr<Blob> newBlob = Blob::Create(mGlobal, blob->Impl());
mFileCallback->Call(*newBlob, rv);
mBlobCallback->Call(*newBlob, rv);
mGlobal = nullptr;
mFileCallback = nullptr;
mBlobCallback = nullptr;
return rv.StealNSResult();
}
nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<FileCallback> mFileCallback;
RefPtr<BlobCallback> mBlobCallback;
};
RefPtr<EncodeCompleteCallback> callback =

View File

@ -18,8 +18,8 @@ class ErrorResult;
namespace dom {
class BlobCallback;
class EncodeCompleteCallback;
class FileCallback;
enum class CanvasContextType : uint8_t {
NoContext,
@ -55,7 +55,7 @@ protected:
nsAString& outParams,
bool* const outCustomParseOptions);
void ToBlob(JSContext* aCx, nsIGlobalObject* global, FileCallback& aCallback,
void ToBlob(JSContext* aCx, nsIGlobalObject* global, BlobCallback& aCallback,
const nsAString& aType, JS::Handle<JS::Value> aParams,
ErrorResult& aRv);

View File

@ -14,10 +14,10 @@ namespace dom {
namespace {
class BlobCallbackRunnable final : public Runnable
class FileCallbackRunnable final : public Runnable
{
public:
BlobCallbackRunnable(BlobCallback* aCallback, File* aFile)
FileCallbackRunnable(FileCallback* aCallback, File* aFile)
: mCallback(aCallback)
, mFile(aFile)
{
@ -28,12 +28,12 @@ public:
NS_IMETHOD
Run() override
{
mCallback->HandleEvent(mFile);
mCallback->HandleEvent(*mFile);
return NS_OK;
}
private:
RefPtr<BlobCallback> mCallback;
RefPtr<FileCallback> mCallback;
RefPtr<File> mFile;
};
@ -99,11 +99,11 @@ FileSystemFileEntry::CreateWriter(VoidCallback& aSuccessCallback,
}
void
FileSystemFileEntry::GetFile(BlobCallback& aSuccessCallback,
FileSystemFileEntry::GetFile(FileCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
{
RefPtr<BlobCallbackRunnable> runnable =
new BlobCallbackRunnable(&aSuccessCallback, mFile);
RefPtr<FileCallbackRunnable> runnable =
new FileCallbackRunnable(&aSuccessCallback, mFile);
DebugOnly<nsresult> rv = NS_DispatchToMainThread(runnable);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
}

View File

@ -12,8 +12,8 @@
namespace mozilla {
namespace dom {
class BlobCallback;
class File;
class FileCallback;
class FileSystemDirectoryEntry;
class FileSystemFileEntry final : public FileSystemEntry
@ -46,7 +46,7 @@ public:
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
void
GetFile(BlobCallback& aSuccessCallback,
GetFile(FileCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
private:

View File

@ -805,7 +805,7 @@ HTMLCanvasElement::ToDataURLImpl(JSContext* aCx,
void
HTMLCanvasElement::ToBlob(JSContext* aCx,
FileCallback& aCallback,
BlobCallback& aCallback,
const nsAString& aType,
JS::Handle<JS::Value> aParams,
ErrorResult& aRv)

View File

@ -41,9 +41,9 @@ class VRLayerChild;
} // namespace gfx
namespace dom {
class BlobCallback;
class CanvasCaptureMediaStream;
class File;
class FileCallback;
class HTMLCanvasPrintState;
class OffscreenCanvas;
class PrintCallback;
@ -182,7 +182,7 @@ public:
}
void ToBlob(JSContext* aCx,
FileCallback& aCallback,
BlobCallback& aCallback,
const nsAString& aType,
JS::Handle<JS::Value> aParams,
ErrorResult& aRv);

View File

@ -4,8 +4,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
callback interface BlobCallback {
void handleEvent(Blob? blob);
callback interface FileCallback {
void handleEvent(File file);
};
interface FileSystemFileEntry : FileSystemEntry {
@ -15,6 +15,6 @@ interface FileSystemFileEntry : FileSystemEntry {
optional ErrorCallback errorCallback);
[BinaryName="GetFile"]
void file (BlobCallback successCallback,
void file (FileCallback successCallback,
optional ErrorCallback errorCallback);
};

View File

@ -26,7 +26,7 @@ interface HTMLCanvasElement : HTMLElement {
DOMString toDataURL(optional DOMString type = "",
optional any encoderOptions);
[Throws]
void toBlob(FileCallback _callback,
void toBlob(BlobCallback _callback,
optional DOMString type = "",
optional any encoderOptions);
};
@ -64,4 +64,4 @@ interface MozCanvasPrintState
callback PrintCallback = void(MozCanvasPrintState ctx);
callback FileCallback = void(Blob file);
callback BlobCallback = void(Blob blob);