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

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

Issue 2019973002: [mojo-edk] Bind a child token to child launches and port reservations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 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/shell_client.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 : shell_client_token_(mojo::edk::GenerateRandomToken()) { 22 : shell_client_token_(mojo::edk::GenerateRandomToken()) {
22 mojo::ScopedMessagePipeHandle shell_client_pipe = 23 mojo::ScopedMessagePipeHandle shell_client_pipe =
23 mojo::edk::CreateParentMessagePipe(shell_client_token_); 24 mojo::edk::CreateParentMessagePipe(shell_client_token_, child_token);
24 25
25 // Some process types get created before the main message loop. In this case 26 // Some process types get created before the main message loop. In this case
26 // the shell request pipe will simply be closed, and the child can detect 27 // the shell request pipe will simply be closed, and the child can detect
27 // this. 28 // this.
28 if (!MojoShellConnection::Get()) 29 if (!MojoShellConnection::Get())
29 return; 30 return;
30 31
31 shell::mojom::ShellClientPtr client; 32 shell::mojom::ShellClientPtr client;
32 client.Bind(mojo::InterfacePtrInfo<shell::mojom::ShellClient>( 33 client.Bind(mojo::InterfacePtrInfo<shell::mojom::ShellClient>(
33 std::move(shell_client_pipe), 0u)); 34 std::move(shell_client_pipe), 0u));
(...skipping 10 matching lines...) Expand all
44 45
45 MojoChildConnection::~MojoChildConnection() {} 46 MojoChildConnection::~MojoChildConnection() {}
46 47
47 void MojoChildConnection::SetProcessHandle(base::ProcessHandle handle) { 48 void MojoChildConnection::SetProcessHandle(base::ProcessHandle handle) {
48 DCHECK(pid_receiver_.is_bound()); 49 DCHECK(pid_receiver_.is_bound());
49 pid_receiver_->SetPID(base::GetProcId(handle)); 50 pid_receiver_->SetPID(base::GetProcId(handle));
50 pid_receiver_.reset(); 51 pid_receiver_.reset();
51 } 52 }
52 53
53 } // namespace content 54 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_child_connection.h ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698