OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/common/service_manager/child_connection.h" | 5 #include "content/common/service_manager/child_connection.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void InitializeOnIOThread( | 87 void InitializeOnIOThread( |
88 const service_manager::Identity& child_identity, | 88 const service_manager::Identity& child_identity, |
89 std::unique_ptr<service_manager::Connector> connector, | 89 std::unique_ptr<service_manager::Connector> connector, |
90 mojo::ScopedMessagePipeHandle service_pipe) { | 90 mojo::ScopedMessagePipeHandle service_pipe) { |
91 service_manager::mojom::ServicePtr service; | 91 service_manager::mojom::ServicePtr service; |
92 service.Bind(mojo::InterfacePtrInfo<service_manager::mojom::Service>( | 92 service.Bind(mojo::InterfacePtrInfo<service_manager::mojom::Service>( |
93 std::move(service_pipe), 0u)); | 93 std::move(service_pipe), 0u)); |
94 service_manager::mojom::PIDReceiverRequest pid_receiver_request( | 94 service_manager::mojom::PIDReceiverRequest pid_receiver_request( |
95 &pid_receiver_); | 95 &pid_receiver_); |
96 | 96 |
97 service_manager::Connector::ConnectParams params(child_identity); | 97 if (connector) { |
98 params.set_client_process_connection(std::move(service), | 98 connector->Start(child_identity, |
99 std::move(pid_receiver_request)); | 99 std::move(service), |
100 | 100 std::move(pid_receiver_request)); |
101 // In some unit testing scenarios a null connector is passed. | 101 connection_ = connector->Connect(child_identity); |
102 if (connector) | 102 } |
103 connection_ = connector->Connect(¶ms); | |
104 } | 103 } |
105 | 104 |
106 void ShutDownOnIOThread() { | 105 void ShutDownOnIOThread() { |
107 connection_.reset(); | 106 connection_.reset(); |
108 pid_receiver_.reset(); | 107 pid_receiver_.reset(); |
109 } | 108 } |
110 | 109 |
111 void SetProcessHandleOnIOThread(base::ProcessHandle handle) { | 110 void SetProcessHandleOnIOThread(base::ProcessHandle handle) { |
112 DCHECK(pid_receiver_.is_bound()); | 111 DCHECK(pid_receiver_.is_bound()); |
113 pid_receiver_->SetPID(base::GetProcId(handle)); | 112 pid_receiver_->SetPID(base::GetProcId(handle)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 145 |
147 ChildConnection::~ChildConnection() { | 146 ChildConnection::~ChildConnection() { |
148 context_->ShutDown(); | 147 context_->ShutDown(); |
149 } | 148 } |
150 | 149 |
151 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) { | 150 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) { |
152 context_->SetProcessHandle(handle); | 151 context_->SetProcessHandle(handle); |
153 } | 152 } |
154 | 153 |
155 } // namespace content | 154 } // namespace content |
OLD | NEW |