Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1409)

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

Issue 2075693002: Always use a /prefetch:# switch when launching a process on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/service/DEPS ('k') | components/crash.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file.h" 14 #include "base/files/file.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 16 #include "base/files/file_util.h"
17 #include "base/files/scoped_temp_dir.h" 17 #include "base/files/scoped_temp_dir.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
21 #include "base/process/launch.h" 21 #include "base/process/launch.h"
22 #include "base/task_runner_util.h" 22 #include "base/task_runner_util.h"
23 #include "base/threading/thread_task_runner_handle.h" 23 #include "base/threading/thread_task_runner_handle.h"
24 #include "build/build_config.h" 24 #include "build/build_config.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/chrome_utility_printing_messages.h" 26 #include "chrome/common/chrome_utility_printing_messages.h"
27 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win. h"
28 #include "content/public/common/child_process_host.h" 27 #include "content/public/common/child_process_host.h"
29 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
30 #include "content/public/common/result_codes.h" 29 #include "content/public/common/result_codes.h"
31 #include "content/public/common/sandbox_init.h" 30 #include "content/public/common/sandbox_init.h"
32 #include "content/public/common/sandboxed_process_launcher_delegate.h" 31 #include "content/public/common/sandboxed_process_launcher_delegate.h"
33 #include "ipc/ipc_switches.h" 32 #include "ipc/ipc_switches.h"
34 #include "printing/emf_win.h" 33 #include "printing/emf_win.h"
35 #include "sandbox/win/src/sandbox_policy.h" 34 #include "sandbox/win/src/sandbox_policy.h"
36 #include "sandbox/win/src/sandbox_types.h" 35 #include "sandbox/win/src/sandbox_types.h"
37 #include "ui/base/ui_base_switches.h" 36 #include "ui/base/ui_base_switches.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 base::FilePath exe_path = GetUtilityProcessCmd(); 219 base::FilePath exe_path = GetUtilityProcessCmd();
221 if (exe_path.empty()) { 220 if (exe_path.empty()) {
222 NOTREACHED() << "Unable to get utility process binary name."; 221 NOTREACHED() << "Unable to get utility process binary name.";
223 return false; 222 return false;
224 } 223 }
225 224
226 base::CommandLine cmd_line(exe_path); 225 base::CommandLine cmd_line(exe_path);
227 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); 226 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess);
228 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); 227 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id);
229 cmd_line.AppendSwitch(switches::kLang); 228 cmd_line.AppendSwitch(switches::kLang);
230 229 cmd_line.AppendArg(switches::kPrefetchArgumentOther);
231 if (startup_metric_utils::GetPreReadOptions().use_prefetch_argument)
232 cmd_line.AppendArg(switches::kPrefetchArgumentOther);
233 230
234 if (Launch(&cmd_line, no_sandbox)) { 231 if (Launch(&cmd_line, no_sandbox)) {
235 ReportUmaEvent(SERVICE_UTILITY_STARTED); 232 ReportUmaEvent(SERVICE_UTILITY_STARTED);
236 return true; 233 return true;
237 } 234 }
238 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START); 235 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START);
239 return false; 236 return false;
240 } 237 }
241 238
242 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, 239 bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return false; 424 return false;
428 } 425 }
429 printing::Emf emf; 426 printing::Emf emf;
430 if (!emf.InitFromData(data.data(), data.size())) { 427 if (!emf.InitFromData(data.data(), data.size())) {
431 OnRenderPDFPagesToMetafileDone(false); 428 OnRenderPDFPagesToMetafileDone(false);
432 return false; 429 return false;
433 } 430 }
434 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); 431 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf);
435 return true; 432 return true;
436 } 433 }
OLDNEW
« no previous file with comments | « chrome/service/DEPS ('k') | components/crash.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698