| 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 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/common/result_codes.h" | 28 #include "content/public/common/result_codes.h" |
| 29 #include "content/public/common/sandbox_init.h" | 29 #include "content/public/common/sandbox_init.h" |
| 30 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 30 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 31 #include "ipc/ipc_switches.h" | 31 #include "ipc/ipc_switches.h" |
| 32 #include "printing/emf_win.h" | 32 #include "printing/emf_win.h" |
| 33 #include "sandbox/win/src/sandbox_policy.h" | 33 #include "sandbox/win/src/sandbox_policy.h" |
| 34 #include "sandbox/win/src/sandbox_types.h" | 34 #include "sandbox/win/src/sandbox_types.h" |
| 35 #include "ui/base/ui_base_switches.h" | 35 #include "ui/base/ui_base_switches.h" |
| 36 | 36 |
| 37 #if defined(OS_WIN) |
| 38 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" |
| 39 #endif // defined(OS_WIN) |
| 40 |
| 37 namespace { | 41 namespace { |
| 38 | 42 |
| 39 using content::ChildProcessHost; | 43 using content::ChildProcessHost; |
| 40 | 44 |
| 41 enum ServiceUtilityProcessHostEvent { | 45 enum ServiceUtilityProcessHostEvent { |
| 42 SERVICE_UTILITY_STARTED, | 46 SERVICE_UTILITY_STARTED, |
| 43 SERVICE_UTILITY_DISCONNECTED, | 47 SERVICE_UTILITY_DISCONNECTED, |
| 44 SERVICE_UTILITY_METAFILE_REQUEST, | 48 SERVICE_UTILITY_METAFILE_REQUEST, |
| 45 SERVICE_UTILITY_METAFILE_SUCCEEDED, | 49 SERVICE_UTILITY_METAFILE_SUCCEEDED, |
| 46 SERVICE_UTILITY_METAFILE_FAILED, | 50 SERVICE_UTILITY_METAFILE_FAILED, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (exe_path.empty()) { | 221 if (exe_path.empty()) { |
| 218 NOTREACHED() << "Unable to get utility process binary name."; | 222 NOTREACHED() << "Unable to get utility process binary name."; |
| 219 return false; | 223 return false; |
| 220 } | 224 } |
| 221 | 225 |
| 222 base::CommandLine cmd_line(exe_path); | 226 base::CommandLine cmd_line(exe_path); |
| 223 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); | 227 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); |
| 224 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 228 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 225 cmd_line.AppendSwitch(switches::kLang); | 229 cmd_line.AppendSwitch(switches::kLang); |
| 226 | 230 |
| 231 #if defined(OS_WIN) |
| 232 if (startup_metric_utils::GetPreReadOptions().prefetch_argument) |
| 233 cmd_line.AppendArg(switches::kPrefetchArgumentOther); |
| 234 #endif // defined(OS_WIN) |
| 235 |
| 227 if (Launch(&cmd_line, no_sandbox)) { | 236 if (Launch(&cmd_line, no_sandbox)) { |
| 228 ReportUmaEvent(SERVICE_UTILITY_STARTED); | 237 ReportUmaEvent(SERVICE_UTILITY_STARTED); |
| 229 return true; | 238 return true; |
| 230 } | 239 } |
| 231 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); | 240 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); |
| 232 return false; | 241 return false; |
| 233 } | 242 } |
| 234 | 243 |
| 235 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, | 244 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, |
| 236 bool no_sandbox) { | 245 bool no_sandbox) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 return false; | 427 return false; |
| 419 } | 428 } |
| 420 printing::Emf emf; | 429 printing::Emf emf; |
| 421 if (!emf.InitFromData(data.data(), data.size())) { | 430 if (!emf.InitFromData(data.data(), data.size())) { |
| 422 OnRenderPDFPagesToMetafileDone(false); | 431 OnRenderPDFPagesToMetafileDone(false); |
| 423 return false; | 432 return false; |
| 424 } | 433 } |
| 425 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | 434 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); |
| 426 return true; | 435 return true; |
| 427 } | 436 } |
| OLD | NEW |