| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 DCHECK_LT(idx, web_events.size()); | 579 DCHECK_LT(idx, web_events.size()); |
| 580 return web_events[idx]; | 580 return web_events[idx]; |
| 581 } | 581 } |
| 582 | 582 |
| 583 void BlinkPlatformImpl::decrementStatsCounter(const char* name) { | 583 void BlinkPlatformImpl::decrementStatsCounter(const char* name) { |
| 584 } | 584 } |
| 585 | 585 |
| 586 void BlinkPlatformImpl::incrementStatsCounter(const char* name) { | 586 void BlinkPlatformImpl::incrementStatsCounter(const char* name) { |
| 587 } | 587 } |
| 588 | 588 |
| 589 void BlinkPlatformImpl::histogramCustomCounts( | 589 void BlinkPlatformImpl::histogramCustomCounts(const char* name, |
| 590 const char* name, int sample, int min, int max, int bucket_count) { | 590 int sample, |
| 591 int min, |
| 592 int max, |
| 593 int bucket_count, |
| 594 HistogramCacheSlot* cache_slot) { |
| 591 // Copied from histogram macro, but without the static variable caching | 595 // Copied from histogram macro, but without the static variable caching |
| 592 // the histogram because name is dynamic. | 596 // the histogram because name is dynamic. |
| 593 base::HistogramBase* counter = | 597 base::HistogramBase* counter = 0; |
| 594 base::Histogram::FactoryGet(name, min, max, bucket_count, | 598 if (cache_slot) |
| 595 base::HistogramBase::kUmaTargetedHistogramFlag); | 599 counter = reinterpret_cast<base::HistogramBase*>(*cache_slot); |
| 600 |
| 601 if (!counter) { |
| 602 counter = base::Histogram::FactoryGet( |
| 603 name, min, max, bucket_count, |
| 604 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 605 } |
| 596 DCHECK_EQ(name, counter->histogram_name()); | 606 DCHECK_EQ(name, counter->histogram_name()); |
| 597 counter->Add(sample); | 607 counter->Add(sample); |
| 608 if (cache_slot) |
| 609 *cache_slot = counter; |
| 598 } | 610 } |
| 599 | 611 |
| 600 void BlinkPlatformImpl::histogramEnumeration( | 612 void BlinkPlatformImpl::histogramEnumeration(const char* name, |
| 601 const char* name, int sample, int boundary_value) { | 613 int sample, |
| 614 int boundary_value, |
| 615 HistogramCacheSlot* cache_slot) { |
| 602 // Copied from histogram macro, but without the static variable caching | 616 // Copied from histogram macro, but without the static variable caching |
| 603 // the histogram because name is dynamic. | 617 // the histogram because name is dynamic. |
| 604 base::HistogramBase* counter = | 618 base::HistogramBase* counter = 0; |
| 605 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 619 if (cache_slot) |
| 606 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 620 counter = reinterpret_cast<base::HistogramBase*>(*cache_slot); |
| 621 |
| 622 if (!counter) { |
| 623 counter = base::LinearHistogram::FactoryGet( |
| 624 name, 1, boundary_value, boundary_value + 1, |
| 625 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 626 } |
| 607 DCHECK_EQ(name, counter->histogram_name()); | 627 DCHECK_EQ(name, counter->histogram_name()); |
| 608 counter->Add(sample); | 628 counter->Add(sample); |
| 629 if (cache_slot) |
| 630 *cache_slot = counter; |
| 609 } | 631 } |
| 610 | 632 |
| 611 void BlinkPlatformImpl::histogramSparse(const char* name, int sample) { | 633 void BlinkPlatformImpl::histogramSparse(const char* name, |
| 634 int sample, |
| 635 HistogramCacheSlot* cache_slot) { |
| 612 // For sparse histograms, we can use the macro, as it does not incorporate a | 636 // For sparse histograms, we can use the macro, as it does not incorporate a |
| 613 // static. | 637 // static. |
| 614 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); | 638 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); |
| 615 } | 639 } |
| 616 | 640 |
| 617 void BlinkPlatformImpl::registerMemoryDumpProvider( | 641 void BlinkPlatformImpl::registerMemoryDumpProvider( |
| 618 blink::WebMemoryDumpProvider* wmdp, const char* name) { | 642 blink::WebMemoryDumpProvider* wmdp, const char* name) { |
| 619 WebMemoryDumpProviderAdapter* wmdp_adapter = | 643 WebMemoryDumpProviderAdapter* wmdp_adapter = |
| 620 new WebMemoryDumpProviderAdapter(wmdp); | 644 new WebMemoryDumpProviderAdapter(wmdp); |
| 621 bool did_insert = | 645 bool did_insert = |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1235 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 1212 static_cast<ui::DomKey>(dom_key))); | 1236 static_cast<ui::DomKey>(dom_key))); |
| 1213 } | 1237 } |
| 1214 | 1238 |
| 1215 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1239 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 1216 return static_cast<int>( | 1240 return static_cast<int>( |
| 1217 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1241 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 1218 } | 1242 } |
| 1219 | 1243 |
| 1220 } // namespace content | 1244 } // namespace content |
| OLD | NEW |