OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "modules/worklet/DOMWindowWorklet.h" | |
6 | |
7 #include "core/frame/LocalDOMWindow.h" | |
8 #include "core/frame/LocalFrame.h" | |
9 #include "modules/worklet/Worklet.h" | |
10 | |
11 namespace blink { | |
12 | |
13 DOMWindowWorklet::DOMWindowWorklet(LocalDOMWindow& window) | |
14 : DOMWindowProperty(window.frame()) | |
15 { | |
16 } | |
17 | |
18 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowWorklet); | |
19 | |
20 const char* DOMWindowWorklet::supplementName() | |
21 { | |
22 return "DOMWindowWorklet"; | |
23 } | |
24 | |
25 // static | |
26 DOMWindowWorklet& DOMWindowWorklet::from(LocalDOMWindow& window) | |
27 { | |
28 DOMWindowWorklet* supplement = static_cast<DOMWindowWorklet*>(WillBeHeapSupp lement<LocalDOMWindow>::from(window, supplementName())); | |
29 if (!supplement) { | |
30 supplement = new DOMWindowWorklet(window); | |
31 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); | |
32 } | |
33 return *supplement; | |
34 } | |
35 | |
36 // static | |
37 Worklet* DOMWindowWorklet::renderWorklet(ExecutionContext* executionContext, DOM Window& window) | |
38 { | |
39 return DOMWindowWorklet::from(toLocalDOMWindow(window)).renderWorklet(execut ionContext); | |
kinuko
2016/01/15 04:19:34
nit: DOMWindowWorklet:: not needed
ikilpatrick
2016/01/15 16:22:44
Done.
| |
40 } | |
41 | |
42 Worklet* DOMWindowWorklet::renderWorklet(ExecutionContext* executionContext) con st | |
43 { | |
44 if (!m_renderWorklet && frame()) | |
45 m_renderWorklet = Worklet::create(executionContext); | |
46 return m_renderWorklet.get(); | |
47 } | |
48 | |
49 DEFINE_TRACE(DOMWindowWorklet) | |
50 { | |
51 visitor->trace(m_renderWorklet); | |
52 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); | |
53 DOMWindowProperty::trace(visitor); | |
54 } | |
55 | |
56 } // namespace blink | |
OLD | NEW |