| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/kill.h" | 5 #include "base/process/kill.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/process/memory.h" |
| 17 #include "base/process/process_iterator.h" | 18 #include "base/process/process_iterator.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "base/win/object_watcher.h" | 20 #include "base/win/object_watcher.h" |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Exit codes with special meanings on Windows. | 26 // Exit codes with special meanings on Windows. |
| 26 const DWORD kNormalTerminationExitCode = 0; | 27 const DWORD kNormalTerminationExitCode = 0; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 *exit_code = tmp_exit_code; | 140 *exit_code = tmp_exit_code; |
| 140 | 141 |
| 141 switch (tmp_exit_code) { | 142 switch (tmp_exit_code) { |
| 142 case kNormalTerminationExitCode: | 143 case kNormalTerminationExitCode: |
| 143 return TERMINATION_STATUS_NORMAL_TERMINATION; | 144 return TERMINATION_STATUS_NORMAL_TERMINATION; |
| 144 case kDebuggerInactiveExitCode: // STATUS_DEBUGGER_INACTIVE. | 145 case kDebuggerInactiveExitCode: // STATUS_DEBUGGER_INACTIVE. |
| 145 case kKeyboardInterruptExitCode: // Control-C/end session. | 146 case kKeyboardInterruptExitCode: // Control-C/end session. |
| 146 case kDebuggerTerminatedExitCode: // Debugger terminated process. | 147 case kDebuggerTerminatedExitCode: // Debugger terminated process. |
| 147 case kProcessKilledExitCode: // Task manager kill. | 148 case kProcessKilledExitCode: // Task manager kill. |
| 148 return TERMINATION_STATUS_PROCESS_WAS_KILLED; | 149 return TERMINATION_STATUS_PROCESS_WAS_KILLED; |
| 150 case base::win::kOomExceptionCode: // Ran out of memory. |
| 151 return TERMINATION_STATUS_OOM; |
| 149 default: | 152 default: |
| 150 // All other exit codes indicate crashes. | 153 // All other exit codes indicate crashes. |
| 151 return TERMINATION_STATUS_PROCESS_CRASHED; | 154 return TERMINATION_STATUS_PROCESS_CRASHED; |
| 152 } | 155 } |
| 153 } | 156 } |
| 154 | 157 |
| 155 bool WaitForProcessesToExit(const FilePath::StringType& executable_name, | 158 bool WaitForProcessesToExit(const FilePath::StringType& executable_name, |
| 156 TimeDelta wait, | 159 TimeDelta wait, |
| 157 const ProcessFilter* filter) { | 160 const ProcessFilter* filter) { |
| 158 bool result = true; | 161 bool result = true; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return; | 196 return; |
| 194 } | 197 } |
| 195 | 198 |
| 196 ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 199 ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 197 FROM_HERE, Bind(&TimerExpiredTask::TimedOut, | 200 FROM_HERE, Bind(&TimerExpiredTask::TimedOut, |
| 198 Owned(new TimerExpiredTask(std::move(process)))), | 201 Owned(new TimerExpiredTask(std::move(process)))), |
| 199 TimeDelta::FromMilliseconds(kWaitInterval)); | 202 TimeDelta::FromMilliseconds(kWaitInterval)); |
| 200 } | 203 } |
| 201 | 204 |
| 202 } // namespace base | 205 } // namespace base |
| OLD | NEW |