| OLD | NEW |
| 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 "mojo/shell/public/cpp/lib/service_connector_registry.h" | 5 #include "mojo/shell/public/cpp/lib/service_connector_registry.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "mojo/shell/public/cpp/service_connector.h" | 9 #include "mojo/shell/public/cpp/service_connector.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const std::string& interface_name) { | 35 const std::string& interface_name) { |
| 36 NameToServiceConnectorMap::iterator it = | 36 NameToServiceConnectorMap::iterator it = |
| 37 name_to_service_connector_.find(interface_name); | 37 name_to_service_connector_.find(interface_name); |
| 38 if (it == name_to_service_connector_.end()) | 38 if (it == name_to_service_connector_.end()) |
| 39 return; | 39 return; |
| 40 delete it->second; | 40 delete it->second; |
| 41 name_to_service_connector_.erase(it); | 41 name_to_service_connector_.erase(it); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void ServiceConnectorRegistry::ConnectToService( | 44 void ServiceConnectorRegistry::ConnectToService( |
| 45 ApplicationConnection* application_connection, | 45 Connection* connection, |
| 46 const std::string& interface_name, | 46 const std::string& interface_name, |
| 47 ScopedMessagePipeHandle client_handle) { | 47 ScopedMessagePipeHandle client_handle) { |
| 48 auto iter = name_to_service_connector_.find(interface_name); | 48 auto iter = name_to_service_connector_.find(interface_name); |
| 49 if (iter != name_to_service_connector_.end()) { | 49 if (iter != name_to_service_connector_.end()) { |
| 50 iter->second->ConnectToService(application_connection, interface_name, | 50 iter->second->ConnectToService(connection, interface_name, |
| 51 std::move(client_handle)); | 51 std::move(client_handle)); |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 if (service_connector_) { | 54 if (service_connector_) { |
| 55 service_connector_->ConnectToService(application_connection, interface_name, | 55 service_connector_->ConnectToService(connection, interface_name, |
| 56 std::move(client_handle)); | 56 std::move(client_handle)); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace internal | 60 } // namespace internal |
| 61 } // namespace mojo | 61 } // namespace mojo |
| OLD | NEW |