| 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 <memory> | 7 #include <memory> |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "core/fileapi/Blob.h" | 10 #include "core/fileapi/Blob.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 OffscreenCanvas::ContextFactoryVector& | 194 OffscreenCanvas::ContextFactoryVector& |
| 195 OffscreenCanvas::RenderingContextFactories() { | 195 OffscreenCanvas::RenderingContextFactories() { |
| 196 DEFINE_STATIC_LOCAL(ContextFactoryVector, context_factories, | 196 DEFINE_STATIC_LOCAL(ContextFactoryVector, context_factories, |
| 197 (CanvasRenderingContext::kContextTypeCount)); | 197 (CanvasRenderingContext::kContextTypeCount)); |
| 198 return context_factories; | 198 return context_factories; |
| 199 } | 199 } |
| 200 | 200 |
| 201 CanvasRenderingContextFactory* OffscreenCanvas::GetRenderingContextFactory( | 201 CanvasRenderingContextFactory* OffscreenCanvas::GetRenderingContextFactory( |
| 202 int type) { | 202 int type) { |
| 203 ASSERT(type < CanvasRenderingContext::kContextTypeCount); | 203 DCHECK(type < CanvasRenderingContext::kContextTypeCount); |
| 204 return RenderingContextFactories()[type].get(); | 204 return RenderingContextFactories()[type].get(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void OffscreenCanvas::RegisterRenderingContextFactory( | 207 void OffscreenCanvas::RegisterRenderingContextFactory( |
| 208 std::unique_ptr<CanvasRenderingContextFactory> rendering_context_factory) { | 208 std::unique_ptr<CanvasRenderingContextFactory> rendering_context_factory) { |
| 209 CanvasRenderingContext::ContextType type = | 209 CanvasRenderingContext::ContextType type = |
| 210 rendering_context_factory->GetContextType(); | 210 rendering_context_factory->GetContextType(); |
| 211 ASSERT(type < CanvasRenderingContext::kContextTypeCount); | 211 DCHECK(type < CanvasRenderingContext::kContextTypeCount); |
| 212 DCHECK(!RenderingContextFactories()[type]); | 212 DCHECK(!RenderingContextFactories()[type]); |
| 213 RenderingContextFactories()[type] = std::move(rendering_context_factory); | 213 RenderingContextFactories()[type] = std::move(rendering_context_factory); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bool OffscreenCanvas::OriginClean() const { | 216 bool OffscreenCanvas::OriginClean() const { |
| 217 return origin_clean_ && !disable_reading_from_canvas_; | 217 return origin_clean_ && !disable_reading_from_canvas_; |
| 218 } | 218 } |
| 219 | 219 |
| 220 bool OffscreenCanvas::IsPaintable() const { | 220 bool OffscreenCanvas::IsPaintable() const { |
| 221 if (!context_) | 221 if (!context_) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 402 } |
| 403 | 403 |
| 404 DEFINE_TRACE(OffscreenCanvas) { | 404 DEFINE_TRACE(OffscreenCanvas) { |
| 405 visitor->Trace(context_); | 405 visitor->Trace(context_); |
| 406 visitor->Trace(execution_context_); | 406 visitor->Trace(execution_context_); |
| 407 visitor->Trace(commit_promise_resolver_); | 407 visitor->Trace(commit_promise_resolver_); |
| 408 EventTargetWithInlineData::Trace(visitor); | 408 EventTargetWithInlineData::Trace(visitor); |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace blink | 411 } // namespace blink |
| OLD | NEW |