| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/webkitclient_impl.h" | 5 #include "webkit/glue/webkitclient_impl.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <malloc.h> | 8 #include <malloc.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include <math.h> | 11 #include <math.h> |
| 12 | 12 |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
| 16 #include "base/lock.h" | 16 #include "base/lock.h" |
| 17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 18 #include "base/metrics/stats_counters.h" | 18 #include "base/metrics/stats_counters.h" |
| 19 #include "base/metrics/histogram.h" |
| 19 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 20 #include "base/platform_file.h" | 21 #include "base/platform_file.h" |
| 21 #include "base/singleton.h" | 22 #include "base/singleton.h" |
| 22 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
| 23 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 24 #include "base/time.h" | 25 #include "base/time.h" |
| 25 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 26 #include "grit/webkit_resources.h" | 27 #include "grit/webkit_resources.h" |
| 27 #include "grit/webkit_strings.h" | 28 #include "grit/webkit_strings.h" |
| 28 #include "third_party/WebKit/WebKit/chromium/public/WebCookie.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebCookie.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 248 } |
| 248 | 249 |
| 249 void WebKitClientImpl::decrementStatsCounter(const char* name) { | 250 void WebKitClientImpl::decrementStatsCounter(const char* name) { |
| 250 base::StatsCounter(name).Decrement(); | 251 base::StatsCounter(name).Decrement(); |
| 251 } | 252 } |
| 252 | 253 |
| 253 void WebKitClientImpl::incrementStatsCounter(const char* name) { | 254 void WebKitClientImpl::incrementStatsCounter(const char* name) { |
| 254 base::StatsCounter(name).Increment(); | 255 base::StatsCounter(name).Increment(); |
| 255 } | 256 } |
| 256 | 257 |
| 258 void WebKitClientImpl::histogramCustomCounts( |
| 259 const char* name, int sample, int min, int max, int bucket_count) { |
| 260 // Copied from histogram macro, but without the static variable caching |
| 261 // the histogram because name is dynamic. |
| 262 scoped_refptr<base::Histogram> counter = |
| 263 base::Histogram::FactoryGet(name, min, max, bucket_count, |
| 264 base::Histogram::kUmaTargetedHistogramFlag); |
| 265 DCHECK_EQ(name, counter->histogram_name()); |
| 266 if (counter.get()) |
| 267 counter->Add(sample); |
| 268 } |
| 269 |
| 270 void WebKitClientImpl::histogramEnumeration( |
| 271 const char* name, int sample, int boundary_value) { |
| 272 // Copied from histogram macro, but without the static variable caching |
| 273 // the histogram because name is dynamic. |
| 274 scoped_refptr<base::Histogram> counter = |
| 275 base::LinearHistogram::FactoryGet(name, 1, boundary_value, |
| 276 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag); |
| 277 DCHECK_EQ(name, counter->histogram_name()); |
| 278 if (counter.get()) |
| 279 counter->Add(sample); |
| 280 } |
| 281 |
| 257 void WebKitClientImpl::traceEventBegin(const char* name, void* id, | 282 void WebKitClientImpl::traceEventBegin(const char* name, void* id, |
| 258 const char* extra) { | 283 const char* extra) { |
| 259 TRACE_EVENT_BEGIN(name, id, extra); | 284 TRACE_EVENT_BEGIN(name, id, extra); |
| 260 } | 285 } |
| 261 | 286 |
| 262 void WebKitClientImpl::traceEventEnd(const char* name, void* id, | 287 void WebKitClientImpl::traceEventEnd(const char* name, void* id, |
| 263 const char* extra) { | 288 const char* extra) { |
| 264 TRACE_EVENT_END(name, id, extra); | 289 TRACE_EVENT_END(name, id, extra); |
| 265 } | 290 } |
| 266 | 291 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 ++shared_timer_suspended_; | 528 ++shared_timer_suspended_; |
| 504 } | 529 } |
| 505 | 530 |
| 506 void WebKitClientImpl::ResumeSharedTimer() { | 531 void WebKitClientImpl::ResumeSharedTimer() { |
| 507 // The shared timer may have fired or been adjusted while we were suspended. | 532 // The shared timer may have fired or been adjusted while we were suspended. |
| 508 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) | 533 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) |
| 509 setSharedTimerFireTime(shared_timer_fire_time_); | 534 setSharedTimerFireTime(shared_timer_fire_time_); |
| 510 } | 535 } |
| 511 | 536 |
| 512 } // namespace webkit_glue | 537 } // namespace webkit_glue |
| OLD | NEW |