Chromium Code Reviews| 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(); |