| 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/csspaint/CSSPaintImageGeneratorImpl.h" | 5 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
| 9 #include "modules/csspaint/CSSPaintDefinition.h" | 9 #include "modules/csspaint/CSSPaintDefinition.h" |
| 10 #include "modules/csspaint/CSSPaintWorklet.h" |
| 10 #include "modules/csspaint/PaintWorklet.h" | 11 #include "modules/csspaint/PaintWorklet.h" |
| 11 #include "modules/csspaint/WindowPaintWorklet.h" | |
| 12 #include "platform/graphics/Image.h" | 12 #include "platform/graphics/Image.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 CSSPaintImageGenerator* CSSPaintImageGeneratorImpl::Create(const String& name, | 16 CSSPaintImageGenerator* CSSPaintImageGeneratorImpl::Create(const String& name, |
| 17 Document& document, | 17 Document& document, |
| 18 Observer* observer) { | 18 Observer* observer) { |
| 19 LocalDOMWindow* dom_window = document.domWindow(); | 19 PaintWorklet* paint_worklet = CSSPaintWorklet::paintWorklet(document); |
| 20 PaintWorklet* paint_worklet = | |
| 21 WindowPaintWorklet::From(*dom_window).paintWorklet(); | |
| 22 | 20 |
| 23 CSSPaintDefinition* paint_definition = paint_worklet->FindDefinition(name); | 21 CSSPaintDefinition* paint_definition = paint_worklet->FindDefinition(name); |
| 24 CSSPaintImageGeneratorImpl* generator; | 22 CSSPaintImageGeneratorImpl* generator; |
| 25 if (!paint_definition) { | 23 if (!paint_definition) { |
| 26 generator = new CSSPaintImageGeneratorImpl(observer); | 24 generator = new CSSPaintImageGeneratorImpl(observer); |
| 27 paint_worklet->AddPendingGenerator(name, generator); | 25 paint_worklet->AddPendingGenerator(name, generator); |
| 28 } else { | 26 } else { |
| 29 generator = new CSSPaintImageGeneratorImpl(paint_definition); | 27 generator = new CSSPaintImageGeneratorImpl(paint_definition); |
| 30 } | 28 } |
| 31 | 29 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return definition_; | 82 return definition_; |
| 85 } | 83 } |
| 86 | 84 |
| 87 DEFINE_TRACE(CSSPaintImageGeneratorImpl) { | 85 DEFINE_TRACE(CSSPaintImageGeneratorImpl) { |
| 88 visitor->Trace(definition_); | 86 visitor->Trace(definition_); |
| 89 visitor->Trace(observer_); | 87 visitor->Trace(observer_); |
| 90 CSSPaintImageGenerator::Trace(visitor); | 88 CSSPaintImageGenerator::Trace(visitor); |
| 91 } | 89 } |
| 92 | 90 |
| 93 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |