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

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

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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "net/base/data_url.h" 60 #include "net/base/data_url.h"
61 #include "net/base/ip_address_number.h" 61 #include "net/base/ip_address_number.h"
62 #include "net/base/net_errors.h" 62 #include "net/base/net_errors.h"
63 #include "net/base/port_util.h" 63 #include "net/base/port_util.h"
64 #include "third_party/WebKit/public/platform/WebData.h" 64 #include "third_party/WebKit/public/platform/WebData.h"
65 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 65 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
66 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" 66 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h"
67 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 67 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
68 #include "third_party/WebKit/public/platform/WebString.h" 68 #include "third_party/WebKit/public/platform/WebString.h"
69 #include "third_party/WebKit/public/platform/WebURL.h" 69 #include "third_party/WebKit/public/platform/WebURL.h"
70 #include "third_party/WebKit/public/platform/WebWaitableEvent.h"
71 #include "ui/base/layout.h" 70 #include "ui/base/layout.h"
72 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" 71 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
73 #include "ui/events/keycodes/dom/keycode_converter.h" 72 #include "ui/events/keycodes/dom/keycode_converter.h"
74 73
75 using blink::WebData; 74 using blink::WebData;
76 using blink::WebFallbackThemeEngine; 75 using blink::WebFallbackThemeEngine;
77 using blink::WebLocalizedString; 76 using blink::WebLocalizedString;
78 using blink::WebString; 77 using blink::WebString;
79 using blink::WebThemeEngine; 78 using blink::WebThemeEngine;
80 using blink::WebURL; 79 using blink::WebURL;
81 using blink::WebURLError; 80 using blink::WebURLError;
82 using blink::WebURLLoader; 81 using blink::WebURLLoader;
83 using scheduler::WebThreadImplForWorkerScheduler; 82 using scheduler::WebThreadImplForWorkerScheduler;
84 83
85 namespace content { 84 namespace content {
86 85
87 namespace { 86 namespace {
88 87
89 class WebWaitableEventImpl : public blink::WebWaitableEvent {
90 public:
91 WebWaitableEventImpl(ResetPolicy policy, InitialState state) {
92 bool manual_reset = policy == ResetPolicy::Manual;
93 bool initially_signaled = state == InitialState::Signaled;
94 impl_.reset(new base::WaitableEvent(manual_reset, initially_signaled));
95 }
96 ~WebWaitableEventImpl() override {}
97
98 void reset() override { impl_->Reset(); }
99 void wait() override { impl_->Wait(); }
100 void signal() override { impl_->Signal(); }
101
102 base::WaitableEvent* impl() {
103 return impl_.get();
104 }
105
106 private:
107 scoped_ptr<base::WaitableEvent> impl_;
108 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl);
109 };
110 88
111 } // namespace 89 } // namespace
112 90
113 static int ToMessageID(WebLocalizedString::Name name) { 91 static int ToMessageID(WebLocalizedString::Name name) {
114 switch (name) { 92 switch (name) {
115 case WebLocalizedString::AXAMPMFieldText: 93 case WebLocalizedString::AXAMPMFieldText:
116 return IDS_AX_AM_PM_FIELD_TEXT; 94 return IDS_AX_AM_PM_FIELD_TEXT;
117 case WebLocalizedString::AXButtonActionVerb: 95 case WebLocalizedString::AXButtonActionVerb:
118 return IDS_AX_BUTTON_ACTION_VERB; 96 return IDS_AX_BUTTON_ACTION_VERB;
119 case WebLocalizedString::AXCalendarShowMonthSelector: 97 case WebLocalizedString::AXCalendarShowMonthSelector:
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 scheduler::WebThreadBase* compositor_thread) { 480 scheduler::WebThreadBase* compositor_thread) {
503 compositor_thread_ = compositor_thread; 481 compositor_thread_ = compositor_thread;
504 if (compositor_thread_) 482 if (compositor_thread_)
505 WaitUntilWebThreadTLSUpdate(compositor_thread_); 483 WaitUntilWebThreadTLSUpdate(compositor_thread_);
506 } 484 }
507 485
508 blink::WebThread* BlinkPlatformImpl::currentThread() { 486 blink::WebThread* BlinkPlatformImpl::currentThread() {
509 return static_cast<blink::WebThread*>(current_thread_slot_.Get()); 487 return static_cast<blink::WebThread*>(current_thread_slot_.Get());
510 } 488 }
511 489
512 blink::WebWaitableEvent* BlinkPlatformImpl::createWaitableEvent(
513 blink::WebWaitableEvent::ResetPolicy policy,
514 blink::WebWaitableEvent::InitialState state) {
515 return new WebWaitableEventImpl(policy, state);
516 }
517
518 blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents(
519 const blink::WebVector<blink::WebWaitableEvent*>& web_events) {
520 std::vector<base::WaitableEvent*> events;
521 for (size_t i = 0; i < web_events.size(); ++i)
522 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl());
523 size_t idx = base::WaitableEvent::WaitMany(events.data(), events.size());
524 DCHECK_LT(idx, web_events.size());
525 return web_events[idx];
526 }
527
528 void BlinkPlatformImpl::registerMemoryDumpProvider( 490 void BlinkPlatformImpl::registerMemoryDumpProvider(
529 blink::WebMemoryDumpProvider* wmdp, const char* name) { 491 blink::WebMemoryDumpProvider* wmdp, const char* name) {
530 WebMemoryDumpProviderAdapter* wmdp_adapter = 492 WebMemoryDumpProviderAdapter* wmdp_adapter =
531 new WebMemoryDumpProviderAdapter(wmdp); 493 new WebMemoryDumpProviderAdapter(wmdp);
532 bool did_insert = 494 bool did_insert =
533 memory_dump_providers_.add(wmdp, make_scoped_ptr(wmdp_adapter)).second; 495 memory_dump_providers_.add(wmdp, make_scoped_ptr(wmdp_adapter)).second;
534 if (!did_insert) 496 if (!did_insert)
535 return; 497 return;
536 wmdp_adapter->set_is_registered(true); 498 wmdp_adapter->set_is_registered(true);
537 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 499 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 1054 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
1093 static_cast<ui::DomKey>(dom_key))); 1055 static_cast<ui::DomKey>(dom_key)));
1094 } 1056 }
1095 1057
1096 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 1058 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
1097 return static_cast<int>( 1059 return static_cast<int>(
1098 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); 1060 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8()));
1099 } 1061 }
1100 1062
1101 } // namespace content 1063 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | third_party/WebKit/Source/core/html/parser/HTMLParserThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698