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, | |
darin (slow to review)
2010/12/01 22:59:04
nit: when breaking a line of code, we usually inde
scheib
2010/12/01 23:28:59
Done.
| |
264 base::Histogram::kUmaTargetedHistogramFlag); | |
265 DCHECK_EQ(name, counter->histogram_name()); | |
266 if (counter.get()) counter->Add(sample); | |
darin (slow to review)
2010/12/01 22:59:04
nit: please insert a new line so that it is possib
scheib
2010/12/01 23:28:59
Done.
| |
267 } | |
268 | |
269 void WebKitClientImpl::histogramEnumeration( | |
270 const char* name, int sample, int boundary_value) { | |
271 // Copied from histogram macro, but without the static variable caching | |
272 // the histogram because name is dynamic. | |
273 scoped_refptr<base::Histogram> counter = | |
darin (slow to review)
2010/12/01 22:59:04
ditto
scheib
2010/12/01 23:28:59
Done.
| |
274 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | |
275 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag); | |
276 DCHECK_EQ(name, counter->histogram_name()); | |
277 if (counter.get()) counter->Add(sample); | |
darin (slow to review)
2010/12/01 22:59:04
ditto
scheib
2010/12/01 23:28:59
Done.
| |
278 } | |
279 | |
257 void WebKitClientImpl::traceEventBegin(const char* name, void* id, | 280 void WebKitClientImpl::traceEventBegin(const char* name, void* id, |
258 const char* extra) { | 281 const char* extra) { |
259 TRACE_EVENT_BEGIN(name, id, extra); | 282 TRACE_EVENT_BEGIN(name, id, extra); |
260 } | 283 } |
261 | 284 |
262 void WebKitClientImpl::traceEventEnd(const char* name, void* id, | 285 void WebKitClientImpl::traceEventEnd(const char* name, void* id, |
263 const char* extra) { | 286 const char* extra) { |
264 TRACE_EVENT_END(name, id, extra); | 287 TRACE_EVENT_END(name, id, extra); |
265 } | 288 } |
266 | 289 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 ++shared_timer_suspended_; | 526 ++shared_timer_suspended_; |
504 } | 527 } |
505 | 528 |
506 void WebKitClientImpl::ResumeSharedTimer() { | 529 void WebKitClientImpl::ResumeSharedTimer() { |
507 // The shared timer may have fired or been adjusted while we were suspended. | 530 // The shared timer may have fired or been adjusted while we were suspended. |
508 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) | 531 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) |
509 setSharedTimerFireTime(shared_timer_fire_time_); | 532 setSharedTimerFireTime(shared_timer_fire_time_); |
510 } | 533 } |
511 | 534 |
512 } // namespace webkit_glue | 535 } // namespace webkit_glue |
OLD | NEW |