| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/application/public/cpp/application_impl.h" | 5 #include "mojo/application/public/cpp/application_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, | 41 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, |
| 42 InterfaceRequest<Application> request) | 42 InterfaceRequest<Application> request) |
| 43 : ApplicationImpl(delegate, request.Pass(), | 43 : ApplicationImpl(delegate, request.Pass(), |
| 44 base::Bind(&DefaultTerminationClosure)) { | 44 base::Bind(&DefaultTerminationClosure)) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, | 47 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, |
| 48 InterfaceRequest<Application> request, | 48 InterfaceRequest<Application> request, |
| 49 const base::Closure& termination_closure) | 49 const Closure& termination_closure) |
| 50 : delegate_(delegate), | 50 : delegate_(delegate), |
| 51 binding_(this, request.Pass()), | 51 binding_(this, request.Pass()), |
| 52 termination_closure_(termination_closure), | 52 termination_closure_(termination_closure), |
| 53 app_lifetime_helper_(this), | 53 app_lifetime_helper_(this), |
| 54 quit_requested_(false), | 54 quit_requested_(false), |
| 55 in_destructor_(false), | 55 in_destructor_(false), |
| 56 weak_factory_(this) { | 56 weak_factory_(this) {} |
| 57 } | |
| 58 | 57 |
| 59 void ApplicationImpl::ClearConnections() { | 58 void ApplicationImpl::ClearConnections() { |
| 60 // Copy the ServiceRegistryLists because they will be mutated by | 59 // Copy the ServiceRegistryLists because they will be mutated by |
| 61 // ApplicationConnection::CloseConnection. | 60 // ApplicationConnection::CloseConnection. |
| 62 ServiceRegistryList incoming_service_registries(incoming_service_registries_); | 61 ServiceRegistryList incoming_service_registries(incoming_service_registries_); |
| 63 for (internal::ServiceRegistry* registry : incoming_service_registries) | 62 for (internal::ServiceRegistry* registry : incoming_service_registries) |
| 64 registry->CloseConnection(); | 63 registry->CloseConnection(); |
| 65 DCHECK(incoming_service_registries_.empty()); | 64 DCHECK(incoming_service_registries_.empty()); |
| 66 | 65 |
| 67 ServiceRegistryList outgoing_service_registries(outgoing_service_registries_); | 66 ServiceRegistryList outgoing_service_registries(outgoing_service_registries_); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // than the one to the shell. | 195 // than the one to the shell. |
| 197 bool quit_now = delegate_->OnShellConnectionError(); | 196 bool quit_now = delegate_->OnShellConnectionError(); |
| 198 if (quit_now) | 197 if (quit_now) |
| 199 QuitNow(); | 198 QuitNow(); |
| 200 if (!ptr) | 199 if (!ptr) |
| 201 return; | 200 return; |
| 202 shell_ = nullptr; | 201 shell_ = nullptr; |
| 203 } | 202 } |
| 204 | 203 |
| 205 } // namespace mojo | 204 } // namespace mojo |
| OLD | NEW |