| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/win/base_features.h" | 9 #include "base/win/base_features.h" |
| 10 #include "base/win/current_module.h" | 10 #include "base/win/current_module.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 reinterpret_cast<void*>(&thread_params), 0, nullptr); | 59 reinterpret_cast<void*>(&thread_params), 0, nullptr); |
| 60 if (!thread_handle) | 60 if (!thread_handle) |
| 61 break; | 61 break; |
| 62 ::WaitForSingleObject(ready_event, INFINITE); | 62 ::WaitForSingleObject(ready_event, INFINITE); |
| 63 threads_.push_back(thread_handle); | 63 threads_.push_back(thread_handle); |
| 64 } | 64 } |
| 65 | 65 |
| 66 ::CloseHandle(ready_event); | 66 ::CloseHandle(ready_event); |
| 67 | 67 |
| 68 if (threads_.size() != kNumThreads) { | 68 if (threads_.size() != kNumThreads) { |
| 69 for (const auto& thread : threads_) | 69 for (auto* thread : threads_) |
| 70 ::CloseHandle(thread); | 70 ::CloseHandle(thread); |
| 71 ::CloseHandle(start_event); | 71 ::CloseHandle(start_event); |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 | 74 |
| 75 ::SetEvent(start_event); | 75 ::SetEvent(start_event); |
| 76 ::CloseHandle(start_event); | 76 ::CloseHandle(start_event); |
| 77 for (const auto& thread : threads_) { | 77 for (auto* thread : threads_) { |
| 78 ::WaitForSingleObject(thread, INFINITE); | 78 ::WaitForSingleObject(thread, INFINITE); |
| 79 ::CloseHandle(thread); | 79 ::CloseHandle(thread); |
| 80 } | 80 } |
| 81 | 81 |
| 82 return true; | 82 return true; |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool InternalRunLocationTest() { | 85 bool InternalRunLocationTest() { |
| 86 // Create a new handle and then set LastError again. | 86 // Create a new handle and then set LastError again. |
| 87 HANDLE handle = ::CreateMutex(nullptr, false, nullptr); | 87 HANDLE handle = ::CreateMutex(nullptr, false, nullptr); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 116 | 116 |
| 117 } // namespace | 117 } // namespace |
| 118 | 118 |
| 119 bool RunTest() { | 119 bool RunTest() { |
| 120 return InternalRunThreadTest() && InternalRunLocationTest(); | 120 return InternalRunThreadTest() && InternalRunLocationTest(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // testing | 123 } // testing |
| 124 } // win | 124 } // win |
| 125 } // base | 125 } // base |
| OLD | NEW |