Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Unified Diff: Source/core/html/HTMLCanvasElement.h

Issue 1331443009: Implement Asynchronous image encoding for Canvas.toBlob (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase with latest code Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLCanvasElement.h
diff --git a/Source/core/html/HTMLCanvasElement.h b/Source/core/html/HTMLCanvasElement.h
index 7173957a4058858e351c7dfdc0b3cc0cc92042ce..49b10015c86825216edd8f54ce35f7bb71b87bff 100644
--- a/Source/core/html/HTMLCanvasElement.h
+++ b/Source/core/html/HTMLCanvasElement.h
@@ -31,6 +31,7 @@
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/UnionTypesCore.h"
#include "core/CoreExport.h"
+#include "core/dom/DOMTypedArray.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentVisibilityObserver.h"
#include "core/fileapi/FileCallback.h"
@@ -42,6 +43,7 @@
#include "platform/graphics/GraphicsTypes3D.h"
#include "platform/graphics/ImageBufferClient.h"
#include "platform/heap/Handle.h"
+#include "public/platform/WebThread.h"
#define CanvasDefaultInterpolationQuality InterpolationLow
@@ -114,7 +116,7 @@ public:
String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const;
String toDataURL(const String& mimeType, ExceptionState& exceptionState) const { return toDataURL(mimeType, ScriptValue(), exceptionState); }
- void toBlob(FileCallback*, const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const;
+ void toBlob(FileCallback*, const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&);
void toBlob(FileCallback* callback, const String& mimeType, ExceptionState& exceptionState) { return toBlob(callback, mimeType, ScriptValue(), exceptionState); }
// Used for rendering
@@ -209,7 +211,10 @@ private:
bool paintsIntoCanvasBuffer() const;
ImageData* toImageData(SourceDrawingBuffer) const;
- String toDataURLInternal(const String& mimeType, const double* quality, SourceDrawingBuffer) const;
+ String toDataURLInternal(const String& mimeType, const double& quality, SourceDrawingBuffer) const;
+
+ void encodeImageAsync(DOMUint8ClampedArray* imagedata, IntSize imageSize, FileCallback*, const String& mimeType, double quality);
+ void createBlobAndCall(PassOwnPtr<Vector<char>> encodedImage, const String& mimeType, FileCallback*);
WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers;
@@ -232,6 +237,8 @@ private:
OwnPtr<ImageBuffer> m_imageBuffer;
mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue).
+
+ OwnPtr<WebThread> m_thread;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698