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

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

Issue 2629593004: Disambiguate LifecycleObserver::contextDestroyed (Closed)
Patch Set: temp Created 3 years, 11 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
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/VRController.h" 5 #include "modules/vr/VRController.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/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void VRController::onGetDisplays() { 88 void VRController::onGetDisplays() {
89 while (!m_pendingGetDevicesCallbacks.isEmpty()) { 89 while (!m_pendingGetDevicesCallbacks.isEmpty()) {
90 std::unique_ptr<VRGetDevicesCallback> callback = 90 std::unique_ptr<VRGetDevicesCallback> callback =
91 m_pendingGetDevicesCallbacks.takeFirst(); 91 m_pendingGetDevicesCallbacks.takeFirst();
92 callback->onSuccess(m_displays); 92 callback->onSuccess(m_displays);
93 } 93 }
94 } 94 }
95 95
96 void VRController::contextDestroyed() { 96 void VRController::contextDestroyed(ExecutionContext*) {
97 dispose(); 97 dispose();
98 } 98 }
99 99
100 void VRController::dispose() { 100 void VRController::dispose() {
101 // If the document context was destroyed, shut down the client connection 101 // If the document context was destroyed, shut down the client connection
102 // and never call the mojo service again. 102 // and never call the mojo service again.
103 m_service.reset(); 103 m_service.reset();
104 m_binding.Close(); 104 m_binding.Close();
105 105
106 // Shutdown all displays' message pipe 106 // Shutdown all displays' message pipe
107 for (size_t i = 0; i < m_displays.size(); ++i) 107 for (size_t i = 0; i < m_displays.size(); ++i)
108 m_displays[i]->dispose(); 108 m_displays[i]->dispose();
109 } 109 }
110 110
111 DEFINE_TRACE(VRController) { 111 DEFINE_TRACE(VRController) {
112 visitor->trace(m_navigatorVR); 112 visitor->trace(m_navigatorVR);
113 visitor->trace(m_displays); 113 visitor->trace(m_displays);
114 114
115 ContextLifecycleObserver::trace(visitor); 115 ContextLifecycleObserver::trace(visitor);
116 } 116 }
117 117
118 } // namespace blink 118 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRController.h ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698