OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/common/mojo/mojo_shell_connection_impl.h" | 5 #include "content/common/mojo/mojo_shell_connection_impl.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 171 } |
172 | 172 |
173 void ShutDownOnIOThread() { | 173 void ShutDownOnIOThread() { |
174 DCHECK(io_thread_checker_.CalledOnValidThread()); | 174 DCHECK(io_thread_checker_.CalledOnValidThread()); |
175 | 175 |
176 weak_factory_.InvalidateWeakPtrs(); | 176 weak_factory_.InvalidateWeakPtrs(); |
177 | 177 |
178 // Note that this method may be invoked by MessageLoopObserver observing | 178 // Note that this method may be invoked by MessageLoopObserver observing |
179 // MessageLoop destruction. In that case, this call to ShutDown is | 179 // MessageLoop destruction. In that case, this call to ShutDown is |
180 // effectively a no-op. In any case it's safe. | 180 // effectively a no-op. In any case it's safe. |
181 message_loop_observer_->ShutDown(); | 181 if (message_loop_observer_) { |
182 message_loop_observer_ = nullptr; | 182 message_loop_observer_->ShutDown(); |
| 183 message_loop_observer_ = nullptr; |
| 184 } |
183 | 185 |
184 // Resetting the ServiceContext below may otherwise release the last | 186 // Resetting the ServiceContext below may otherwise release the last |
185 // reference to this IOThreadContext. We keep it alive until the stack | 187 // reference to this IOThreadContext. We keep it alive until the stack |
186 // unwinds. | 188 // unwinds. |
187 scoped_refptr<IOThreadContext> keepalive(this); | 189 scoped_refptr<IOThreadContext> keepalive(this); |
188 | 190 |
189 factory_bindings_.CloseAllBindings(); | 191 factory_bindings_.CloseAllBindings(); |
190 service_context_.reset(); | 192 service_context_.reset(); |
191 | 193 |
192 base::AutoLock lock(lock_); | 194 base::AutoLock lock(lock_); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 490 |
489 void MojoShellConnectionImpl::GetInterface( | 491 void MojoShellConnectionImpl::GetInterface( |
490 shell::mojom::InterfaceProvider* provider, | 492 shell::mojom::InterfaceProvider* provider, |
491 const std::string& interface_name, | 493 const std::string& interface_name, |
492 mojo::ScopedMessagePipeHandle request_handle) { | 494 mojo::ScopedMessagePipeHandle request_handle) { |
493 provider->GetInterface(interface_name, std::move(request_handle)); | 495 provider->GetInterface(interface_name, std::move(request_handle)); |
494 } | 496 } |
495 | 497 |
496 } // namespace content | 498 } // namespace content |
497 | 499 |
OLD | NEW |