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/WindowPaintWorklet.h" | 5 #include "modules/csspaint/WindowPaintWorklet.h" |
6 | 6 |
| 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
7 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
8 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
9 #include "modules/csspaint/PaintWorklet.h" | 10 #include "modules/csspaint/PaintWorklet.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 WindowPaintWorklet::WindowPaintWorklet(LocalDOMWindow& window) | 14 WindowPaintWorklet::WindowPaintWorklet(LocalDOMWindow& window) |
14 : DOMWindowProperty(window.frame()) | 15 : DOMWindowProperty(window.frame()) |
15 { | 16 { |
16 } | 17 } |
(...skipping 22 matching lines...) Expand all Loading... |
39 return from(toLocalDOMWindow(window)).paintWorklet(executionContext); | 40 return from(toLocalDOMWindow(window)).paintWorklet(executionContext); |
40 } | 41 } |
41 | 42 |
42 PaintWorklet* WindowPaintWorklet::paintWorklet(ExecutionContext* executionContex
t) const | 43 PaintWorklet* WindowPaintWorklet::paintWorklet(ExecutionContext* executionContex
t) const |
43 { | 44 { |
44 if (!m_paintWorklet && frame()) | 45 if (!m_paintWorklet && frame()) |
45 m_paintWorklet = PaintWorklet::create(frame(), executionContext); | 46 m_paintWorklet = PaintWorklet::create(frame(), executionContext); |
46 return m_paintWorklet.get(); | 47 return m_paintWorklet.get(); |
47 } | 48 } |
48 | 49 |
| 50 void WindowPaintWorklet::willDetachGlobalObjectFromFrame() |
| 51 { |
| 52 if (m_paintWorklet) |
| 53 m_paintWorklet->workletGlobalScope()->scriptController()->dispose(); |
| 54 DOMWindowProperty::willDetachGlobalObjectFromFrame(); |
| 55 } |
| 56 |
49 DEFINE_TRACE(WindowPaintWorklet) | 57 DEFINE_TRACE(WindowPaintWorklet) |
50 { | 58 { |
51 visitor->trace(m_paintWorklet); | 59 visitor->trace(m_paintWorklet); |
52 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); | 60 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); |
53 DOMWindowProperty::trace(visitor); | 61 DOMWindowProperty::trace(visitor); |
54 } | 62 } |
55 | 63 |
56 } // namespace blink | 64 } // namespace blink |
OLD | NEW |