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

Side by Side Diff: mojo/shell/public/cpp/lib/connector_impl.cc

Issue 1801963002: Change primordial pipes to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase onto catalog CL Created 4 years, 9 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 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 "mojo/shell/public/cpp/lib/connector_impl.h" 5 #include "mojo/shell/public/cpp/lib/connector_impl.h"
6 6
7 #include "mojo/shell/public/cpp/identity.h" 7 #include "mojo/shell/public/cpp/identity.h"
8 #include "mojo/shell/public/cpp/lib/connection_impl.h" 8 #include "mojo/shell/public/cpp/lib/connection_impl.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 shell::mojom::InterfaceProviderRequest local_request = 52 shell::mojom::InterfaceProviderRequest local_request =
53 GetProxy(&local_interfaces); 53 GetProxy(&local_interfaces);
54 shell::mojom::InterfaceProviderPtr remote_interfaces; 54 shell::mojom::InterfaceProviderPtr remote_interfaces;
55 shell::mojom::InterfaceProviderRequest remote_request = 55 shell::mojom::InterfaceProviderRequest remote_request =
56 GetProxy(&remote_interfaces); 56 GetProxy(&remote_interfaces);
57 scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl( 57 scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl(
58 params->target().name(), params->target(), 58 params->target().name(), params->target(),
59 shell::mojom::kInvalidInstanceID, std::move(remote_interfaces), 59 shell::mojom::kInvalidInstanceID, std::move(remote_interfaces),
60 std::move(local_request), request, Connection::State::PENDING)); 60 std::move(local_request), request, Connection::State::PENDING));
61 61
62 shell::mojom::ShellClientFactoryPtr shell_client_factory; 62 shell::mojom::ShellClientPtr shell_client;
63 shell::mojom::PIDReceiverRequest pid_receiver_request; 63 shell::mojom::PIDReceiverRequest pid_receiver_request;
64 params->TakeClientProcessConnection(&shell_client_factory, 64 params->TakeClientProcessConnection(&shell_client, &pid_receiver_request);
65 &pid_receiver_request);
66 shell::mojom::ClientProcessConnectionPtr client_process_connection; 65 shell::mojom::ClientProcessConnectionPtr client_process_connection;
67 if (shell_client_factory.is_bound() && pid_receiver_request.is_pending()) { 66 if (shell_client.is_bound() && pid_receiver_request.is_pending()) {
68 client_process_connection = shell::mojom::ClientProcessConnection::New(); 67 client_process_connection = shell::mojom::ClientProcessConnection::New();
69 client_process_connection->shell_client_factory = 68 client_process_connection->shell_client =
70 shell_client_factory.PassInterface().PassHandle(); 69 shell_client.PassInterface().PassHandle();
71 client_process_connection->pid_receiver_request = 70 client_process_connection->pid_receiver_request =
72 pid_receiver_request.PassMessagePipe(); 71 pid_receiver_request.PassMessagePipe();
73 } else if (shell_client_factory.is_bound() || 72 } else if (shell_client.is_bound() || pid_receiver_request.is_pending()) {
74 pid_receiver_request.is_pending()) { 73 NOTREACHED() << "If one of shell_client or pid_receiver_request is valid, "
75 NOTREACHED() << "If one of shell_client_factory or pid_receiver_request is" 74 << "both must be valid.";
76 << "valid, both must be valid.";
77 return std::move(registry); 75 return std::move(registry);
78 } 76 }
79 connector_->Connect( 77 connector_->Connect(
80 shell::mojom::Identity::From(params->target()), 78 shell::mojom::Identity::From(params->target()),
81 std::move(remote_request), std::move(local_interfaces), 79 std::move(remote_request), std::move(local_interfaces),
82 std::move(client_process_connection), registry->GetConnectCallback()); 80 std::move(client_process_connection), registry->GetConnectCallback());
83 return std::move(registry); 81 return std::move(registry);
84 } 82 }
85 83
86 scoped_ptr<Connector> ConnectorImpl::Clone() { 84 scoped_ptr<Connector> ConnectorImpl::Clone() {
87 shell::mojom::ConnectorPtr connector; 85 shell::mojom::ConnectorPtr connector;
88 connector_->Clone(GetProxy(&connector)); 86 connector_->Clone(GetProxy(&connector));
89 return make_scoped_ptr( 87 return make_scoped_ptr(
90 new ConnectorImpl(connector.PassInterface())); 88 new ConnectorImpl(connector.PassInterface()));
91 } 89 }
92 90
93 } // namespace mojo 91 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/lib/application_test_base.cc ('k') | mojo/shell/public/cpp/lib/shell_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698