| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/glue/webkitplatformsupport_impl.h" | 5 #include "webkit/glue/webkitplatformsupport_impl.h" | 
| 6 | 6 | 
| 7 #include <math.h> | 7 #include <math.h> | 
| 8 | 8 | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| 11 #include "base/allocator/allocator_extension.h" | 11 #include "base/allocator/allocator_extension.h" | 
| 12 #include "base/bind.h" | 12 #include "base/bind.h" | 
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" | 
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" | 
| 15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" | 
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" | 
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" | 
|  | 18 #include "base/metrics/sparse_histogram.h" | 
| 18 #include "base/metrics/stats_counters.h" | 19 #include "base/metrics/stats_counters.h" | 
| 19 #include "base/platform_file.h" | 20 #include "base/platform_file.h" | 
| 20 #include "base/process_util.h" | 21 #include "base/process_util.h" | 
| 21 #include "base/rand_util.h" | 22 #include "base/rand_util.h" | 
| 22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" | 
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" | 
| 24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" | 
| 25 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" | 
| 26 #include "base/sys_info.h" | 27 #include "base/sys_info.h" | 
| 27 #include "base/time/time.h" | 28 #include "base/time/time.h" | 
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 436     const char* name, int sample, int boundary_value) { | 437     const char* name, int sample, int boundary_value) { | 
| 437   // Copied from histogram macro, but without the static variable caching | 438   // Copied from histogram macro, but without the static variable caching | 
| 438   // the histogram because name is dynamic. | 439   // the histogram because name is dynamic. | 
| 439   base::HistogramBase* counter = | 440   base::HistogramBase* counter = | 
| 440       base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 441       base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 
| 441           boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 442           boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 
| 442   DCHECK_EQ(name, counter->histogram_name()); | 443   DCHECK_EQ(name, counter->histogram_name()); | 
| 443   counter->Add(sample); | 444   counter->Add(sample); | 
| 444 } | 445 } | 
| 445 | 446 | 
|  | 447 void WebKitPlatformSupportImpl::histogramSparse(const char* name, int sample) { | 
|  | 448   // For sparse histograms, we can use the macro, as it does not incorporate a | 
|  | 449   // static. | 
|  | 450   UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); | 
|  | 451 } | 
|  | 452 | 
| 446 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( | 453 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( | 
| 447     const char* category_group) { | 454     const char* category_group) { | 
| 448   return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); | 455   return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); | 
| 449 } | 456 } | 
| 450 | 457 | 
| 451 long* WebKitPlatformSupportImpl::getTraceSamplingState( | 458 long* WebKitPlatformSupportImpl::getTraceSamplingState( | 
| 452     const unsigned thread_bucket) { | 459     const unsigned thread_bucket) { | 
| 453   // Not supported in split-dll build. http://crbug.com/237249 | 460   // Not supported in split-dll build. http://crbug.com/237249 | 
| 454 #if !defined(CHROME_SPLIT_DLL) | 461 #if !defined(CHROME_SPLIT_DLL) | 
| 455   switch (thread_bucket) { | 462   switch (thread_bucket) { | 
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 884   if (--shared_timer_suspended_ == 0 && | 891   if (--shared_timer_suspended_ == 0 && | 
| 885       (!shared_timer_.IsRunning() || | 892       (!shared_timer_.IsRunning() || | 
| 886        shared_timer_fire_time_was_set_while_suspended_)) { | 893        shared_timer_fire_time_was_set_while_suspended_)) { | 
| 887     shared_timer_fire_time_was_set_while_suspended_ = false; | 894     shared_timer_fire_time_was_set_while_suspended_ = false; | 
| 888     setSharedTimerFireInterval( | 895     setSharedTimerFireInterval( | 
| 889         shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 896         shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 
| 890   } | 897   } | 
| 891 } | 898 } | 
| 892 | 899 | 
| 893 }  // namespace webkit_glue | 900 }  // namespace webkit_glue | 
| OLD | NEW | 
|---|