 Chromium Code Reviews
 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 #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 "wtf/MathExtras.h" | 11 #include "wtf/MathExtras.h" | 
| 12 | 12 | 
| 13 namespace blink { | 13 namespace blink { | 
| 14 | 14 | 
| 15 OffscreenCanvas::OffscreenCanvas(const IntSize& size) | 15 OffscreenCanvas::OffscreenCanvas(const IntSize& size) | 
| 16 : m_size(size) | 16 : m_size(size) | 
| 17 , m_originClean(true) | |
| 17 { | 18 { | 
| 18 } | 19 } | 
| 19 | 20 | 
| 20 OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height) | 21 OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height) | 
| 21 { | 22 { | 
| 22 return new OffscreenCanvas(IntSize(clampTo<int>(width), clampTo<int>(height) )); | 23 return new OffscreenCanvas(IntSize(clampTo<int>(width), clampTo<int>(height) )); | 
| 23 } | 24 } | 
| 24 | 25 | 
| 25 void OffscreenCanvas::setWidth(unsigned width) | 26 void OffscreenCanvas::setWidth(unsigned width) | 
| 26 { | 27 { | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 } | 96 } | 
| 96 | 97 | 
| 97 void OffscreenCanvas::registerRenderingContextFactory(PassOwnPtr<CanvasRendering ContextFactory> renderingContextFactory) | 98 void OffscreenCanvas::registerRenderingContextFactory(PassOwnPtr<CanvasRendering ContextFactory> renderingContextFactory) | 
| 98 { | 99 { | 
| 99 CanvasRenderingContext::ContextType type = renderingContextFactory->getConte xtType(); | 100 CanvasRenderingContext::ContextType type = renderingContextFactory->getConte xtType(); | 
| 100 ASSERT(type < CanvasRenderingContext::ContextTypeCount); | 101 ASSERT(type < CanvasRenderingContext::ContextTypeCount); | 
| 101 ASSERT(!renderingContextFactories()[type]); | 102 ASSERT(!renderingContextFactories()[type]); | 
| 102 renderingContextFactories()[type] = std::move(renderingContextFactory); | 103 renderingContextFactories()[type] = std::move(renderingContextFactory); | 
| 103 } | 104 } | 
| 104 | 105 | 
| 106 bool OffscreenCanvas::originClean() const | |
| 107 { | |
| 108 // TODO(crbug.com/607575): Make Settings accessable in worker and use | |
| 109 // disableReadingFromCanvas to determine originClean value. | |
| 110 return m_originClean; | |
| 111 } | |
| 112 | |
| 113 SecurityOrigin* OffscreenCanvas::getSecurityOrigin(ScriptState* scriptState) con st | |
| 
Justin Novosad
2016/04/29 04:08:54
This method is not needed
 
xlai (Olivia)
2016/04/29 18:57:01
Removed.
 | |
| 114 { | |
| 115 return scriptState->getExecutionContext()->getSecurityOrigin(); | |
| 116 } | |
| 117 | |
| 105 DEFINE_TRACE(OffscreenCanvas) | 118 DEFINE_TRACE(OffscreenCanvas) | 
| 106 { | 119 { | 
| 107 visitor->trace(m_context); | 120 visitor->trace(m_context); | 
| 108 } | 121 } | 
| 109 | 122 | 
| 110 } // namespace blink | 123 } // namespace blink | 
| OLD | NEW |