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

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

Issue 2552703006: Remove clearContext() from VRController::contextDestroyed (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
« no previous file with comments | « no previous file | no next file » | 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 "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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void VRController::onGetDisplays() { 89 void VRController::onGetDisplays() {
90 while (!m_pendingGetDevicesCallbacks.isEmpty()) { 90 while (!m_pendingGetDevicesCallbacks.isEmpty()) {
91 std::unique_ptr<VRGetDevicesCallback> callback = 91 std::unique_ptr<VRGetDevicesCallback> callback =
92 m_pendingGetDevicesCallbacks.takeFirst(); 92 m_pendingGetDevicesCallbacks.takeFirst();
93 callback->onSuccess(m_displays); 93 callback->onSuccess(m_displays);
94 } 94 }
95 } 95 }
96 96
97 void VRController::contextDestroyed() { 97 void VRController::contextDestroyed() {
98 dispose(); 98 dispose();
99 // The context is not automatically cleared, so do it manually.
100 ContextLifecycleObserver::clearContext();
101 } 99 }
102 100
103 void VRController::dispose() { 101 void VRController::dispose() {
104 // If the document context was destroyed, shut down the client connection 102 // If the document context was destroyed, shut down the client connection
105 // and never call the mojo service again. 103 // and never call the mojo service again.
106 m_service.reset(); 104 m_service.reset();
107 m_binding.Close(); 105 m_binding.Close();
108 106
109 // Shutdown all displays' message pipe 107 // Shutdown all displays' message pipe
110 for (size_t i = 0; i < m_displays.size(); ++i) 108 for (size_t i = 0; i < m_displays.size(); ++i)
111 m_displays[i]->dispose(); 109 m_displays[i]->dispose();
112 } 110 }
113 111
114 DEFINE_TRACE(VRController) { 112 DEFINE_TRACE(VRController) {
115 visitor->trace(m_navigatorVR); 113 visitor->trace(m_navigatorVR);
116 visitor->trace(m_displays); 114 visitor->trace(m_displays);
117 115
118 ContextLifecycleObserver::trace(visitor); 116 ContextLifecycleObserver::trace(visitor);
119 } 117 }
120 118
121 } // namespace blink 119 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698