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

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

Issue 2143033005: Transfer components of SurfaceId in OffscreenCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test Created 4 years, 5 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 29 matching lines...) Expand all
40 bool isNeutered() const { return m_isNeutered; } 40 bool isNeutered() const { return m_isNeutered; }
41 void setNeutered(); 41 void setNeutered();
42 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String &, const CanvasContextCreationAttributes&); 42 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String &, const CanvasContextCreationAttributes&);
43 CanvasRenderingContext* renderingContext() { return m_context; } 43 CanvasRenderingContext* renderingContext() { return m_context; }
44 44
45 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC ontextFactory>); 45 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC ontextFactory>);
46 46
47 bool originClean() const; 47 bool originClean() const;
48 void setOriginTainted() { m_originClean = false; } 48 void setOriginTainted() { m_originClean = false; }
49 49
50 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonce)
51 {
52 m_clientId = clientId;
53 m_localId = localId;
54 m_nonce = nonce;
55 }
56 uint32_t clientId() const { return m_clientId; }
57 uint32_t localId() const { return m_localId; }
58 uint64_t nonce() const { return m_nonce; }
59
50 DECLARE_VIRTUAL_TRACE(); 60 DECLARE_VIRTUAL_TRACE();
51 61
52 private: 62 private:
53 explicit OffscreenCanvas(const IntSize&); 63 explicit OffscreenCanvas(const IntSize&);
54 64
55 using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFa ctory>>; 65 using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFa ctory>>;
56 static ContextFactoryVector& renderingContextFactories(); 66 static ContextFactoryVector& renderingContextFactories();
57 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 67 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
58 68
59 Member<CanvasRenderingContext> m_context; 69 Member<CanvasRenderingContext> m_context;
60 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element. 70 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element.
61 IntSize m_size; 71 IntSize m_size;
62 bool m_isNeutered = false; 72 bool m_isNeutered = false;
63 73
64 bool m_originClean; 74 bool m_originClean;
75
76 // cc::SurfaceId is broken into three integer components as this can be used
77 // in transfer of OffscreenCanvas across threads
78 // If this object is not created via HTMLCanvasElement.transferControlToOffs creen(),
79 // then the following members would remain as initialized zero values.
80 uint32_t m_clientId = 0;
81 uint32_t m_localId = 0;
82 uint64_t m_nonce = 0;
65 }; 83 };
66 84
67 } // namespace blink 85 } // namespace blink
68 86
69 #endif // OffscreenCanvas_h 87 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698