| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" | 5 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC
ontextOrWebGL2RenderingContext.h" | 7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC
ontextOrWebGL2RenderingContext.h" |
| 8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 DEFINE_TRACE(OffscreenCanvasRenderingContext2D) { | 43 DEFINE_TRACE(OffscreenCanvasRenderingContext2D) { |
| 44 CanvasRenderingContext::trace(visitor); | 44 CanvasRenderingContext::trace(visitor); |
| 45 BaseRenderingContext2D::trace(visitor); | 45 BaseRenderingContext2D::trace(visitor); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void OffscreenCanvasRenderingContext2D::commit(ScriptState* scriptState, | 48 void OffscreenCanvasRenderingContext2D::commit(ScriptState* scriptState, |
| 49 ExceptionState& exceptionState) { | 49 ExceptionState& exceptionState) { |
| 50 UseCounter::Feature feature = UseCounter::OffscreenCanvasCommit2D; | 50 UseCounter::Feature feature = UseCounter::OffscreenCanvasCommit2D; |
| 51 UseCounter::count(scriptState->getExecutionContext(), feature); | 51 UseCounter::count(scriptState->getExecutionContext(), feature); |
| 52 if (getOffscreenCanvas()->getAssociatedCanvasId() < 0) { | 52 if (!getOffscreenCanvas()->hasPlaceholderCanvas()) { |
| 53 // If an OffscreenCanvas has no associated canvas Id, it indicates that | 53 // If an OffscreenCanvas has no associated canvas Id, it indicates that |
| 54 // it is not an OffscreenCanvas created by transfering control from html | 54 // it is not an OffscreenCanvas created by transfering control from html |
| 55 // canvas. | 55 // canvas. |
| 56 exceptionState.throwDOMException(InvalidStateError, | 56 exceptionState.throwDOMException(InvalidStateError, |
| 57 "Commit() was called on a context whose " | 57 "Commit() was called on a context whose " |
| 58 "OffscreenCanvas is not associated with a " | 58 "OffscreenCanvas is not associated with a " |
| 59 "canvas element."); | 59 "canvas element."); |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 double commitStartTime = WTF::monotonicallyIncreasingTime(); | 62 double commitStartTime = WTF::monotonicallyIncreasingTime(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 bool OffscreenCanvasRenderingContext2D::isContextLost() const { | 243 bool OffscreenCanvasRenderingContext2D::isContextLost() const { |
| 244 return false; | 244 return false; |
| 245 } | 245 } |
| 246 | 246 |
| 247 bool OffscreenCanvasRenderingContext2D::isPaintable() const { | 247 bool OffscreenCanvasRenderingContext2D::isPaintable() const { |
| 248 return this->imageBuffer(); | 248 return this->imageBuffer(); |
| 249 } | 249 } |
| 250 } | 250 } |
| OLD | NEW |