Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Unified Diff: third_party/WebKit/Source/platform/WaitableEvent.cpp

Issue 1682423002: Remove WebWaitableEvent and replace it with WaitableEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/WaitableEvent.cpp
diff --git a/third_party/WebKit/Source/platform/WaitableEvent.cpp b/third_party/WebKit/Source/platform/WaitableEvent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c379a282dee18f3f675dfce98e3bd6b50e1c9340
--- /dev/null
+++ b/third_party/WebKit/Source/platform/WaitableEvent.cpp
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/WaitableEvent.h"
+
+#include "base/synchronization/waitable_event.h"
+#include "wtf/PassOwnPtr.h"
+
+#include <vector>
+
+namespace blink {
+
+WaitableEvent::WaitableEvent(ResetPolicy policy, InitialState state)
+{
+ bool manualReset = policy == ResetPolicy::Manual;
+ bool initiallySignaled = state == InitialState::Signaled;
+ m_impl = adoptPtr(new base::WaitableEvent(manualReset, initiallySignaled));
+}
+
+WaitableEvent::~WaitableEvent() {}
+
+void WaitableEvent::reset()
+{
+ m_impl->Reset();
+}
+
+void WaitableEvent::wait()
+{
+ m_impl->Wait();
+}
+
+void WaitableEvent::signal()
+{
+ m_impl->Signal();
+}
+
+size_t WaitableEvent::waitMultiple(const WTF::Vector<WaitableEvent*>& events)
+{
+ std::vector<base::WaitableEvent*> baseEvents;
+ for (size_t i = 0; i < events.size(); ++i)
+ baseEvents.push_back(events[i]->m_impl.get());
+ size_t idx = base::WaitableEvent::WaitMany(baseEvents.data(), baseEvents.size());
+ DCHECK_LT(idx, events.size());
+ return idx;
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/WaitableEvent.h ('k') | third_party/WebKit/Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698