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

Side by Side Diff: Source/modules/vr/NavigatorVRDevice.cpp

Issue 1101263003: Oilpan: have Navigator and its supplements be on the heap by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 5 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/vr/NavigatorVRDevice.h ('k') | Source/modules/vr/VRGetDevicesCallback.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "config.h" 5 #include "config.h"
6 #include "modules/vr/NavigatorVRDevice.h" 6 #include "modules/vr/NavigatorVRDevice.h"
7 7
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 15 matching lines...) Expand all
26 NavigatorVRDevice* NavigatorVRDevice::from(Document& document) 26 NavigatorVRDevice* NavigatorVRDevice::from(Document& document)
27 { 27 {
28 if (!document.frame() || !document.frame()->domWindow()) 28 if (!document.frame() || !document.frame()->domWindow())
29 return 0; 29 return 0;
30 Navigator& navigator = *document.frame()->domWindow()->navigator(); 30 Navigator& navigator = *document.frame()->domWindow()->navigator();
31 return &from(navigator); 31 return &from(navigator);
32 } 32 }
33 33
34 NavigatorVRDevice& NavigatorVRDevice::from(Navigator& navigator) 34 NavigatorVRDevice& NavigatorVRDevice::from(Navigator& navigator)
35 { 35 {
36 NavigatorVRDevice* supplement = static_cast<NavigatorVRDevice*>(WillBeHeapSu pplement<Navigator>::from(navigator, supplementName())); 36 NavigatorVRDevice* supplement = static_cast<NavigatorVRDevice*>(HeapSuppleme nt<Navigator>::from(navigator, supplementName()));
37 if (!supplement) { 37 if (!supplement) {
38 supplement = new NavigatorVRDevice(navigator.frame()); 38 supplement = new NavigatorVRDevice(navigator.frame());
39 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); 39 provideTo(navigator, supplementName(), supplement);
40 } 40 }
41 return *supplement; 41 return *supplement;
42 } 42 }
43 43
44 ScriptPromise NavigatorVRDevice::getVRDevices(ScriptState* scriptState, Navigato r& navigator) 44 ScriptPromise NavigatorVRDevice::getVRDevices(ScriptState* scriptState, Navigato r& navigator)
45 { 45 {
46 return NavigatorVRDevice::from(navigator).getVRDevices(scriptState); 46 return NavigatorVRDevice::from(navigator).getVRDevices(scriptState);
47 } 47 }
48 48
49 ScriptPromise NavigatorVRDevice::getVRDevices(ScriptState* scriptState) 49 ScriptPromise NavigatorVRDevice::getVRDevices(ScriptState* scriptState)
(...skipping 19 matching lines...) Expand all
69 if (!frame()) 69 if (!frame())
70 return 0; 70 return 0;
71 71
72 return VRController::from(*frame()); 72 return VRController::from(*frame());
73 } 73 }
74 74
75 DEFINE_TRACE(NavigatorVRDevice) 75 DEFINE_TRACE(NavigatorVRDevice)
76 { 76 {
77 visitor->trace(m_hardwareUnits); 77 visitor->trace(m_hardwareUnits);
78 78
79 WillBeHeapSupplement<Navigator>::trace(visitor); 79 HeapSupplement<Navigator>::trace(visitor);
80 DOMWindowProperty::trace(visitor); 80 DOMWindowProperty::trace(visitor);
81 } 81 }
82 82
83 NavigatorVRDevice::NavigatorVRDevice(LocalFrame* frame) 83 NavigatorVRDevice::NavigatorVRDevice(LocalFrame* frame)
84 : DOMWindowProperty(frame) 84 : DOMWindowProperty(frame)
85 { 85 {
86 m_hardwareUnits = new VRHardwareUnitCollection(controller()); 86 m_hardwareUnits = new VRHardwareUnitCollection(controller());
87 } 87 }
88 88
89 NavigatorVRDevice::~NavigatorVRDevice() 89 NavigatorVRDevice::~NavigatorVRDevice()
90 { 90 {
91 } 91 }
92 92
93 const char* NavigatorVRDevice::supplementName() 93 const char* NavigatorVRDevice::supplementName()
94 { 94 {
95 return "NavigatorVRDevice"; 95 return "NavigatorVRDevice";
96 } 96 }
97 97
98 } // namespace blink 98 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/vr/NavigatorVRDevice.h ('k') | Source/modules/vr/VRGetDevicesCallback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698