Chromium Code Reviews

Side by Side Diff: chrome/service/service_utility_process_host.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/service/service_utility_process_host.h" 5 #include "chrome/service/service_utility_process_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 240 matching lines...)
251 named_pair.PrepareToPassClientHandleToChildProcess(cmd_line); 251 named_pair.PrepareToPassClientHandleToChildProcess(cmd_line);
252 252
253 cmd_line->AppendSwitch(switches::kNoSandbox); 253 cmd_line->AppendSwitch(switches::kNoSandbox);
254 process_ = base::LaunchProcess(*cmd_line, base::LaunchOptions()); 254 process_ = base::LaunchProcess(*cmd_line, base::LaunchOptions());
255 success = process_.IsValid(); 255 success = process_.IsValid();
256 } else { 256 } else {
257 mojo::edk::PlatformChannelPair channel_pair; 257 mojo::edk::PlatformChannelPair channel_pair;
258 parent_handle = channel_pair.PassServerHandle(); 258 parent_handle = channel_pair.PassServerHandle();
259 mojo::edk::ScopedPlatformHandle client_handle = 259 mojo::edk::ScopedPlatformHandle client_handle =
260 channel_pair.PassClientHandle(); 260 channel_pair.PassClientHandle();
261 base::HandlesToInheritVector handles; 261 std::vector<HANDLE> handles;
262 handles.push_back(client_handle.get().handle); 262 handles.push_back(client_handle.get().handle);
263 cmd_line->AppendSwitchASCII( 263 cmd_line->AppendSwitchASCII(
264 mojo::edk::PlatformChannelPair::kMojoPlatformChannelHandleSwitch, 264 mojo::edk::PlatformChannelPair::kMojoPlatformChannelHandleSwitch,
265 base::UintToString(base::win::HandleToUint32(handles[0]))); 265 base::UintToString(base::win::HandleToUint32(handles[0])));
266 266
267 ServiceSandboxedProcessLauncherDelegate delegate; 267 ServiceSandboxedProcessLauncherDelegate delegate;
268 base::Process process; 268 base::Process process;
269 sandbox::ResultCode result = content::StartSandboxedProcess( 269 sandbox::ResultCode result = content::StartSandboxedProcess(
270 &delegate, cmd_line, handles, &process); 270 &delegate, cmd_line, handles, &process);
271 if (result == sandbox::SBOX_ALL_OK) { 271 if (result == sandbox::SBOX_ALL_OK) {
(...skipping 173 matching lines...)
445 return false; 445 return false;
446 } 446 }
447 printing::Emf emf; 447 printing::Emf emf;
448 if (!emf.InitFromData(data.data(), data.size())) { 448 if (!emf.InitFromData(data.data(), data.size())) {
449 OnRenderPDFPagesToMetafileDone(false); 449 OnRenderPDFPagesToMetafileDone(false);
450 return false; 450 return false;
451 } 451 }
452 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); 452 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf);
453 return true; 453 return true;
454 } 454 }
OLDNEW

Powered by Google App Engine