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

Side by Side Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h

Issue 1917733004: Reland of: Make OffscreenCanvas Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: works! Created 4 years, 7 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef OffscreenCanvas_h 5 #ifndef OffscreenCanvas_h
6 #define OffscreenCanvas_h 6 #define OffscreenCanvas_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/ScriptWrappable.h" 10 #include "bindings/core/v8/ScriptWrappable.h"
(...skipping 14 matching lines...) Expand all
25 // IDL attributes 25 // IDL attributes
26 unsigned width() const { return m_size.width(); } 26 unsigned width() const { return m_size.width(); }
27 unsigned height() const { return m_size.height(); } 27 unsigned height() const { return m_size.height(); }
28 void setWidth(unsigned); 28 void setWidth(unsigned);
29 void setHeight(unsigned); 29 void setHeight(unsigned);
30 30
31 // API Methods 31 // API Methods
32 ImageBitmap* transferToImageBitmap(ExceptionState&); 32 ImageBitmap* transferToImageBitmap(ExceptionState&);
33 33
34 IntSize size() const { return m_size; } 34 IntSize size() const { return m_size; }
35 void setAssociatedCanvas(HTMLCanvasElement* canvas) { m_canvas = canvas; } 35 void setAssociatedCanvasId(int canvasId) { m_canvasId = canvasId; }
Justin Novosad 2016/04/26 20:08:32 I do not see any tests that verify that transfered
xidachen 2016/04/26 20:40:59 Per offline discussion: this ID will be verified o
36 HTMLCanvasElement* getAssociatedCanvas() const { return m_canvas; } 36 int getAssociatedCanvasId() const { return m_canvasId; }
37 bool isNeutered() const { return m_isNeutered; }
38 void setNeutered();
37 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&); 39 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&);
40 CanvasRenderingContext* renderingContext() { return m_context.get(); }
38 41
39 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); 42 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>);
40 43
41 DECLARE_VIRTUAL_TRACE(); 44 DECLARE_VIRTUAL_TRACE();
42 45
43 private: 46 private:
44 explicit OffscreenCanvas(const IntSize&); 47 explicit OffscreenCanvas(const IntSize&);
45 48
46 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; 49 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>;
47 static ContextFactoryVector& renderingContextFactories(); 50 static ContextFactoryVector& renderingContextFactories();
48 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 51 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
49 52
50 Member<CanvasRenderingContext> m_context; 53 Member<CanvasRenderingContext> m_context;
51 WeakMember<HTMLCanvasElement> m_canvas; 54 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element.
52 IntSize m_size; 55 IntSize m_size;
56 bool m_isNeutered = false;
53 }; 57 };
54 58
55 } // namespace blink 59 } // namespace blink
56 60
57 #endif // OffscreenCanvas_h 61 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698