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

Side by Side Diff: services/service_manager/public/cpp/lib/connector_impl.cc

Issue 2589663003: mojo:: Rename mojo::GetProxy() to mojo::MakeRequest() (Closed)
Patch Set: Rebase Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/service_manager/public/cpp/lib/connector_impl.h" 5 #include "services/service_manager/public/cpp/lib/connector_impl.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "services/service_manager/public/cpp/identity.h" 8 #include "services/service_manager/public/cpp/identity.h"
9 #include "services/service_manager/public/cpp/lib/connection_impl.h" 9 #include "services/service_manager/public/cpp/lib/connection_impl.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 std::unique_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) { 44 std::unique_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) {
45 if (!BindIfNecessary()) 45 if (!BindIfNecessary())
46 return nullptr; 46 return nullptr;
47 47
48 DCHECK(thread_checker_.CalledOnValidThread()); 48 DCHECK(thread_checker_.CalledOnValidThread());
49 DCHECK(params); 49 DCHECK(params);
50 50
51 mojom::InterfaceProviderPtr remote_interfaces; 51 mojom::InterfaceProviderPtr remote_interfaces;
52 mojom::InterfaceProviderRequest remote_request = GetProxy(&remote_interfaces); 52 mojom::InterfaceProviderRequest remote_request =
53 MakeRequest(&remote_interfaces);
53 std::unique_ptr<internal::ConnectionImpl> connection( 54 std::unique_ptr<internal::ConnectionImpl> connection(
54 new internal::ConnectionImpl(params->target(), 55 new internal::ConnectionImpl(params->target(),
55 Connection::State::PENDING)); 56 Connection::State::PENDING));
56 if (params->remote_interfaces()) { 57 if (params->remote_interfaces()) {
57 params->remote_interfaces()->Bind(std::move(remote_interfaces)); 58 params->remote_interfaces()->Bind(std::move(remote_interfaces));
58 connection->set_remote_interfaces(params->remote_interfaces()); 59 connection->set_remote_interfaces(params->remote_interfaces());
59 } else { 60 } else {
60 std::unique_ptr<InterfaceProvider> remote_interface_provider( 61 std::unique_ptr<InterfaceProvider> remote_interface_provider(
61 new InterfaceProvider); 62 new InterfaceProvider);
62 remote_interface_provider->Bind(std::move(remote_interfaces)); 63 remote_interface_provider->Bind(std::move(remote_interfaces));
(...skipping 19 matching lines...) Expand all
82 std::move(client_process_connection), 83 std::move(client_process_connection),
83 connection->GetConnectCallback()); 84 connection->GetConnectCallback());
84 return std::move(connection); 85 return std::move(connection);
85 } 86 }
86 87
87 std::unique_ptr<Connector> ConnectorImpl::Clone() { 88 std::unique_ptr<Connector> ConnectorImpl::Clone() {
88 if (!BindIfNecessary()) 89 if (!BindIfNecessary())
89 return nullptr; 90 return nullptr;
90 91
91 mojom::ConnectorPtr connector; 92 mojom::ConnectorPtr connector;
92 mojom::ConnectorRequest request = GetProxy(&connector); 93 mojom::ConnectorRequest request = MakeRequest(&connector);
93 connector_->Clone(std::move(request)); 94 connector_->Clone(std::move(request));
94 return base::MakeUnique<ConnectorImpl>(connector.PassInterface()); 95 return base::MakeUnique<ConnectorImpl>(connector.PassInterface());
95 } 96 }
96 97
97 void ConnectorImpl::BindRequest(mojom::ConnectorRequest request) { 98 void ConnectorImpl::BindRequest(mojom::ConnectorRequest request) {
98 if (!BindIfNecessary()) 99 if (!BindIfNecessary())
99 return; 100 return;
100 connector_->Clone(std::move(request)); 101 connector_->Clone(std::move(request));
101 } 102 }
102 103
(...skipping 15 matching lines...) Expand all
118 connector_.Bind(std::move(unbound_state_)); 119 connector_.Bind(std::move(unbound_state_));
119 connector_.set_connection_error_handler( 120 connector_.set_connection_error_handler(
120 base::Bind(&ConnectorImpl::OnConnectionError, base::Unretained(this))); 121 base::Bind(&ConnectorImpl::OnConnectionError, base::Unretained(this)));
121 } 122 }
122 123
123 return true; 124 return true;
124 } 125 }
125 126
126 std::unique_ptr<Connector> Connector::Create(mojom::ConnectorRequest* request) { 127 std::unique_ptr<Connector> Connector::Create(mojom::ConnectorRequest* request) {
127 mojom::ConnectorPtr proxy; 128 mojom::ConnectorPtr proxy;
128 *request = mojo::GetProxy(&proxy); 129 *request = mojo::MakeRequest(&proxy);
129 return base::MakeUnique<ConnectorImpl>(proxy.PassInterface()); 130 return base::MakeUnique<ConnectorImpl>(proxy.PassInterface());
130 } 131 }
131 132
132 } // namespace service_manager 133 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/connect_util.cc ('k') | services/service_manager/public/cpp/lib/interface_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698