| 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 "platform/WaitableEvent.h" | 5 #include "platform/WaitableEvent.h" |
| 6 | 6 |
| 7 #include <vector> |
| 7 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 8 #include "platform/heap/SafePoint.h" | 9 #include "platform/heap/SafePoint.h" |
| 9 #include "platform/heap/ThreadState.h" | 10 #include "platform/heap/ThreadState.h" |
| 10 #include "wtf/Optional.h" | 11 #include "wtf/Optional.h" |
| 11 #include "wtf/PtrUtil.h" | 12 #include "wtf/PtrUtil.h" |
| 12 #include <vector> | |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 WaitableEvent::WaitableEvent(ResetPolicy policy, InitialState state) { | 16 WaitableEvent::WaitableEvent(ResetPolicy policy, InitialState state) { |
| 17 m_impl = WTF::wrapUnique(new base::WaitableEvent( | 17 m_impl = WTF::wrapUnique(new base::WaitableEvent( |
| 18 policy == ResetPolicy::Manual | 18 policy == ResetPolicy::Manual |
| 19 ? base::WaitableEvent::ResetPolicy::MANUAL | 19 ? base::WaitableEvent::ResetPolicy::MANUAL |
| 20 : base::WaitableEvent::ResetPolicy::AUTOMATIC, | 20 : base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 21 state == InitialState::Signaled | 21 state == InitialState::Signaled |
| 22 ? base::WaitableEvent::InitialState::SIGNALED | 22 ? base::WaitableEvent::InitialState::SIGNALED |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 std::vector<base::WaitableEvent*> baseEvents; | 41 std::vector<base::WaitableEvent*> baseEvents; |
| 42 for (size_t i = 0; i < events.size(); ++i) | 42 for (size_t i = 0; i < events.size(); ++i) |
| 43 baseEvents.push_back(events[i]->m_impl.get()); | 43 baseEvents.push_back(events[i]->m_impl.get()); |
| 44 size_t idx = | 44 size_t idx = |
| 45 base::WaitableEvent::WaitMany(baseEvents.data(), baseEvents.size()); | 45 base::WaitableEvent::WaitMany(baseEvents.data(), baseEvents.size()); |
| 46 DCHECK_LT(idx, events.size()); | 46 DCHECK_LT(idx, events.size()); |
| 47 return idx; | 47 return idx; |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace blink | 50 } // namespace blink |
| OLD | NEW |