| OLD | NEW |
| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); | 238 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); |
| 239 return false; | 239 return false; |
| 240 } | 240 } |
| 241 | 241 |
| 242 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, | 242 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, |
| 243 bool no_sandbox) { | 243 bool no_sandbox) { |
| 244 if (no_sandbox) { | 244 if (no_sandbox) { |
| 245 cmd_line->AppendSwitch(switches::kNoSandbox); | 245 cmd_line->AppendSwitch(switches::kNoSandbox); |
| 246 process_ = base::LaunchProcess(*cmd_line, base::LaunchOptions()); | 246 process_ = base::LaunchProcess(*cmd_line, base::LaunchOptions()); |
| 247 return process_.IsValid(); |
| 247 } else { | 248 } else { |
| 248 ServiceSandboxedProcessLauncherDelegate delegate; | 249 ServiceSandboxedProcessLauncherDelegate delegate; |
| 249 process_ = content::StartSandboxedProcess( | 250 base::Process process; |
| 250 &delegate, cmd_line, base::HandlesToInheritVector()); | 251 sandbox::ResultCode result = content::StartSandboxedProcess( |
| 252 &delegate, cmd_line, base::HandlesToInheritVector(), &process); |
| 253 if (result == sandbox::SBOX_ALL_OK) { |
| 254 process_ = std::move(process); |
| 255 return true; |
| 256 } |
| 257 return false; |
| 251 } | 258 } |
| 252 return process_.IsValid(); | |
| 253 } | 259 } |
| 254 | 260 |
| 255 bool ServiceUtilityProcessHost::Send(IPC::Message* msg) { | 261 bool ServiceUtilityProcessHost::Send(IPC::Message* msg) { |
| 256 if (child_process_host_) | 262 if (child_process_host_) |
| 257 return child_process_host_->Send(msg); | 263 return child_process_host_->Send(msg); |
| 258 delete msg; | 264 delete msg; |
| 259 return false; | 265 return false; |
| 260 } | 266 } |
| 261 | 267 |
| 262 base::FilePath ServiceUtilityProcessHost::GetUtilityProcessCmd() { | 268 base::FilePath ServiceUtilityProcessHost::GetUtilityProcessCmd() { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 return false; | 427 return false; |
| 422 } | 428 } |
| 423 printing::Emf emf; | 429 printing::Emf emf; |
| 424 if (!emf.InitFromData(data.data(), data.size())) { | 430 if (!emf.InitFromData(data.data(), data.size())) { |
| 425 OnRenderPDFPagesToMetafileDone(false); | 431 OnRenderPDFPagesToMetafileDone(false); |
| 426 return false; | 432 return false; |
| 427 } | 433 } |
| 428 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | 434 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); |
| 429 return true; | 435 return true; |
| 430 } | 436 } |
| OLD | NEW |