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