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

Side by Side Diff: chrome/app/chrome_watcher_command_line_win.cc

Issue 1595633002: Use valid /prefetch arguments for process launches on Windows. - do not submit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move
Patch Set: address simple comments from gab Created 4 years, 11 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 | « no previous file | chrome/app/main_dll_loader_win.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 "chrome/common/prefetch_argument_win.h"
18 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
19 20
20 namespace { 21 namespace {
21 22
22 const char kMainThreadIdSwitch[] = "main-thread-id"; 23 const char kMainThreadIdSwitch[] = "main-thread-id";
23 const char kOnIninitializedEventHandleSwitch[] = "on-initialized-event-handle"; 24 const char kOnIninitializedEventHandleSwitch[] = "on-initialized-event-handle";
24 const char kParentHandleSwitch[] = "parent-handle"; 25 const char kParentHandleSwitch[] = "parent-handle";
25 26
26 void AppendHandleSwitch(const std::string& switch_name, 27 void AppendHandleSwitch(const std::string& switch_name,
27 HANDLE handle, 28 HANDLE handle,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 143 }
143 144
144 base::CommandLine GenerateChromeWatcherCommandLine( 145 base::CommandLine GenerateChromeWatcherCommandLine(
145 const base::FilePath& chrome_exe, 146 const base::FilePath& chrome_exe,
146 HANDLE parent_process, 147 HANDLE parent_process,
147 DWORD main_thread_id, 148 DWORD main_thread_id,
148 HANDLE on_initialized_event) { 149 HANDLE on_initialized_event) {
149 base::CommandLine command_line(chrome_exe); 150 base::CommandLine command_line(chrome_exe);
150 command_line.AppendSwitchASCII(switches::kProcessType, 151 command_line.AppendSwitchASCII(switches::kProcessType,
151 switches::kWatcherProcess); 152 switches::kWatcherProcess);
153 chrome::AddWindowsPrefetchArgument(&command_line);
152 command_line.AppendSwitchASCII(kMainThreadIdSwitch, 154 command_line.AppendSwitchASCII(kMainThreadIdSwitch,
153 base::UintToString(main_thread_id)); 155 base::UintToString(main_thread_id));
154 AppendHandleSwitch(kOnIninitializedEventHandleSwitch, on_initialized_event, 156 AppendHandleSwitch(kOnIninitializedEventHandleSwitch, on_initialized_event,
155 &command_line); 157 &command_line);
156 AppendHandleSwitch(kParentHandleSwitch, parent_process, &command_line); 158 AppendHandleSwitch(kParentHandleSwitch, parent_process, &command_line);
157 return command_line; 159 return command_line;
158 } 160 }
159 161
160 bool InterpretChromeWatcherCommandLine( 162 bool InterpretChromeWatcherCommandLine(
161 const base::CommandLine& command_line, 163 const base::CommandLine& command_line,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 !parent_process->IsValid()) { 207 !parent_process->IsValid()) {
206 // If one was valid and not the other, free the valid one. 208 // If one was valid and not the other, free the valid one.
207 on_initialized_event->Close(); 209 on_initialized_event->Close();
208 parent_process->Close(); 210 parent_process->Close();
209 *main_thread_id = 0; 211 *main_thread_id = 0;
210 return false; 212 return false;
211 } 213 }
212 214
213 return true; 215 return true;
214 } 216 }
OLDNEW
« no previous file with comments | « no previous file | chrome/app/main_dll_loader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698