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 26 matching lines...) Expand all Loading... | |
37 if (workerSettings && workerSettings->disableReadingFromCanvas()) | 37 if (workerSettings && workerSettings->disableReadingFromCanvas()) |
38 canvas->setDisableReadingFromCanvasTrue(); | 38 canvas->setDisableReadingFromCanvasTrue(); |
39 } | 39 } |
40 | 40 |
41 DEFINE_TRACE(OffscreenCanvasRenderingContext2D) | 41 DEFINE_TRACE(OffscreenCanvasRenderingContext2D) |
42 { | 42 { |
43 CanvasRenderingContext::trace(visitor); | 43 CanvasRenderingContext::trace(visitor); |
44 BaseRenderingContext2D::trace(visitor); | 44 BaseRenderingContext2D::trace(visitor); |
45 } | 45 } |
46 | 46 |
47 void OffscreenCanvasRenderingContext2D::commit(ExecutionContext* executionContex t) | 47 void OffscreenCanvasRenderingContext2D::commit(ExceptionState& exceptionState) |
48 { | 48 { |
49 if (executionContext->isWorkerGlobalScope()) { | 49 if (getOffscreenCanvas()->getAssociatedCanvasId() < 0) { |
50 // TODO(xlai): implement commit() on worker thread; currently, do | 50 // If an OffscreenCanvas has no associated canvas Id, it indicates that |
51 // nothing for worker thread. See crbug.com/563858. | 51 // it is not an OffscreenCanvas created by transfering control from html |
52 return; | 52 // canvas. |
53 exceptionState.throwDOMException(InvalidStateError, "Commit() has no eff ect if HTMLCanvasElement.transferControlToOffscreen() is not called."); | |
Justin Novosad
2016/09/07 21:40:15
This message is not true: there is an effect, an e
xlai (Olivia)
2016/09/08 15:27:15
Done.
| |
53 } | 54 } |
54 getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame(); | 55 getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame(); |
55 } | 56 } |
56 | 57 |
57 // BaseRenderingContext2D implementation | 58 // BaseRenderingContext2D implementation |
58 bool OffscreenCanvasRenderingContext2D::originClean() const | 59 bool OffscreenCanvasRenderingContext2D::originClean() const |
59 { | 60 { |
60 return getOffscreenCanvas()->originClean(); | 61 return getOffscreenCanvas()->originClean(); |
61 } | 62 } |
62 | 63 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 bool OffscreenCanvasRenderingContext2D::isContextLost() const | 209 bool OffscreenCanvasRenderingContext2D::isContextLost() const |
209 { | 210 { |
210 return false; | 211 return false; |
211 } | 212 } |
212 | 213 |
213 bool OffscreenCanvasRenderingContext2D::isPaintable() const | 214 bool OffscreenCanvasRenderingContext2D::isPaintable() const |
214 { | 215 { |
215 return this->imageBuffer(); | 216 return this->imageBuffer(); |
216 } | 217 } |
217 } | 218 } |
OLD | NEW |