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

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

Issue 2294963002: Submit Compositor Frame from OffscreenCanvas on main (Closed)
Patch Set: update global interface listing 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 #include "core/offscreencanvas/OffscreenCanvas.h" 5 #include "core/offscreencanvas/OffscreenCanvas.h"
6 6
7 #include "core/dom/ExceptionCode.h" 7 #include "core/dom/ExceptionCode.h"
8 #include "core/html/canvas/CanvasContextCreationAttributes.h" 8 #include "core/html/canvas/CanvasContextCreationAttributes.h"
9 #include "core/html/canvas/CanvasRenderingContext.h" 9 #include "core/html/canvas/CanvasRenderingContext.h"
10 #include "core/html/canvas/CanvasRenderingContextFactory.h" 10 #include "core/html/canvas/CanvasRenderingContextFactory.h"
11 #include "platform/graphics/ImageBuffer.h" 11 #include "platform/graphics/ImageBuffer.h"
12 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h"
12 #include "wtf/MathExtras.h" 13 #include "wtf/MathExtras.h"
13 #include <memory> 14 #include <memory>
14 15
15 namespace blink { 16 namespace blink {
16 17
17 OffscreenCanvas::OffscreenCanvas(const IntSize& size) 18 OffscreenCanvas::OffscreenCanvas(const IntSize& size)
18 : m_size(size) 19 : m_size(size)
19 , m_originClean(true) 20 , m_originClean(true)
20 { 21 {
21 } 22 }
22 23
23 OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height) 24 OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height)
24 { 25 {
25 return new OffscreenCanvas(IntSize(clampTo<int>(width), clampTo<int>(height) )); 26 return new OffscreenCanvas(IntSize(clampTo<int>(width), clampTo<int>(height) ));
26 } 27 }
27 28
28 void OffscreenCanvas::setWidth(unsigned width) 29 void OffscreenCanvas::setWidth(unsigned width)
29 { 30 {
30 m_size.setWidth(clampTo<int>(width)); 31 m_size.setWidth(clampTo<int>(width));
danakj 2016/09/02 21:53:50 While I'm reading this code, can you explain why t
xlai (Olivia) 2016/09/02 23:41:28 You're right. I also feel that it's illogical to h
31 } 32 }
32 33
33 void OffscreenCanvas::setHeight(unsigned height) 34 void OffscreenCanvas::setHeight(unsigned height)
34 { 35 {
35 m_size.setHeight(clampTo<int>(height)); 36 m_size.setHeight(clampTo<int>(height));
36 } 37 }
37 38
38 void OffscreenCanvas::setNeutered() 39 void OffscreenCanvas::setNeutered()
39 { 40 {
40 ASSERT(!m_context); 41 ASSERT(!m_context);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return m_originClean && !m_disableReadingFromCanvas; 128 return m_originClean && !m_disableReadingFromCanvas;
128 } 129 }
129 130
130 bool OffscreenCanvas::isPaintable() const 131 bool OffscreenCanvas::isPaintable() const
131 { 132 {
132 if (!m_context) 133 if (!m_context)
133 return ImageBuffer::canCreateImageBuffer(m_size); 134 return ImageBuffer::canCreateImageBuffer(m_size);
134 return m_context->isPaintable(); 135 return m_context->isPaintable();
135 } 136 }
136 137
138 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher()
139 {
140 if (!m_frameDispatcher)
141 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_ clientId, m_localId, m_nonce, width(), height()));
142 return m_frameDispatcher.get();
143 }
144
137 DEFINE_TRACE(OffscreenCanvas) 145 DEFINE_TRACE(OffscreenCanvas)
138 { 146 {
139 visitor->trace(m_context); 147 visitor->trace(m_context);
140 } 148 }
141 149
142 } // namespace blink 150 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698