| 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/PaintWorklet.h" | 10 #include "modules/csspaint/PaintWorklet.h" |
| 11 #include "modules/csspaint/WindowPaintWorklet.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, D
ocument& document, Observer* observer) | 16 CSSPaintImageGenerator* CSSPaintImageGeneratorImpl::create(const String& name, D
ocument& document, Observer* observer) |
| 17 { | 17 { |
| 18 LocalDOMWindow* domWindow = document.domWindow(); | 18 LocalDOMWindow* domWindow = document.domWindow(); |
| 19 PaintWorklet* paintWorklet = WindowPaintWorklet::from(*domWindow).paintWorkl
et(&document); | 19 PaintWorklet* paintWorklet = WindowPaintWorklet::from(*domWindow).paintWorkl
et(); |
| 20 | 20 |
| 21 CSSPaintDefinition* paintDefinition = paintWorklet->findDefinition(name); | 21 CSSPaintDefinition* paintDefinition = paintWorklet->findDefinition(name); |
| 22 CSSPaintImageGeneratorImpl* generator; | 22 CSSPaintImageGeneratorImpl* generator; |
| 23 if (!paintDefinition) { | 23 if (!paintDefinition) { |
| 24 generator = new CSSPaintImageGeneratorImpl(observer); | 24 generator = new CSSPaintImageGeneratorImpl(observer); |
| 25 paintWorklet->addPendingGenerator(name, generator); | 25 paintWorklet->addPendingGenerator(name, generator); |
| 26 } else { | 26 } else { |
| 27 generator = new CSSPaintImageGeneratorImpl(paintDefinition); | 27 generator = new CSSPaintImageGeneratorImpl(paintDefinition); |
| 28 } | 28 } |
| 29 | 29 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 DEFINE_TRACE(CSSPaintImageGeneratorImpl) | 78 DEFINE_TRACE(CSSPaintImageGeneratorImpl) |
| 79 { | 79 { |
| 80 visitor->trace(m_definition); | 80 visitor->trace(m_definition); |
| 81 visitor->trace(m_observer); | 81 visitor->trace(m_observer); |
| 82 CSSPaintImageGenerator::trace(visitor); | 82 CSSPaintImageGenerator::trace(visitor); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |