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

Side by Side Diff: Source/core/html/HTMLCanvasElement.h

Issue 1257253004: [HTMLCanvasElement.toBlob] Default callback version without scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Basic Callback version of toBlob function of HTMLCanvasElement Implemented Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 17 matching lines...) Expand all
28 #ifndef HTMLCanvasElement_h 28 #ifndef HTMLCanvasElement_h
29 #define HTMLCanvasElement_h 29 #define HTMLCanvasElement_h
30 30
31 #include "bindings/core/v8/ScriptValue.h" 31 #include "bindings/core/v8/ScriptValue.h"
32 #include "bindings/core/v8/UnionTypesCore.h" 32 #include "bindings/core/v8/UnionTypesCore.h"
33 #include "core/CoreExport.h" 33 #include "core/CoreExport.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/DocumentVisibilityObserver.h" 35 #include "core/dom/DocumentVisibilityObserver.h"
36 #include "core/html/HTMLElement.h" 36 #include "core/html/HTMLElement.h"
37 #include "core/html/canvas/CanvasImageSource.h" 37 #include "core/html/canvas/CanvasImageSource.h"
38 #include "modules/filesystem/FileCallback.h"
38 #include "platform/geometry/FloatRect.h" 39 #include "platform/geometry/FloatRect.h"
39 #include "platform/geometry/IntSize.h" 40 #include "platform/geometry/IntSize.h"
40 #include "platform/graphics/GraphicsTypes.h" 41 #include "platform/graphics/GraphicsTypes.h"
41 #include "platform/graphics/GraphicsTypes3D.h" 42 #include "platform/graphics/GraphicsTypes3D.h"
42 #include "platform/graphics/ImageBufferClient.h" 43 #include "platform/graphics/ImageBufferClient.h"
43 #include "platform/heap/Handle.h" 44 #include "platform/heap/Handle.h"
44 45
45 #define CanvasDefaultInterpolationQuality InterpolationLow 46 #define CanvasDefaultInterpolationQuality InterpolationLow
46 47
47 namespace blink { 48 namespace blink {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 ScriptValue getContext(ScriptState*, const String&, const CanvasContextCreat ionAttributes&); 107 ScriptValue getContext(ScriptState*, const String&, const CanvasContextCreat ionAttributes&);
107 // Called by Document::getCSSCanvasContext as well as above getContext(). 108 // Called by Document::getCSSCanvasContext as well as above getContext().
108 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&); 109 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&);
109 110
110 bool isPaintable() const; 111 bool isPaintable() const;
111 112
112 static String toEncodingMimeType(const String& mimeType); 113 static String toEncodingMimeType(const String& mimeType);
113 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const; 114 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const;
114 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); } 115 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); }
115 116
117 void toBlob(FileCallback*, const String& mimeType, const ScriptValue& qualit yArgument, ExceptionState&) const;
Justin Novosad 2015/08/13 21:03:40 This new entry point is not tested
xlai (Olivia) 2015/08/20 19:46:44 Acknowledged. Planning to write another Layout tes
118 void toBlob(FileCallback* callback, const String& mimeType, ExceptionState& exceptionState) { return toBlob(callback, mimeType, ScriptValue(), exceptionStat e); }
119
116 // Used for rendering 120 // Used for rendering
117 void didDraw(const FloatRect&); 121 void didDraw(const FloatRect&);
118 void notifyObserversCanvasChanged(const FloatRect&); 122 void notifyObserversCanvasChanged(const FloatRect&);
119 123
120 void paint(GraphicsContext*, const LayoutRect&); 124 void paint(GraphicsContext*, const LayoutRect&);
121 125
122 SkCanvas* drawingCanvas() const; 126 SkCanvas* drawingCanvas() const;
123 SkCanvas* existingDrawingCanvas() const; 127 SkCanvas* existingDrawingCanvas() const;
124 128
125 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); 129 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 182
179 protected: 183 protected:
180 void didMoveToNewDocument(Document& oldDocument) override; 184 void didMoveToNewDocument(Document& oldDocument) override;
181 185
182 private: 186 private:
183 explicit HTMLCanvasElement(Document&); 187 explicit HTMLCanvasElement(Document&);
184 188
185 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; 189 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>;
186 static ContextFactoryVector& renderingContextFactories(); 190 static ContextFactoryVector& renderingContextFactories();
187 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 191 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
192
Justin Novosad 2015/08/13 21:03:40 spurious new line
xlai (Olivia) 2015/08/20 19:46:44 Done.
188 193
189 void parseAttribute(const QualifiedName&, const AtomicString&) override; 194 void parseAttribute(const QualifiedName&, const AtomicString&) override;
190 LayoutObject* createLayoutObject(const ComputedStyle&) override; 195 LayoutObject* createLayoutObject(const ComputedStyle&) override;
191 void didRecalcStyle(StyleRecalcChange) override; 196 void didRecalcStyle(StyleRecalcChange) override;
192 bool areAuthorShadowsAllowed() const override { return false; } 197 bool areAuthorShadowsAllowed() const override { return false; }
193 198
194 void reset(); 199 void reset();
195 200
196 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount); 201 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount);
197 void createImageBuffer(); 202 void createImageBuffer();
(...skipping 26 matching lines...) Expand all
224 mutable bool m_didFailToCreateImageBuffer; 229 mutable bool m_didFailToCreateImageBuffer;
225 bool m_imageBufferIsClear; 230 bool m_imageBufferIsClear;
226 OwnPtr<ImageBuffer> m_imageBuffer; 231 OwnPtr<ImageBuffer> m_imageBuffer;
227 232
228 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 233 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
229 }; 234 };
230 235
231 } // namespace blink 236 } // namespace blink
232 237
233 #endif // HTMLCanvasElement_h 238 #endif // HTMLCanvasElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698