| OLD | NEW |
| 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents( | 572 blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents( |
| 573 const blink::WebVector<blink::WebWaitableEvent*>& web_events) { | 573 const blink::WebVector<blink::WebWaitableEvent*>& web_events) { |
| 574 std::vector<base::WaitableEvent*> events; | 574 std::vector<base::WaitableEvent*> events; |
| 575 for (size_t i = 0; i < web_events.size(); ++i) | 575 for (size_t i = 0; i < web_events.size(); ++i) |
| 576 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl()); | 576 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl()); |
| 577 size_t idx = base::WaitableEvent::WaitMany(events.data(), events.size()); | 577 size_t idx = base::WaitableEvent::WaitMany(events.data(), events.size()); |
| 578 DCHECK_LT(idx, web_events.size()); | 578 DCHECK_LT(idx, web_events.size()); |
| 579 return web_events[idx]; | 579 return web_events[idx]; |
| 580 } | 580 } |
| 581 | 581 |
| 582 void BlinkPlatformImpl::histogramCustomCounts( | |
| 583 const char* name, int sample, int min, int max, int bucket_count) { | |
| 584 // Copied from histogram macro, but without the static variable caching | |
| 585 // the histogram because name is dynamic. | |
| 586 base::HistogramBase* counter = | |
| 587 base::Histogram::FactoryGet(name, min, max, bucket_count, | |
| 588 base::HistogramBase::kUmaTargetedHistogramFlag); | |
| 589 DCHECK_EQ(name, counter->histogram_name()); | |
| 590 counter->Add(sample); | |
| 591 } | |
| 592 | |
| 593 void BlinkPlatformImpl::histogramEnumeration( | 582 void BlinkPlatformImpl::histogramEnumeration( |
| 594 const char* name, int sample, int boundary_value) { | 583 const char* name, int sample, int boundary_value) { |
| 595 // Copied from histogram macro, but without the static variable caching | 584 // Copied from histogram macro, but without the static variable caching |
| 596 // the histogram because name is dynamic. | 585 // the histogram because name is dynamic. |
| 597 base::HistogramBase* counter = | 586 base::HistogramBase* counter = |
| 598 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 587 base::LinearHistogram::FactoryGet(name, 1, boundary_value, |
| 599 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 588 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); |
| 600 DCHECK_EQ(name, counter->histogram_name()); | 589 DCHECK_EQ(name, counter->histogram_name()); |
| 601 counter->Add(sample); | 590 counter->Add(sample); |
| 602 } | 591 } |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1187 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 1199 static_cast<ui::DomKey>(dom_key))); | 1188 static_cast<ui::DomKey>(dom_key))); |
| 1200 } | 1189 } |
| 1201 | 1190 |
| 1202 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1191 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 1203 return static_cast<int>( | 1192 return static_cast<int>( |
| 1204 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1193 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 1205 } | 1194 } |
| 1206 | 1195 |
| 1207 } // namespace content | 1196 } // namespace content |
| OLD | NEW |