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

Side by Side Diff: mojo/runner/child_process_host.cc

Issue 1264463005: mandoline sandbox: prewarm libraries before we raise the sandbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: And Android, too! Created 5 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/runner/child_process_host.h" 5 #include "mojo/runner/child_process_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return rv; 75 return rv;
76 } 76 }
77 77
78 void ChildProcessHost::StartApp( 78 void ChildProcessHost::StartApp(
79 InterfaceRequest<Application> application_request, 79 InterfaceRequest<Application> application_request,
80 const ChildController::StartAppCallback& on_app_complete) { 80 const ChildController::StartAppCallback& on_app_complete) {
81 DCHECK(controller_); 81 DCHECK(controller_);
82 82
83 on_app_complete_ = on_app_complete; 83 on_app_complete_ = on_app_complete;
84 controller_->StartApp( 84 controller_->StartApp(
85 app_path_.AsUTF8Unsafe(), clean_app_path_, application_request.Pass(), 85 application_request.Pass(),
86 base::Bind(&ChildProcessHost::AppCompleted, base::Unretained(this))); 86 base::Bind(&ChildProcessHost::AppCompleted, base::Unretained(this)));
87 } 87 }
88 88
89 void ChildProcessHost::ExitNow(int32_t exit_code) { 89 void ChildProcessHost::ExitNow(int32_t exit_code) {
90 DCHECK(controller_); 90 DCHECK(controller_);
91 91
92 controller_->ExitNow(exit_code); 92 controller_->ExitNow(exit_code);
93 } 93 }
94 94
95 void ChildProcessHost::DidStart(bool success) { 95 void ChildProcessHost::DidStart(bool success) {
96 DVLOG(2) << "ChildProcessHost::DidStart()"; 96 DVLOG(2) << "ChildProcessHost::DidStart()";
97 97
98 if (!success) { 98 if (!success) {
99 LOG(ERROR) << "Failed to start child process"; 99 LOG(ERROR) << "Failed to start child process";
100 AppCompleted(MOJO_RESULT_UNKNOWN); 100 AppCompleted(MOJO_RESULT_UNKNOWN);
101 return; 101 return;
102 } 102 }
103 } 103 }
104 104
105 bool ChildProcessHost::DoLaunch() { 105 bool ChildProcessHost::DoLaunch() {
106 const base::CommandLine* parent_command_line = 106 const base::CommandLine* parent_command_line =
107 base::CommandLine::ForCurrentProcess(); 107 base::CommandLine::ForCurrentProcess();
108 base::CommandLine child_command_line(parent_command_line->GetProgram()); 108 base::CommandLine child_command_line(parent_command_line->GetProgram());
109 child_command_line.AppendArguments(*parent_command_line, false); 109 child_command_line.AppendArguments(*parent_command_line, false);
110 child_command_line.AppendSwitchPath(switches::kChildProcess, app_path_); 110 child_command_line.AppendSwitchPath(switches::kChildProcess, app_path_);
111 111
112 if (clean_app_path_)
113 child_command_line.AppendSwitch(switches::kDeleteAfterLoad);
114
112 if (start_sandboxed_) 115 if (start_sandboxed_)
113 child_command_line.AppendSwitch(switches::kEnableSandbox); 116 child_command_line.AppendSwitch(switches::kEnableSandbox);
114 117
115 embedder::HandlePassingInformation handle_passing_info; 118 embedder::HandlePassingInformation handle_passing_info;
116 platform_channel_pair_.PrepareToPassClientHandleToChildProcess( 119 platform_channel_pair_.PrepareToPassClientHandleToChildProcess(
117 &child_command_line, &handle_passing_info); 120 &child_command_line, &handle_passing_info);
118 121
119 base::LaunchOptions options; 122 base::LaunchOptions options;
120 #if defined(OS_WIN) 123 #if defined(OS_WIN)
121 options.handles_to_inherit = &handle_passing_info; 124 options.handles_to_inherit = &handle_passing_info;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 160
158 void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) { 161 void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) {
159 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; 162 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()";
160 163
161 CHECK(channel_info); 164 CHECK(channel_info);
162 channel_info_ = channel_info; 165 channel_info_ = channel_info;
163 } 166 }
164 167
165 } // namespace runner 168 } // namespace runner
166 } // namespace mojo 169 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698