| 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" |
| 11 #include "core/workers/WorkerSettings.h" | 11 #include "core/workers/WorkerSettings.h" |
| 12 #include "platform/graphics/ImageBuffer.h" | 12 #include "platform/graphics/ImageBuffer.h" |
| 13 #include "platform/graphics/StaticBitmapImage.h" | 13 #include "platform/graphics/StaticBitmapImage.h" |
| 14 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 14 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 15 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" | 15 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" |
| 16 #include "wtf/Assertions.h" | 16 #include "wtf/Assertions.h" |
| 17 #include "wtf/CurrentTime.h" | 17 #include "wtf/CurrentTime.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 OffscreenCanvasRenderingContext2D::~OffscreenCanvasRenderingContext2D() {} | 21 OffscreenCanvasRenderingContext2D::~OffscreenCanvasRenderingContext2D() {} |
| 22 | 22 |
| 23 OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D( | 23 OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D( |
| 24 ScriptState* scriptState, | 24 ScriptState* scriptState, |
| 25 OffscreenCanvas* canvas, | 25 OffscreenCanvas* canvas, |
| 26 const CanvasContextCreationAttributes& attrs) | 26 const CanvasContextCreationAttributes& attrs) |
| 27 : CanvasRenderingContext(nullptr, canvas, attrs) { | 27 : CanvasRenderingContext(nullptr, canvas, attrs) { |
| 28 ExecutionContext* executionContext = scriptState->getExecutionContext(); | 28 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 29 if (executionContext->isDocument()) { | 29 if (executionContext->isDocument()) { |
| 30 if (toDocument(executionContext)->settings()->disableReadingFromCanvas()) | 30 if (toDocument(executionContext)->settings()->getDisableReadingFromCanvas()) |
| 31 canvas->setDisableReadingFromCanvasTrue(); | 31 canvas->setDisableReadingFromCanvasTrue(); |
| 32 return; | 32 return; |
| 33 } | 33 } |
| 34 | 34 |
| 35 WorkerSettings* workerSettings = | 35 WorkerSettings* workerSettings = |
| 36 toWorkerGlobalScope(executionContext)->workerSettings(); | 36 toWorkerGlobalScope(executionContext)->workerSettings(); |
| 37 if (workerSettings && workerSettings->disableReadingFromCanvas()) | 37 if (workerSettings && workerSettings->disableReadingFromCanvas()) |
| 38 canvas->setDisableReadingFromCanvasTrue(); | 38 canvas->setDisableReadingFromCanvasTrue(); |
| 39 } | 39 } |
| 40 | 40 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 bool OffscreenCanvasRenderingContext2D::isContextLost() const { | 251 bool OffscreenCanvasRenderingContext2D::isContextLost() const { |
| 252 return false; | 252 return false; |
| 253 } | 253 } |
| 254 | 254 |
| 255 bool OffscreenCanvasRenderingContext2D::isPaintable() const { | 255 bool OffscreenCanvasRenderingContext2D::isPaintable() const { |
| 256 return this->imageBuffer(); | 256 return this->imageBuffer(); |
| 257 } | 257 } |
| 258 } | 258 } |
| OLD | NEW |