| 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/browser/mojo/mojo_child_connection.h" | 5 #include "content/browser/mojo/mojo_child_connection.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "content/public/common/mojo_shell_connection.h" | 10 #include "content/public/common/mojo_shell_connection.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 client.Bind(mojo::InterfacePtrInfo<shell::mojom::ShellClient>( | 28 client.Bind(mojo::InterfacePtrInfo<shell::mojom::ShellClient>( |
| 29 std::move(shell_client_pipe), 0u)); | 29 std::move(shell_client_pipe), 0u)); |
| 30 shell::mojom::PIDReceiverRequest pid_receiver_request = | 30 shell::mojom::PIDReceiverRequest pid_receiver_request = |
| 31 GetProxy(&pid_receiver_); | 31 GetProxy(&pid_receiver_); |
| 32 | 32 |
| 33 shell::Identity target(application_name, shell::mojom::kInheritUserID, | 33 shell::Identity target(application_name, shell::mojom::kInheritUserID, |
| 34 instance_id); | 34 instance_id); |
| 35 shell::Connector::ConnectParams params(target); | 35 shell::Connector::ConnectParams params(target); |
| 36 params.set_client_process_connection(std::move(client), | 36 params.set_client_process_connection(std::move(client), |
| 37 std::move(pid_receiver_request)); | 37 std::move(pid_receiver_request)); |
| 38 |
| 39 // In some unit testing scenarios a null connector is passed. |
| 40 if (!connector) |
| 41 return; |
| 42 |
| 38 connection_ = connector->Connect(¶ms); | 43 connection_ = connector->Connect(¶ms); |
| 39 #if defined(OS_ANDROID) | 44 #if defined(OS_ANDROID) |
| 40 service_registry_android_ = ServiceRegistryAndroid::Create( | 45 service_registry_android_ = ServiceRegistryAndroid::Create( |
| 41 connection_->GetInterfaceRegistry(), connection_->GetRemoteInterfaces()); | 46 connection_->GetInterfaceRegistry(), connection_->GetRemoteInterfaces()); |
| 42 #endif | 47 #endif |
| 43 } | 48 } |
| 44 | 49 |
| 45 MojoChildConnection::~MojoChildConnection() {} | 50 MojoChildConnection::~MojoChildConnection() {} |
| 46 | 51 |
| 47 void MojoChildConnection::SetProcessHandle(base::ProcessHandle handle) { | 52 void MojoChildConnection::SetProcessHandle(base::ProcessHandle handle) { |
| 48 DCHECK(pid_receiver_.is_bound()); | 53 DCHECK(pid_receiver_.is_bound()); |
| 49 pid_receiver_->SetPID(base::GetProcId(handle)); | 54 pid_receiver_->SetPID(base::GetProcId(handle)); |
| 50 pid_receiver_.reset(); | 55 pid_receiver_.reset(); |
| 51 } | 56 } |
| 52 | 57 |
| 53 } // namespace content | 58 } // namespace content |
| OLD | NEW |