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 "base/process/launch.h" | 5 #include "base/process/launch.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <io.h> | 8 #include <io.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <userenv.h> | 11 #include <userenv.h> |
12 #include <psapi.h> | 12 #include <psapi.h> |
| 13 #include <stdlib.h> |
13 | 14 |
14 #include <ios> | 15 #include <ios> |
15 #include <limits> | 16 #include <limits> |
16 | 17 |
17 #include "base/bind.h" | 18 #include "base/bind.h" |
18 #include "base/bind_helpers.h" | 19 #include "base/bind_helpers.h" |
19 #include "base/command_line.h" | 20 #include "base/command_line.h" |
20 #include "base/debug/stack_trace.h" | 21 #include "base/debug/stack_trace.h" |
21 #include "base/logging.h" | 22 #include "base/logging.h" |
22 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 << std::endl;; | 199 << std::endl;; |
199 return false; | 200 return false; |
200 } | 201 } |
201 } else { | 202 } else { |
202 if (!CreateProcess(NULL, | 203 if (!CreateProcess(NULL, |
203 const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, | 204 const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, |
204 inherit_handles, flags, NULL, NULL, | 205 inherit_handles, flags, NULL, NULL, |
205 startup_info, &temp_process_info)) { | 206 startup_info, &temp_process_info)) { |
206 DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline) | 207 DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline) |
207 << std::endl;; | 208 << std::endl;; |
| 209 // TODO(scottmg): Temporary code for debugging http://crbug.com/340422. |
| 210 if (getenv("CHROME_HEADLESS") && |
| 211 strcmp(getenv("CHROME_HEADLESS"), "1") == 0 && |
| 212 getenv("COMPUTERNAME") && |
| 213 strcmp(getenv("COMPUTERNAME"), "VM898-M1") == 0) { |
| 214 for (;;) { |
| 215 DLOG(ERROR) << "Failed CreateProcess, waiting for debugger"; |
| 216 ::Sleep(1000); |
| 217 } |
| 218 } |
208 return false; | 219 return false; |
209 } | 220 } |
210 } | 221 } |
211 base::win::ScopedProcessInformation process_info(temp_process_info); | 222 base::win::ScopedProcessInformation process_info(temp_process_info); |
212 | 223 |
213 if (options.job_handle) { | 224 if (options.job_handle) { |
214 if (0 == AssignProcessToJobObject(options.job_handle, | 225 if (0 == AssignProcessToJobObject(options.job_handle, |
215 process_info.process_handle())) { | 226 process_info.process_handle())) { |
216 DLOG(ERROR) << "Could not AssignProcessToObject."; | 227 DLOG(ERROR) << "Could not AssignProcessToObject."; |
217 KillProcess(process_info.process_handle(), kProcessKilledExitCode, true); | 228 KillProcess(process_info.process_handle(), kProcessKilledExitCode, true); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 WaitForSingleObject(proc_info.process_handle(), INFINITE); | 373 WaitForSingleObject(proc_info.process_handle(), INFINITE); |
363 | 374 |
364 return true; | 375 return true; |
365 } | 376 } |
366 | 377 |
367 void RaiseProcessToHighPriority() { | 378 void RaiseProcessToHighPriority() { |
368 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | 379 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); |
369 } | 380 } |
370 | 381 |
371 } // namespace base | 382 } // namespace base |
OLD | NEW |