| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 if (exe_path.empty()) { | 222 if (exe_path.empty()) { |
| 219 NOTREACHED() << "Unable to get utility process binary name."; | 223 NOTREACHED() << "Unable to get utility process binary name."; |
| 220 return false; | 224 return false; |
| 221 } | 225 } |
| 222 | 226 |
| 223 base::CommandLine cmd_line(exe_path); | 227 base::CommandLine cmd_line(exe_path); |
| 224 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); | 228 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); |
| 225 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 229 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 226 cmd_line.AppendSwitch(switches::kLang); | 230 cmd_line.AppendSwitch(switches::kLang); |
| 227 | 231 |
| 232 #if defined(OS_WIN) |
| 233 if (startup_metric_utils::GetPreReadOptions().use_prefetch_argument) |
| 234 cmd_line.AppendArg(switches::kPrefetchArgumentOther); |
| 235 #endif // defined(OS_WIN) |
| 236 |
| 228 if (Launch(&cmd_line, no_sandbox)) { | 237 if (Launch(&cmd_line, no_sandbox)) { |
| 229 ReportUmaEvent(SERVICE_UTILITY_STARTED); | 238 ReportUmaEvent(SERVICE_UTILITY_STARTED); |
| 230 return true; | 239 return true; |
| 231 } | 240 } |
| 232 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); | 241 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); |
| 233 return false; | 242 return false; |
| 234 } | 243 } |
| 235 | 244 |
| 236 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, | 245 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, |
| 237 bool no_sandbox) { | 246 bool no_sandbox) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 return false; | 428 return false; |
| 420 } | 429 } |
| 421 printing::Emf emf; | 430 printing::Emf emf; |
| 422 if (!emf.InitFromData(data.data(), data.size())) { | 431 if (!emf.InitFromData(data.data(), data.size())) { |
| 423 OnRenderPDFPagesToMetafileDone(false); | 432 OnRenderPDFPagesToMetafileDone(false); |
| 424 return false; | 433 return false; |
| 425 } | 434 } |
| 426 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | 435 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); |
| 427 return true; | 436 return true; |
| 428 } | 437 } |
| OLD | NEW |