Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: mojo/public/cpp/application/lib/service_registry.cc

Issue 1968543003: Remove ServiceRegistry's support for exposed services. (Closed) Base URL: https://github.com/domokit/mojo.git@work790
Patch Set: asdf Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/application/lib/service_registry.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
9 #include "mojo/public/cpp/application/service_connector.h" 8 #include "mojo/public/cpp/application/service_connector.h"
10 9
11 namespace mojo { 10 namespace mojo {
12 namespace internal { 11 namespace internal {
13 12
13 ServiceRegistry::ServiceRegistry() : local_binding_(this) {}
14
14 ServiceRegistry::ServiceRegistry( 15 ServiceRegistry::ServiceRegistry(
15 ApplicationImpl* application_impl,
16 const std::string& connection_url, 16 const std::string& connection_url,
17 const std::string& remote_url, 17 const std::string& remote_url,
18 InterfaceHandle<ServiceProvider> remote_services,
19 InterfaceRequest<ServiceProvider> local_services) 18 InterfaceRequest<ServiceProvider> local_services)
20 : application_impl_(application_impl), 19 : connection_url_(connection_url),
21 connection_url_(connection_url),
22 remote_url_(remote_url), 20 remote_url_(remote_url),
23 local_binding_(this), 21 local_binding_(this) {
24 remote_service_provider_(
25 ServiceProviderPtr::Create(std::move(remote_services))) {
26 if (local_services.is_pending()) 22 if (local_services.is_pending())
27 local_binding_.Bind(local_services.Pass()); 23 local_binding_.Bind(local_services.Pass());
28 } 24 }
29 25
30 ServiceRegistry::ServiceRegistry() 26 ServiceRegistry::~ServiceRegistry() {}
31 : application_impl_(nullptr), local_binding_(this) {
32 }
33
34 ServiceRegistry::~ServiceRegistry() {
35 }
36 27
37 void ServiceRegistry::SetServiceConnectorForName( 28 void ServiceRegistry::SetServiceConnectorForName(
38 ServiceConnector* service_connector, 29 ServiceConnector* service_connector,
39 const std::string& interface_name) { 30 const std::string& interface_name) {
40 service_connector_registry_.SetServiceConnectorForName( 31 service_connector_registry_.SetServiceConnectorForName(
41 std::unique_ptr<ServiceConnector>(service_connector), interface_name); 32 std::unique_ptr<ServiceConnector>(service_connector), interface_name);
42 } 33 }
43 34
44 void ServiceRegistry::RemoveServiceConnectorForName( 35 void ServiceRegistry::RemoveServiceConnectorForName(
45 const std::string& interface_name) { 36 const std::string& interface_name) {
46 service_connector_registry_.RemoveServiceConnectorForName(interface_name); 37 service_connector_registry_.RemoveServiceConnectorForName(interface_name);
47 if (service_connector_registry_.empty())
48 remote_service_provider_.reset();
49 } 38 }
50 39
51 const std::string& ServiceRegistry::GetConnectionURL() { 40 const std::string& ServiceRegistry::GetConnectionURL() {
52 return connection_url_; 41 return connection_url_;
53 } 42 }
54 43
55 const std::string& ServiceRegistry::GetRemoteApplicationURL() { 44 const std::string& ServiceRegistry::GetRemoteApplicationURL() {
56 return remote_url_; 45 return remote_url_;
57 } 46 }
58 47
59 void ServiceRegistry::ConnectToService(const mojo::String& service_name, 48 void ServiceRegistry::ConnectToService(const String& service_name,
60 ScopedMessagePipeHandle client_handle) { 49 ScopedMessagePipeHandle client_handle) {
61 service_connector_registry_.ConnectToService(this, service_name, 50 service_connector_registry_.ConnectToService(this, service_name,
62 &client_handle); 51 &client_handle);
63 } 52 }
64 53
65 } // namespace internal 54 } // namespace internal
66 } // namespace mojo 55 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/application/lib/service_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698