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

Side by Side Diff: third_party/WebKit/Source/modules/vr/NavigatorVR.cpp

Issue 2562323002: Devirtualize Frame::domWindow(). (Closed)
Patch Set: Created 4 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
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 "modules/vr/NavigatorVR.h" 5 #include "modules/vr/NavigatorVR.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/DocumentUserGestureToken.h" 10 #include "core/dom/DocumentUserGestureToken.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DEFINE_TRACE(NavigatorVR) { 90 DEFINE_TRACE(NavigatorVR) {
91 visitor->trace(m_controller); 91 visitor->trace(m_controller);
92 92
93 Supplement<Navigator>::trace(visitor); 93 Supplement<Navigator>::trace(visitor);
94 DOMWindowProperty::trace(visitor); 94 DOMWindowProperty::trace(visitor);
95 PageVisibilityObserver::trace(visitor); 95 PageVisibilityObserver::trace(visitor);
96 } 96 }
97 97
98 NavigatorVR::NavigatorVR(LocalFrame* frame) 98 NavigatorVR::NavigatorVR(LocalFrame* frame)
99 : DOMWindowProperty(frame), PageVisibilityObserver(frame->page()) { 99 : DOMWindowProperty(frame), PageVisibilityObserver(frame->page()) {
100 frame->localDOMWindow()->registerEventListenerObserver(this); 100 frame->domWindow()->registerEventListenerObserver(this);
101 } 101 }
102 102
103 NavigatorVR::~NavigatorVR() {} 103 NavigatorVR::~NavigatorVR() {}
104 104
105 const char* NavigatorVR::supplementName() { 105 const char* NavigatorVR::supplementName() {
106 return "NavigatorVR"; 106 return "NavigatorVR";
107 } 107 }
108 108
109 void NavigatorVR::enqueueVREvent(VRDisplayEvent* event) { 109 void NavigatorVR::enqueueVREvent(VRDisplayEvent* event) {
110 if (frame() && frame()->localDOMWindow()) { 110 // TODO(dcheng): Why does this need to check both frame and domWindow?
111 frame()->localDOMWindow()->enqueueWindowEvent(event); 111 if (frame() && frame()->domWindow()) {
112 frame()->domWindow()->enqueueWindowEvent(event);
112 } 113 }
113 } 114 }
114 115
115 void NavigatorVR::dispatchVRGestureEvent(VRDisplayEvent* event) { 116 void NavigatorVR::dispatchVRGestureEvent(VRDisplayEvent* event) {
116 if (frame() && frame()->localDOMWindow()) { 117 // TODO(dcheng): Why does this need to check both frame and domWindow?
118 if (frame() && frame()->domWindow()) {
117 UserGestureIndicator gestureIndicator( 119 UserGestureIndicator gestureIndicator(
118 DocumentUserGestureToken::create(frame()->document())); 120 DocumentUserGestureToken::create(frame()->document()));
119 event->setTarget(frame()->localDOMWindow()); 121 event->setTarget(frame()->domWindow());
120 frame()->localDOMWindow()->dispatchEvent(event); 122 frame()->domWindow()->dispatchEvent(event);
121 } 123 }
122 } 124 }
123 125
124 void NavigatorVR::pageVisibilityChanged() { 126 void NavigatorVR::pageVisibilityChanged() {
125 if (!page()) 127 if (!page())
126 return; 128 return;
127 if (m_controller) { 129 if (m_controller) {
128 m_controller->setListeningForActivate(page()->isPageVisible() && 130 m_controller->setListeningForActivate(page()->isPageVisible() &&
129 m_listeningForActivate); 131 m_listeningForActivate);
130 } 132 }
(...skipping 21 matching lines...) Expand all
152 } 154 }
153 155
154 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { 156 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) {
155 if (m_controller) { 157 if (m_controller) {
156 m_controller->setListeningForActivate(false); 158 m_controller->setListeningForActivate(false);
157 m_listeningForActivate = false; 159 m_listeningForActivate = false;
158 } 160 }
159 } 161 }
160 162
161 } // namespace blink 163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698