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

Side by Side Diff: content/browser/mojo/mojo_child_connection.cc

Issue 2118083002: ShellClient -> Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus2
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « content/browser/mojo/mojo_child_connection.h ('k') | content/browser/mojo/mojo_shell_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "mojo/edk/embedder/embedder.h" 11 #include "mojo/edk/embedder/embedder.h"
12 #include "mojo/public/cpp/system/message_pipe.h" 12 #include "mojo/public/cpp/system/message_pipe.h"
13 #include "services/shell/public/cpp/connector.h" 13 #include "services/shell/public/cpp/connector.h"
14 #include "services/shell/public/cpp/identity.h" 14 #include "services/shell/public/cpp/identity.h"
15 #include "services/shell/public/interfaces/shell_client.mojom.h" 15 #include "services/shell/public/interfaces/service.mojom.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 MojoChildConnection::MojoChildConnection(const std::string& application_name, 19 MojoChildConnection::MojoChildConnection(const std::string& application_name,
20 const std::string& instance_id, 20 const std::string& instance_id,
21 const std::string& child_token, 21 const std::string& child_token,
22 shell::Connector* connector) 22 shell::Connector* connector)
23 : shell_client_token_(mojo::edk::GenerateRandomToken()) { 23 : service_token_(mojo::edk::GenerateRandomToken()) {
24 mojo::ScopedMessagePipeHandle shell_client_pipe = 24 mojo::ScopedMessagePipeHandle service_pipe =
25 mojo::edk::CreateParentMessagePipe(shell_client_token_, child_token); 25 mojo::edk::CreateParentMessagePipe(service_token_, child_token);
26 26
27 shell::mojom::ShellClientPtr client; 27 shell::mojom::ServicePtr service;
28 client.Bind(mojo::InterfacePtrInfo<shell::mojom::ShellClient>( 28 service.Bind(mojo::InterfacePtrInfo<shell::mojom::Service>(
29 std::move(shell_client_pipe), 0u)); 29 std::move(service_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(service),
37 std::move(pid_receiver_request)); 37 std::move(pid_receiver_request));
38 38
39 // In some unit testing scenarios a null connector is passed. 39 // In some unit testing scenarios a null connector is passed.
40 if (!connector) 40 if (!connector)
41 return; 41 return;
42 42
43 connection_ = connector->Connect(&params); 43 connection_ = connector->Connect(&params);
44 #if defined(OS_ANDROID) 44 #if defined(OS_ANDROID)
45 service_registry_android_ = ServiceRegistryAndroid::Create( 45 service_registry_android_ = ServiceRegistryAndroid::Create(
46 connection_->GetInterfaceRegistry(), connection_->GetRemoteInterfaces()); 46 connection_->GetInterfaceRegistry(), connection_->GetRemoteInterfaces());
47 #endif 47 #endif
48 } 48 }
49 49
50 MojoChildConnection::~MojoChildConnection() {} 50 MojoChildConnection::~MojoChildConnection() {}
51 51
52 void MojoChildConnection::SetProcessHandle(base::ProcessHandle handle) { 52 void MojoChildConnection::SetProcessHandle(base::ProcessHandle handle) {
53 DCHECK(pid_receiver_.is_bound()); 53 DCHECK(pid_receiver_.is_bound());
54 pid_receiver_->SetPID(base::GetProcId(handle)); 54 pid_receiver_->SetPID(base::GetProcId(handle));
55 pid_receiver_.reset(); 55 pid_receiver_.reset();
56 } 56 }
57 57
58 } // namespace content 58 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_child_connection.h ('k') | content/browser/mojo/mojo_shell_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698