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

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: 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..45879302dddd7908b1edb1b1d3d5c2a27690eb5c 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,26 @@ 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_;
+};
jochen (gone - plz use gerrit) 2014/01/14 15:29:12 disallow copy/assign
kinuko 2014/01/14 16:51:59 Done.
+
+} // namespace
+
WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl()
: current_thread_slot_(&DestroyCurrentThread),
fling_curve_configuration_(new FlingCurveConfiguration) {}
@@ -79,6 +102,21 @@ blink::WebThread* WebKitPlatformSupportChildImpl::currentThread() {
return thread;
}
+blink::WebWaitableEvent* WebKitPlatformSupportChildImpl::createWaitableEvent() {
+ return new WebWaitableEventImpl();
+}
+
+blink::WebWaitableEvent* WebKitPlatformSupportChildImpl::waitMultipleEvents(
+ blink::WebWaitableEvent** web_events,
+ size_t event_count) {
jochen (gone - plz use gerrit) 2014/01/14 15:29:12 why not a WebVector?
kinuko 2014/01/14 16:51:59 Ah sure... sounds better. I was biased by base::Wa
+ base::WaitableEvent** events = new base::WaitableEvent*[event_count];
+ for (size_t i = 0; i < event_count; ++i)
+ events[i] = static_cast<WebWaitableEventImpl*>(web_events[i])->impl();
+ size_t idx = base::WaitableEvent::WaitMany(events, event_count);
+ DCHECK_LT(idx, event_count);
+ 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