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 "chrome/common/prefetch_argument_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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 return false; | 218 return false; |
215 | 219 |
216 base::FilePath exe_path = GetUtilityProcessCmd(); | 220 base::FilePath exe_path = GetUtilityProcessCmd(); |
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); |
| 228 #if defined(OS_WIN) |
| 229 chrome::AddWindowsPrefetchArgument(&cmd_line); |
| 230 #endif // defined(OS_WIN) |
224 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 231 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
225 cmd_line.AppendSwitch(switches::kLang); | 232 cmd_line.AppendSwitch(switches::kLang); |
226 | 233 |
227 if (Launch(&cmd_line, no_sandbox)) { | 234 if (Launch(&cmd_line, no_sandbox)) { |
228 ReportUmaEvent(SERVICE_UTILITY_STARTED); | 235 ReportUmaEvent(SERVICE_UTILITY_STARTED); |
229 return true; | 236 return true; |
230 } | 237 } |
231 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); | 238 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); |
232 return false; | 239 return false; |
233 } | 240 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 return false; | 425 return false; |
419 } | 426 } |
420 printing::Emf emf; | 427 printing::Emf emf; |
421 if (!emf.InitFromData(data.data(), data.size())) { | 428 if (!emf.InitFromData(data.data(), data.size())) { |
422 OnRenderPDFPagesToMetafileDone(false); | 429 OnRenderPDFPagesToMetafileDone(false); |
423 return false; | 430 return false; |
424 } | 431 } |
425 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | 432 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); |
426 return true; | 433 return true; |
427 } | 434 } |
OLD | NEW |