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 "base/win/wait_chain.h" | 5 #include "base/win/wait_chain.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); | 187 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); |
188 | 188 |
189 AppendSwitchHandle(&command_line, "mutex", mutex); | 189 AppendSwitchHandle(&command_line, "mutex", mutex); |
190 AppendSwitchHandle(&command_line, "sync_event", sync_event); | 190 AppendSwitchHandle(&command_line, "sync_event", sync_event); |
191 | 191 |
192 LaunchOptions options; | 192 LaunchOptions options; |
193 HandlesToInheritVector handle_vector; | 193 HandlesToInheritVector handle_vector; |
194 handle_vector.push_back(mutex); | 194 handle_vector.push_back(mutex); |
195 handle_vector.push_back(sync_event); | 195 handle_vector.push_back(sync_event); |
196 options.handles_to_inherit = &handle_vector; | 196 options.handles_to_inherit = &handle_vector; |
197 return SpawnMultiProcessTestChild("WaitChainTestProc", command_line, options); | 197 base::SpawnChildResult spawn_result = |
| 198 SpawnMultiProcessTestChild("WaitChainTestProc", command_line, options); |
| 199 return std::move(spawn_result.process); |
198 } | 200 } |
199 | 201 |
200 // Returns true if the |wait_chain| is an alternating sequence of thread objects | 202 // Returns true if the |wait_chain| is an alternating sequence of thread objects |
201 // and synchronization objects. | 203 // and synchronization objects. |
202 bool WaitChainStructureIsCorrect(const WaitChainNodeVector& wait_chain) { | 204 bool WaitChainStructureIsCorrect(const WaitChainNodeVector& wait_chain) { |
203 // Checks thread objects. | 205 // Checks thread objects. |
204 for (size_t i = 0; i < wait_chain.size(); i += 2) { | 206 for (size_t i = 0; i < wait_chain.size(); i += 2) { |
205 if (wait_chain[i].ObjectType != WctThreadType) | 207 if (wait_chain[i].ObjectType != WctThreadType) |
206 return false; | 208 return false; |
207 } | 209 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // Unblock child process and wait for it to terminate. | 311 // Unblock child process and wait for it to terminate. |
310 ASSERT_TRUE(::SetEvent(sync_event.Get())); | 312 ASSERT_TRUE(::SetEvent(sync_event.Get())); |
311 ASSERT_TRUE(child_process.WaitForExit(nullptr)); | 313 ASSERT_TRUE(child_process.WaitForExit(nullptr)); |
312 | 314 |
313 // The SimpleThread API expect Join() to be called before destruction. | 315 // The SimpleThread API expect Join() to be called before destruction. |
314 waiting_thread_3->Join(); | 316 waiting_thread_3->Join(); |
315 } | 317 } |
316 | 318 |
317 } // namespace win | 319 } // namespace win |
318 } // namespace base | 320 } // namespace base |
OLD | NEW |