Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: third_party/WebKit/Source/modules/worklet/DOMWindowWorklet.cpp

Issue 1510603005: [Do not submit] Worklet implementation. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A basic CompositorWorklet implementation. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/worklet/DOMWindowWorklet.h"
7
8 #include "core/frame/LocalDOMWindow.h"
9 #include "modules/worklet/Worklet.h"
10 #include "modules/worklet/WorkletGlobalScope.h"
11
12 namespace blink {
13
14 DOMWindowWorklet::DOMWindowWorklet(LocalDOMWindow& window)
15 : DOMWindowProperty(window.frame())
16 {
17 }
18
19 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowWorklet);
20
21 const char* DOMWindowWorklet::supplementName()
22 {
23 return "DOMWindowWorklet";
24 }
25
26 // static
27 DOMWindowWorklet& DOMWindowWorklet::from(LocalDOMWindow& window)
28 {
29 DOMWindowWorklet* supplement = static_cast<DOMWindowWorklet*>(WillBeHeapSupp lement<LocalDOMWindow>::from(window, supplementName()));
30 if (!supplement) {
31 supplement = new DOMWindowWorklet(window);
32 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement));
33 }
34 return *supplement;
35 }
36
37 // static
38 Worklet* DOMWindowWorklet::worklet(ExecutionContext* executionContext, DOMWindow & window)
39 {
40 return DOMWindowWorklet::from(toLocalDOMWindow(window)).worklet(executionCon text);
41 }
42
43 Worklet* DOMWindowWorklet::worklet(ExecutionContext* executionContext) const
44 {
45 if (!m_worklet && frame())
46 m_worklet = Worklet::create(executionContext);
47 return m_worklet.get();
48 }
49
50 DEFINE_TRACE(DOMWindowWorklet)
51 {
52 visitor->trace(m_worklet);
53 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor);
54 DOMWindowProperty::trace(visitor);
55 }
56
57 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698