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