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

Side by Side Diff: chrome/app/chrome_watcher_command_line_win.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/app/chrome_exe_main_win.cc ('k') | chrome/browser/browser_process_impl.cc » ('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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/app/chrome_watcher_command_line_win.h" 5 #include "chrome/app/chrome_watcher_command_line_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/win/win_util.h" 16 #include "base/win/win_util.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win. h"
19 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
20 19
21 namespace { 20 namespace {
22 21
23 const char kMainThreadIdSwitch[] = "main-thread-id"; 22 const char kMainThreadIdSwitch[] = "main-thread-id";
24 const char kOnIninitializedEventHandleSwitch[] = "on-initialized-event-handle"; 23 const char kOnIninitializedEventHandleSwitch[] = "on-initialized-event-handle";
25 const char kParentHandleSwitch[] = "parent-handle"; 24 const char kParentHandleSwitch[] = "parent-handle";
26 25
27 void AppendHandleSwitch(const std::string& switch_name, 26 void AppendHandleSwitch(const std::string& switch_name,
28 HANDLE handle, 27 HANDLE handle,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::CommandLine command_line(chrome_exe); 149 base::CommandLine command_line(chrome_exe);
151 command_line.AppendSwitchASCII(switches::kProcessType, 150 command_line.AppendSwitchASCII(switches::kProcessType,
152 switches::kWatcherProcess); 151 switches::kWatcherProcess);
153 command_line.AppendSwitchASCII(kMainThreadIdSwitch, 152 command_line.AppendSwitchASCII(kMainThreadIdSwitch,
154 base::UintToString(main_thread_id)); 153 base::UintToString(main_thread_id));
155 AppendHandleSwitch(kOnIninitializedEventHandleSwitch, on_initialized_event, 154 AppendHandleSwitch(kOnIninitializedEventHandleSwitch, on_initialized_event,
156 &command_line); 155 &command_line);
157 AppendHandleSwitch(kParentHandleSwitch, parent_process, &command_line); 156 AppendHandleSwitch(kParentHandleSwitch, parent_process, &command_line);
158 157
159 #if defined(OS_WIN) 158 #if defined(OS_WIN)
160 if (startup_metric_utils::GetPreReadOptions().use_prefetch_argument) 159 command_line.AppendArg(switches::kPrefetchArgumentWatcher);
161 command_line.AppendArg(switches::kPrefetchArgumentWatcher);
162 #endif // defined(OS_WIN) 160 #endif // defined(OS_WIN)
163 161
164 return command_line; 162 return command_line;
165 } 163 }
166 164
167 bool InterpretChromeWatcherCommandLine( 165 bool InterpretChromeWatcherCommandLine(
168 const base::CommandLine& command_line, 166 const base::CommandLine& command_line,
169 base::win::ScopedHandle* parent_process, 167 base::win::ScopedHandle* parent_process,
170 DWORD* main_thread_id, 168 DWORD* main_thread_id,
171 base::win::ScopedHandle* on_initialized_event) { 169 base::win::ScopedHandle* on_initialized_event) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 !parent_process->IsValid()) { 210 !parent_process->IsValid()) {
213 // If one was valid and not the other, free the valid one. 211 // If one was valid and not the other, free the valid one.
214 on_initialized_event->Close(); 212 on_initialized_event->Close();
215 parent_process->Close(); 213 parent_process->Close();
216 *main_thread_id = 0; 214 *main_thread_id = 0;
217 return false; 215 return false;
218 } 216 }
219 217
220 return true; 218 return true;
221 } 219 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_exe_main_win.cc ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698