| 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/win/scoped_process_information.h" | 5 #include "base/win/scoped_process_information.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/win/scoped_handle.h" | 8 #include "base/win/scoped_handle.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| 11 namespace win { | 11 namespace win { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // Closes the provided handle if it is not NULL. | 15 // Closes the provided handle if it is not NULL. |
| 16 void CheckAndCloseHandle(HANDLE handle) { | 16 void CheckAndCloseHandle(HANDLE handle) { |
| 17 if (!handle) | 17 if (!handle) |
| 18 return; | 18 return; |
| 19 if (::CloseHandle(handle)) | 19 if (::CloseHandle(handle)) |
| 20 return; | 20 return; |
| 21 DPCHECK(false) << "Failed to close a handle."; | 21 CHECK(false); |
| 22 } | 22 } |
| 23 | 23 |
| 24 // Duplicates source into target, returning true upon success. |target| is | 24 // Duplicates source into target, returning true upon success. |target| is |
| 25 // guaranteed to be untouched in case of failure. Succeeds with no side-effects | 25 // guaranteed to be untouched in case of failure. Succeeds with no side-effects |
| 26 // if source is NULL. | 26 // if source is NULL. |
| 27 bool CheckAndDuplicateHandle(HANDLE source, HANDLE* target) { | 27 bool CheckAndDuplicateHandle(HANDLE source, HANDLE* target) { |
| 28 if (!source) | 28 if (!source) |
| 29 return true; | 29 return true; |
| 30 | 30 |
| 31 HANDLE temp = NULL; | 31 HANDLE temp = NULL; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 void ScopedProcessInformation::Reset() { | 118 void ScopedProcessInformation::Reset() { |
| 119 process_information_.hThread = NULL; | 119 process_information_.hThread = NULL; |
| 120 process_information_.hProcess = NULL; | 120 process_information_.hProcess = NULL; |
| 121 process_information_.dwProcessId = 0; | 121 process_information_.dwProcessId = 0; |
| 122 process_information_.dwThreadId = 0; | 122 process_information_.dwThreadId = 0; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace win | 125 } // namespace win |
| 126 } // namespace base | 126 } // namespace base |
| OLD | NEW |