| 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 "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "platform/heap/SafePoint.h" | 8 #include "platform/heap/SafePoint.h" |
| 9 #include "platform/heap/ThreadState.h" | 9 #include "platform/heap/ThreadState.h" |
| 10 #include "wtf/Optional.h" | 10 #include "wtf/Optional.h" |
| 11 #include "wtf/PtrUtil.h" | 11 #include "wtf/PtrUtil.h" |
| 12 #include <vector> | 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 = 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 |
| 23 : base::WaitableEvent::InitialState::NOT_SIGNALED)); | 23 : base::WaitableEvent::InitialState::NOT_SIGNALED)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 WaitableEvent::~WaitableEvent() {} | 26 WaitableEvent::~WaitableEvent() {} |
| 27 | 27 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 49 std::vector<base::WaitableEvent*> baseEvents; | 49 std::vector<base::WaitableEvent*> baseEvents; |
| 50 for (size_t i = 0; i < events.size(); ++i) | 50 for (size_t i = 0; i < events.size(); ++i) |
| 51 baseEvents.push_back(events[i]->m_impl.get()); | 51 baseEvents.push_back(events[i]->m_impl.get()); |
| 52 size_t idx = | 52 size_t idx = |
| 53 base::WaitableEvent::WaitMany(baseEvents.data(), baseEvents.size()); | 53 base::WaitableEvent::WaitMany(baseEvents.data(), baseEvents.size()); |
| 54 DCHECK_LT(idx, events.size()); | 54 DCHECK_LT(idx, events.size()); |
| 55 return idx; | 55 return idx; |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |