| 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(ApplicationImpl* application_impl, | 14 ServiceRegistry::ServiceRegistry(ApplicationImpl* application_impl, |
| 15 const std::string& url, | 15 const std::string& url, |
| 16 ServiceProviderPtr service_provider) | 16 ServiceProviderPtr service_provider) |
| 17 : application_impl_(application_impl), | 17 : application_impl_(application_impl), |
| 18 url_(url), | 18 url_(url), |
| 19 remote_service_provider_(service_provider.Pass()) { | 19 remote_service_provider_(service_provider.Pass()) { |
| 20 remote_service_provider_.set_client(this); | 20 remote_service_provider_.set_client(this); |
| 21 } | 21 } |
| 22 | 22 |
| 23 ServiceRegistry::ServiceRegistry() : application_impl_(NULL) {} | 23 ServiceRegistry::ServiceRegistry() : application_impl_(nullptr) {} |
| 24 | 24 |
| 25 ServiceRegistry::~ServiceRegistry() { | 25 ServiceRegistry::~ServiceRegistry() { |
| 26 for (NameToServiceConnectorMap::iterator i = | 26 for (NameToServiceConnectorMap::iterator i = |
| 27 name_to_service_connector_.begin(); | 27 name_to_service_connector_.begin(); |
| 28 i != name_to_service_connector_.end(); ++i) { | 28 i != name_to_service_connector_.end(); ++i) { |
| 29 delete i->second; | 29 delete i->second; |
| 30 } | 30 } |
| 31 name_to_service_connector_.clear(); | 31 name_to_service_connector_.clear(); |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 internal::ServiceConnectorBase* service_connector = | 79 internal::ServiceConnectorBase* service_connector = |
| 80 name_to_service_connector_[service_name]; | 80 name_to_service_connector_[service_name]; |
| 81 return service_connector->ConnectToService(service_name, | 81 return service_connector->ConnectToService(service_name, |
| 82 client_handle.Pass()); | 82 client_handle.Pass()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace internal | 85 } // namespace internal |
| 86 } // namespace mojo | 86 } // namespace mojo |
| OLD | NEW |