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

Unified Diff: webkit/child/webkitplatformsupport_child_impl.cc

Issue 133493003: Implement Platform::createWaitableEvent() (chromium side) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 6 years, 11 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
« no previous file with comments | « webkit/child/webkitplatformsupport_child_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/child/webkitplatformsupport_child_impl.cc
diff --git a/webkit/child/webkitplatformsupport_child_impl.cc b/webkit/child/webkitplatformsupport_child_impl.cc
index 09cd0b2d17f9b937a083be29d7ba69e76ecf6fee..7253540d1295871f2f63bcab73bc806c8c683b77 100644
--- a/webkit/child/webkitplatformsupport_child_impl.cc
+++ b/webkit/child/webkitplatformsupport_child_impl.cc
@@ -5,6 +5,9 @@
#include "webkit/child/webkitplatformsupport_child_impl.h"
#include "base/memory/discardable_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/waitable_event.h"
+#include "third_party/WebKit/public/platform/WebWaitableEvent.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "webkit/child/fling_curve_configuration.h"
#include "webkit/child/web_discardable_memory_impl.h"
@@ -20,6 +23,27 @@ using blink::WebThemeEngine;
namespace webkit_glue {
+namespace {
+
+class WebWaitableEventImpl : public blink::WebWaitableEvent {
+ public:
+ WebWaitableEventImpl() : impl_(new base::WaitableEvent(false, false)) {}
+ virtual ~WebWaitableEventImpl() {}
+
+ virtual void wait() { impl_->Wait(); }
+ virtual void signal() { impl_->Signal(); }
+
+ base::WaitableEvent* impl() {
+ return impl_.get();
+ }
+
+ private:
+ scoped_ptr<base::WaitableEvent> impl_;
+ DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl);
+};
+
+} // namespace
+
WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl()
: current_thread_slot_(&DestroyCurrentThread),
fling_curve_configuration_(new FlingCurveConfiguration) {}
@@ -79,6 +103,20 @@ blink::WebThread* WebKitPlatformSupportChildImpl::currentThread() {
return thread;
}
+blink::WebWaitableEvent* WebKitPlatformSupportChildImpl::createWaitableEvent() {
+ return new WebWaitableEventImpl();
+}
+
+blink::WebWaitableEvent* WebKitPlatformSupportChildImpl::waitMultipleEvents(
+ const blink::WebVector<blink::WebWaitableEvent*>& web_events) {
+ base::WaitableEvent** events = new base::WaitableEvent*[web_events.size()];
+ for (size_t i = 0; i < web_events.size(); ++i)
+ events[i] = static_cast<WebWaitableEventImpl*>(web_events[i])->impl();
+ size_t idx = base::WaitableEvent::WaitMany(events, web_events.size());
+ DCHECK_LT(idx, web_events.size());
+ return web_events[idx];
+}
+
void WebKitPlatformSupportChildImpl::didStartWorkerRunLoop(
const blink::WebWorkerRunLoop& runLoop) {
WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance();
« no previous file with comments | « webkit/child/webkitplatformsupport_child_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698