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/shell/public/cpp/lib/service_registry.h" | 5 #include "mojo/shell/public/cpp/lib/service_registry.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "mojo/shell/public/cpp/application_connection.h" | 13 #include "mojo/shell/public/cpp/connection.h" |
14 #include "mojo/shell/public/cpp/service_connector.h" | 14 #include "mojo/shell/public/cpp/service_connector.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 ServiceRegistry::ServiceRegistry( | 19 ServiceRegistry::ServiceRegistry( |
20 const std::string& connection_url, | 20 const std::string& connection_url, |
21 const std::string& remote_url, | 21 const std::string& remote_url, |
22 uint32_t remote_id, | 22 uint32_t remote_id, |
23 ServiceProviderPtr remote_services, | 23 ServiceProviderPtr remote_services, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 void ServiceRegistry::AddRemoteIDCallback(const Closure& callback) { | 101 void ServiceRegistry::AddRemoteIDCallback(const Closure& callback) { |
102 if (remote_ids_valid_) { | 102 if (remote_ids_valid_) { |
103 callback.Run(); | 103 callback.Run(); |
104 return; | 104 return; |
105 } | 105 } |
106 remote_id_callbacks_.push_back(callback); | 106 remote_id_callbacks_.push_back(callback); |
107 } | 107 } |
108 | 108 |
109 base::WeakPtr<ApplicationConnection> ServiceRegistry::GetWeakPtr() { | 109 base::WeakPtr<Connection> ServiceRegistry::GetWeakPtr() { |
110 return weak_factory_.GetWeakPtr(); | 110 return weak_factory_.GetWeakPtr(); |
111 } | 111 } |
112 | 112 |
113 void ServiceRegistry::RemoveServiceConnectorForName( | 113 void ServiceRegistry::RemoveServiceConnectorForName( |
114 const std::string& interface_name) { | 114 const std::string& interface_name) { |
115 service_connector_registry_.RemoveServiceConnectorForName(interface_name); | 115 service_connector_registry_.RemoveServiceConnectorForName(interface_name); |
116 if (service_connector_registry_.empty()) | 116 if (service_connector_registry_.empty()) |
117 remote_service_provider_.reset(); | 117 remote_service_provider_.reset(); |
118 } | 118 } |
119 | 119 |
(...skipping 23 matching lines...) Expand all Loading... |
143 } | 143 } |
144 | 144 |
145 void ServiceRegistry::ConnectToService(const mojo::String& service_name, | 145 void ServiceRegistry::ConnectToService(const mojo::String& service_name, |
146 ScopedMessagePipeHandle client_handle) { | 146 ScopedMessagePipeHandle client_handle) { |
147 service_connector_registry_.ConnectToService(this, service_name, | 147 service_connector_registry_.ConnectToService(this, service_name, |
148 std::move(client_handle)); | 148 std::move(client_handle)); |
149 } | 149 } |
150 | 150 |
151 } // namespace internal | 151 } // namespace internal |
152 } // namespace mojo | 152 } // namespace mojo |
OLD | NEW |