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

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

Issue 1355333005: Implement Asynchronous image encoding for Canvas.toBlob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change async func to static so no need worry if canvas instance does not live long enough 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: third_party/WebKit/Source/core/html/HTMLCanvasElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
index 2f786efeb103090cef8095a01b68d8140d6832aa..f8b1b19abcd8ac856b20ee4c9e9f5132794baa76 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
+++ b/third_party/WebKit/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
@@ -78,6 +80,8 @@ public:
DECLARE_NODE_FACTORY(HTMLCanvasElement);
~HTMLCanvasElement() override;
+ static WebThread* getToBlobThreadInstance();
+
void addObserver(CanvasObserver*);
void removeObserver(CanvasObserver*);
@@ -114,7 +118,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
@@ -211,7 +215,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;
+
+ static void encodeImageAsync(DOMUint8ClampedArray* imagedata, IntSize imageSize, FileCallback*, const String& mimeType, double quality);
+ static void createBlobAndCall(PassOwnPtr<Vector<char>> encodedImage, const String& mimeType, FileCallback*);
WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers;

Powered by Google App Engine
This is Rietveld 408576698