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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 1225243002: WebWaitableEvent: implement new API with ResetPolicy and InitialState arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reflect blink side update Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 using blink::WebURL; 83 using blink::WebURL;
84 using blink::WebURLError; 84 using blink::WebURLError;
85 using blink::WebURLLoader; 85 using blink::WebURLLoader;
86 86
87 namespace content { 87 namespace content {
88 88
89 namespace { 89 namespace {
90 90
91 class WebWaitableEventImpl : public blink::WebWaitableEvent { 91 class WebWaitableEventImpl : public blink::WebWaitableEvent {
92 public: 92 public:
93 WebWaitableEventImpl() : impl_(new base::WaitableEvent(false, false)) {} 93 WebWaitableEventImpl(Reset reset, InitialState state) {
94 virtual ~WebWaitableEventImpl() {} 94 bool manual_reset = reset == Reset::Manual;
95 bool initially_signaled = state == InitialState::Signaled;
96 impl_.reset(new base::WaitableEvent(manual_reset, initially_signaled));
97 }
98 ~WebWaitableEventImpl() override {}
95 99
96 virtual void wait() { impl_->Wait(); } 100 void reset() override { impl_->Reset(); }
Takashi Toyoshima 2015/07/09 08:18:32 Oh, I should not use override in blink API. I'll r
97 virtual void signal() { impl_->Signal(); } 101 void wait() override { impl_->Wait(); }
102 void signal() override { impl_->Signal(); }
98 103
99 base::WaitableEvent* impl() { 104 base::WaitableEvent* impl() {
100 return impl_.get(); 105 return impl_.get();
101 } 106 }
102 107
103 private: 108 private:
104 scoped_ptr<base::WaitableEvent> impl_; 109 scoped_ptr<base::WaitableEvent> impl_;
105 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl); 110 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl);
106 }; 111 };
107 112
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 537 }
533 538
534 blink::WebThread* BlinkPlatformImpl::currentThread() { 539 blink::WebThread* BlinkPlatformImpl::currentThread() {
535 return static_cast<blink::WebThread*>(current_thread_slot_.Get()); 540 return static_cast<blink::WebThread*>(current_thread_slot_.Get());
536 } 541 }
537 542
538 void BlinkPlatformImpl::yieldCurrentThread() { 543 void BlinkPlatformImpl::yieldCurrentThread() {
539 base::PlatformThread::YieldCurrentThread(); 544 base::PlatformThread::YieldCurrentThread();
540 } 545 }
541 546
547 // TODO(toyoshim): Remove no arguments version after the transition.
542 blink::WebWaitableEvent* BlinkPlatformImpl::createWaitableEvent() { 548 blink::WebWaitableEvent* BlinkPlatformImpl::createWaitableEvent() {
543 return new WebWaitableEventImpl(); 549 return new WebWaitableEventImpl(
550 blink::WebWaitableEvent::Reset::Auto,
551 blink::WebWaitableEvent::InitialState::NonSignaled);
552 }
553
554 blink::WebWaitableEvent* BlinkPlatformImpl::createWaitableEvent(
555 blink::WebWaitableEvent::Reset reset,
556 blink::WebWaitableEvent::InitialState state) {
557 return new WebWaitableEventImpl(reset, state);
544 } 558 }
545 559
546 blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents( 560 blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents(
547 const blink::WebVector<blink::WebWaitableEvent*>& web_events) { 561 const blink::WebVector<blink::WebWaitableEvent*>& web_events) {
548 std::vector<base::WaitableEvent*> events; 562 std::vector<base::WaitableEvent*> events;
549 for (size_t i = 0; i < web_events.size(); ++i) 563 for (size_t i = 0; i < web_events.size(); ++i)
550 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl()); 564 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl());
551 size_t idx = base::WaitableEvent::WaitMany( 565 size_t idx = base::WaitableEvent::WaitMany(
552 vector_as_array(&events), events.size()); 566 vector_as_array(&events), events.size());
553 DCHECK_LT(idx, web_events.size()); 567 DCHECK_LT(idx, web_events.size());
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( 1387 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString(
1374 static_cast<ui::DomCode>(dom_code))); 1388 static_cast<ui::DomCode>(dom_code)));
1375 } 1389 }
1376 1390
1377 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { 1391 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) {
1378 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( 1392 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode(
1379 code.utf8().data())); 1393 code.utf8().data()));
1380 } 1394 }
1381 1395
1382 } // namespace content 1396 } // namespace content
OLDNEW
« content/child/blink_platform_impl.h ('K') | « content/child/blink_platform_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698