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

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

Issue 2294963002: Submit Compositor Frame from OffscreenCanvas on main (Closed)
Patch Set: a test to ensure resizing on transferred offscreencanvas has no effect Created 4 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 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"
11 #include "core/html/HTMLCanvasElement.h" 11 #include "core/html/HTMLCanvasElement.h"
12 #include "core/html/canvas/CanvasImageSource.h" 12 #include "core/html/canvas/CanvasImageSource.h"
13 #include "platform/geometry/IntSize.h" 13 #include "platform/geometry/IntSize.h"
14 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h"
14 #include "platform/heap/Handle.h" 15 #include "platform/heap/Handle.h"
15 #include <memory> 16 #include <memory>
16 17
17 namespace blink { 18 namespace blink {
18 19
19 class CanvasContextCreationAttributes; 20 class CanvasContextCreationAttributes;
20 class ImageBitmap; 21 class ImageBitmap;
21 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC ontext; 22 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC ontext;
22 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin gContext OffscreenRenderingContext; 23 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin gContext OffscreenRenderingContext;
23 24
(...skipping 19 matching lines...) Expand all
43 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String &, const CanvasContextCreationAttributes&); 44 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String &, const CanvasContextCreationAttributes&);
44 CanvasRenderingContext* renderingContext() { return m_context; } 45 CanvasRenderingContext* renderingContext() { return m_context; }
45 46
46 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC ontextFactory>); 47 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC ontextFactory>);
47 48
48 bool originClean() const; 49 bool originClean() const;
49 void setOriginTainted() { m_originClean = false; } 50 void setOriginTainted() { m_originClean = false; }
50 // TODO(crbug.com/630356): apply the flag to WebGL context as well 51 // TODO(crbug.com/630356): apply the flag to WebGL context as well
51 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true; } 52 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true; }
52 53
54 OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher();
55
53 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonce) 56 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonce)
54 { 57 {
55 m_clientId = clientId; 58 m_clientId = clientId;
56 m_localId = localId; 59 m_localId = localId;
57 m_nonce = nonce; 60 m_nonce = nonce;
58 } 61 }
59 uint32_t clientId() const { return m_clientId; } 62 uint32_t clientId() const { return m_clientId; }
60 uint32_t localId() const { return m_localId; } 63 uint32_t localId() const { return m_localId; }
61 uint64_t nonce() const { return m_nonce; } 64 uint64_t nonce() const { return m_nonce; }
62 65
(...skipping 18 matching lines...) Expand all
81 Member<CanvasRenderingContext> m_context; 84 Member<CanvasRenderingContext> m_context;
82 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element. 85 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element.
83 IntSize m_size; 86 IntSize m_size;
84 bool m_isNeutered = false; 87 bool m_isNeutered = false;
85 88
86 bool m_originClean; 89 bool m_originClean;
87 bool m_disableReadingFromCanvas = false; 90 bool m_disableReadingFromCanvas = false;
88 91
89 bool isPaintable() const; 92 bool isPaintable() const;
90 93
94 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher;
91 // cc::SurfaceId is broken into three integer components as this can be used 95 // cc::SurfaceId is broken into three integer components as this can be used
92 // in transfer of OffscreenCanvas across threads 96 // in transfer of OffscreenCanvas across threads
93 // If this object is not created via HTMLCanvasElement.transferControlToOffs creen(), 97 // If this object is not created via HTMLCanvasElement.transferControlToOffs creen(),
94 // then the following members would remain as initialized zero values. 98 // then the following members would remain as initialized zero values.
95 uint32_t m_clientId = 0; 99 uint32_t m_clientId = 0;
96 uint32_t m_localId = 0; 100 uint32_t m_localId = 0;
97 uint64_t m_nonce = 0; 101 uint64_t m_nonce = 0;
98 }; 102 };
99 103
100 } // namespace blink 104 } // namespace blink
101 105
102 #endif // OffscreenCanvas_h 106 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698