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" |
| 10 #include "core/workers/WorkerGlobalScope.h" |
| 11 #include "core/workers/WorkerSettings.h" |
9 #include "platform/graphics/ImageBuffer.h" | 12 #include "platform/graphics/ImageBuffer.h" |
10 #include "platform/graphics/StaticBitmapImage.h" | 13 #include "platform/graphics/StaticBitmapImage.h" |
11 #include "wtf/Assertions.h" | 14 #include "wtf/Assertions.h" |
12 | 15 |
13 #define UNIMPLEMENTED ASSERT_NOT_REACHED | 16 #define UNIMPLEMENTED ASSERT_NOT_REACHED |
14 | 17 |
15 namespace blink { | 18 namespace blink { |
16 | 19 |
17 OffscreenCanvasRenderingContext2D::~OffscreenCanvasRenderingContext2D() | 20 OffscreenCanvasRenderingContext2D::~OffscreenCanvasRenderingContext2D() |
18 { | 21 { |
19 } | 22 } |
20 | 23 |
21 OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D(OffscreenCa
nvas* canvas, const CanvasContextCreationAttributes& attrs) | 24 OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D(ScriptState
* scriptState, OffscreenCanvas* canvas, const CanvasContextCreationAttributes& a
ttrs) |
22 : CanvasRenderingContext(nullptr, canvas) | 25 : CanvasRenderingContext(nullptr, canvas) |
23 , m_hasAlpha(attrs.alpha()) | 26 , m_hasAlpha(attrs.alpha()) |
24 { | 27 { |
| 28 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 29 if (executionContext->isDocument()) { |
| 30 if (toDocument(executionContext)->settings()->disableReadingFromCanvas()
) |
| 31 canvas->setDisableReadingFromCanvasTrue(); |
| 32 return; |
| 33 } |
| 34 |
| 35 WorkerSettings* workerSettings = toWorkerGlobalScope(executionContext)->work
erSettings(); |
| 36 if (workerSettings && workerSettings->disableReadingFromCanvas()) |
| 37 canvas->setDisableReadingFromCanvasTrue(); |
25 } | 38 } |
26 | 39 |
27 DEFINE_TRACE(OffscreenCanvasRenderingContext2D) | 40 DEFINE_TRACE(OffscreenCanvasRenderingContext2D) |
28 { | 41 { |
29 CanvasRenderingContext::trace(visitor); | 42 CanvasRenderingContext::trace(visitor); |
30 BaseRenderingContext2D::trace(visitor); | 43 BaseRenderingContext2D::trace(visitor); |
31 } | 44 } |
32 | 45 |
33 // BaseRenderingContext2D implementation | 46 // BaseRenderingContext2D implementation |
34 bool OffscreenCanvasRenderingContext2D::originClean() const | 47 bool OffscreenCanvasRenderingContext2D::originClean() const |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 170 } |
158 #endif | 171 #endif |
159 } | 172 } |
160 | 173 |
161 bool OffscreenCanvasRenderingContext2D::isContextLost() const | 174 bool OffscreenCanvasRenderingContext2D::isContextLost() const |
162 { | 175 { |
163 return false; | 176 return false; |
164 } | 177 } |
165 | 178 |
166 } | 179 } |
OLD | NEW |