| 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/public/cpp/application/lib/service_registry.h" | 5 #include "mojo/public/cpp/application/lib/service_registry.h" |
| 6 | 6 |
| 7 #include "mojo/public/cpp/application/application_connection.h" | 7 #include "mojo/public/cpp/application/application_connection.h" |
| 8 #include "mojo/public/cpp/application/application_impl.h" | 8 #include "mojo/public/cpp/application/application_impl.h" |
| 9 #include "mojo/public/cpp/application/lib/service_connector.h" | 9 #include "mojo/public/cpp/application/lib/service_connector.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 ServiceRegistry::ServiceRegistry( | 14 ServiceRegistry::ServiceRegistry( |
| 15 ApplicationImpl* application_impl, | 15 ApplicationImpl* application_impl, |
| 16 const std::string& url, | 16 const std::string& url, |
| 17 ServiceProviderPtr remote_services, | 17 ServiceProviderPtr remote_services, |
| 18 InterfaceRequest<ServiceProvider> local_services) | 18 InterfaceRequest<ServiceProvider> local_services) |
| 19 : application_impl_(application_impl), | 19 : application_impl_(application_impl), |
| 20 url_(url), | 20 url_(url), |
| 21 local_binding_(this, local_services.Pass()), | 21 local_binding_(this), |
| 22 remote_service_provider_(remote_services.Pass()) { | 22 remote_service_provider_(remote_services.Pass()) { |
| 23 if (local_services.is_pending()) |
| 24 local_binding_.Bind(local_services.Pass()); |
| 23 } | 25 } |
| 24 | 26 |
| 25 ServiceRegistry::ServiceRegistry() | 27 ServiceRegistry::ServiceRegistry() |
| 26 : application_impl_(nullptr), local_binding_(this) { | 28 : application_impl_(nullptr), local_binding_(this) { |
| 27 } | 29 } |
| 28 | 30 |
| 29 ServiceRegistry::~ServiceRegistry() { | 31 ServiceRegistry::~ServiceRegistry() { |
| 30 for (NameToServiceConnectorMap::iterator i = | 32 for (NameToServiceConnectorMap::iterator i = |
| 31 name_to_service_connector_.begin(); | 33 name_to_service_connector_.begin(); |
| 32 i != name_to_service_connector_.end(); | 34 i != name_to_service_connector_.end(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return; | 84 return; |
| 83 } | 85 } |
| 84 internal::ServiceConnectorBase* service_connector = | 86 internal::ServiceConnectorBase* service_connector = |
| 85 name_to_service_connector_[service_name]; | 87 name_to_service_connector_[service_name]; |
| 86 return service_connector->ConnectToService(service_name, | 88 return service_connector->ConnectToService(service_name, |
| 87 client_handle.Pass()); | 89 client_handle.Pass()); |
| 88 } | 90 } |
| 89 | 91 |
| 90 } // namespace internal | 92 } // namespace internal |
| 91 } // namespace mojo | 93 } // namespace mojo |
| OLD | NEW |