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

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

Issue 845593003: Pass ServiceProvider and ServiceProvider& params in Connect (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: services & exposed_services Created 5 years, 11 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
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/application_impl.h" 5 #include "mojo/public/cpp/application/application_impl.h"
6 6
7 #include "mojo/public/cpp/application/application_delegate.h" 7 #include "mojo/public/cpp/application/application_delegate.h"
8 #include "mojo/public/cpp/application/lib/service_registry.h" 8 #include "mojo/public/cpp/application/lib/service_registry.h"
9 #include "mojo/public/cpp/bindings/interface_ptr.h" 9 #include "mojo/public/cpp/bindings/interface_ptr.h"
10 #include "mojo/public/cpp/environment/logging.h" 10 #include "mojo/public/cpp/environment/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 ApplicationImpl::~ApplicationImpl() { 56 ApplicationImpl::~ApplicationImpl() {
57 ClearConnections(); 57 ClearConnections();
58 delete shell_watch_; 58 delete shell_watch_;
59 } 59 }
60 60
61 ApplicationConnection* ApplicationImpl::ConnectToApplication( 61 ApplicationConnection* ApplicationImpl::ConnectToApplication(
62 const String& application_url) { 62 const String& application_url) {
63 MOJO_CHECK(initialized_); 63 MOJO_CHECK(initialized_);
64 ServiceProviderPtr out_service_provider; 64 ServiceProviderPtr local_services;
65 shell_->ConnectToApplication(application_url, 65 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services);
66 GetProxy(&out_service_provider)); 66 ServiceProviderPtr remote_services;
67 shell_->ConnectToApplication(application_url, GetProxy(&remote_services),
68 local_services.Pass());
67 internal::ServiceRegistry* registry = new internal::ServiceRegistry( 69 internal::ServiceRegistry* registry = new internal::ServiceRegistry(
68 this, application_url, out_service_provider.Pass()); 70 this, application_url, remote_services.Pass(), local_request.Pass());
69 if (!delegate_->ConfigureOutgoingConnection(registry)) { 71 if (!delegate_->ConfigureOutgoingConnection(registry)) {
70 delete registry; 72 delete registry;
71 return nullptr; 73 return nullptr;
72 } 74 }
73 outgoing_service_registries_.push_back(registry); 75 outgoing_service_registries_.push_back(registry);
74 return registry; 76 return registry;
75 } 77 }
76 78
77 bool ApplicationImpl::WaitForInitialize() { 79 bool ApplicationImpl::WaitForInitialize() {
78 MOJO_CHECK(!initialized_); 80 MOJO_CHECK(!initialized_);
(...skipping 13 matching lines...) Expand all
92 delegate_->Initialize(this); 94 delegate_->Initialize(this);
93 } 95 }
94 96
95 void ApplicationImpl::BindShell(ScopedMessagePipeHandle shell_handle) { 97 void ApplicationImpl::BindShell(ScopedMessagePipeHandle shell_handle) {
96 shell_watch_ = new ShellPtrWatcher(this); 98 shell_watch_ = new ShellPtrWatcher(this);
97 shell_.Bind(shell_handle.Pass()); 99 shell_.Bind(shell_handle.Pass());
98 shell_.set_client(this); 100 shell_.set_client(this);
99 shell_.set_error_handler(shell_watch_); 101 shell_.set_error_handler(shell_watch_);
100 } 102 }
101 103
102 void ApplicationImpl::AcceptConnection(const String& requestor_url, 104 void ApplicationImpl::AcceptConnection(
103 ServiceProviderPtr service_provider) { 105 const String& requestor_url,
106 InterfaceRequest<ServiceProvider> services,
107 ServiceProviderPtr exposed_services) {
104 internal::ServiceRegistry* registry = new internal::ServiceRegistry( 108 internal::ServiceRegistry* registry = new internal::ServiceRegistry(
105 this, requestor_url, service_provider.Pass()); 109 this, requestor_url, exposed_services.Pass(), services.Pass());
106 if (!delegate_->ConfigureIncomingConnection(registry)) { 110 if (!delegate_->ConfigureIncomingConnection(registry)) {
107 delete registry; 111 delete registry;
108 return; 112 return;
109 } 113 }
110 incoming_service_registries_.push_back(registry); 114 incoming_service_registries_.push_back(registry);
111 } 115 }
112 116
113 } // namespace mojo 117 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698