Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <memory> | 8 #include <memory> |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 // API Methods | 53 // API Methods |
| 54 ImageBitmap* transferToImageBitmap(ScriptState*, ExceptionState&); | 54 ImageBitmap* transferToImageBitmap(ScriptState*, ExceptionState&); |
| 55 ScriptPromise convertToBlob(ScriptState*, | 55 ScriptPromise convertToBlob(ScriptState*, |
| 56 const ImageEncodeOptions&, | 56 const ImageEncodeOptions&, |
| 57 ExceptionState&); | 57 ExceptionState&); |
| 58 | 58 |
| 59 const IntSize& Size() const override { return size_; } | 59 const IntSize& Size() const override { return size_; } |
| 60 void SetSize(const IntSize&); | 60 void SetSize(const IntSize&); |
| 61 | 61 |
| 62 void SetPlaceholderCanvasId(int canvas_id) { | 62 void SetPlaceholderCanvasId(unsigned canvas_id) { |
|
ajuma
2017/05/05 13:46:42
uint64_t? (here and below)
chrishtr
2017/05/05 15:37:47
Done.
| |
| 63 placeholder_canvas_id_ = canvas_id; | 63 placeholder_canvas_id_ = canvas_id; |
| 64 } | 64 } |
| 65 int PlaceholderCanvasId() const { return placeholder_canvas_id_; } | 65 unsigned PlaceholderCanvasId() const { return placeholder_canvas_id_; } |
| 66 bool HasPlaceholderCanvas() { | 66 bool HasPlaceholderCanvas() { |
| 67 return placeholder_canvas_id_ != kNoPlaceholderCanvas; | 67 return placeholder_canvas_id_ != kNoPlaceholderCanvas; |
| 68 } | 68 } |
| 69 bool IsNeutered() const { return is_neutered_; } | 69 bool IsNeutered() const { return is_neutered_; } |
| 70 void SetNeutered(); | 70 void SetNeutered(); |
| 71 CanvasRenderingContext* GetCanvasRenderingContext( | 71 CanvasRenderingContext* GetCanvasRenderingContext( |
| 72 ScriptState*, | 72 ScriptState*, |
| 73 const String&, | 73 const String&, |
| 74 const CanvasContextCreationAttributes&); | 74 const CanvasContextCreationAttributes&); |
| 75 CanvasRenderingContext* RenderingContext() { return context_; } | 75 CanvasRenderingContext* RenderingContext() { return context_; } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 void DoCommit(RefPtr<StaticBitmapImage>, bool is_web_gl_software_rendering); | 160 void DoCommit(RefPtr<StaticBitmapImage>, bool is_web_gl_software_rendering); |
| 161 using ContextFactoryVector = | 161 using ContextFactoryVector = |
| 162 Vector<std::unique_ptr<CanvasRenderingContextFactory>>; | 162 Vector<std::unique_ptr<CanvasRenderingContextFactory>>; |
| 163 static ContextFactoryVector& RenderingContextFactories(); | 163 static ContextFactoryVector& RenderingContextFactories(); |
| 164 static CanvasRenderingContextFactory* GetRenderingContextFactory(int); | 164 static CanvasRenderingContextFactory* GetRenderingContextFactory(int); |
| 165 | 165 |
| 166 Member<CanvasRenderingContext> context_; | 166 Member<CanvasRenderingContext> context_; |
| 167 WeakMember<ExecutionContext> execution_context_; | 167 WeakMember<ExecutionContext> execution_context_; |
| 168 | 168 |
| 169 enum { | 169 enum { |
| 170 kNoPlaceholderCanvas = -1, // DOMNodeIds starts from 0, using -1 to | 170 kNoPlaceholderCanvas = 0, // DOMNodeIds starts from 1, using 0 to |
| 171 // indicate no associated canvas element. | 171 // indicate no associated canvas element. |
| 172 }; | 172 }; |
| 173 int placeholder_canvas_id_ = kNoPlaceholderCanvas; | 173 unsigned placeholder_canvas_id_ = kNoPlaceholderCanvas; |
| 174 | 174 |
| 175 IntSize size_; | 175 IntSize size_; |
| 176 bool is_neutered_ = false; | 176 bool is_neutered_ = false; |
| 177 | 177 |
| 178 bool origin_clean_ = true; | 178 bool origin_clean_ = true; |
| 179 bool disable_reading_from_canvas_ = false; | 179 bool disable_reading_from_canvas_ = false; |
| 180 | 180 |
| 181 bool IsPaintable() const; | 181 bool IsPaintable() const; |
| 182 | 182 |
| 183 std::unique_ptr<OffscreenCanvasFrameDispatcher> frame_dispatcher_; | 183 std::unique_ptr<OffscreenCanvasFrameDispatcher> frame_dispatcher_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 194 // If this object is not created via | 194 // If this object is not created via |
| 195 // HTMLCanvasElement.transferControlToOffscreen(), | 195 // HTMLCanvasElement.transferControlToOffscreen(), |
| 196 // then the following members would remain as initialized zero values. | 196 // then the following members would remain as initialized zero values. |
| 197 uint32_t client_id_ = 0; | 197 uint32_t client_id_ = 0; |
| 198 uint32_t sink_id_ = 0; | 198 uint32_t sink_id_ = 0; |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| 202 | 202 |
| 203 #endif // OffscreenCanvas_h | 203 #endif // OffscreenCanvas_h |
| OLD | NEW |