Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: webkit/glue/webkitclient_impl.cc

Issue 5406004: histogram API of WebKitClient implemented in chromium/webkit/glue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits fixed Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webkitclient_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webkitclient_impl.cc
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index a9923551a3f922fe53252f038a914744bb84999c..12d570260a1a3ca555714e410618db58582e1e5d 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -16,6 +16,7 @@
#include "base/lock.h"
#include "base/message_loop.h"
#include "base/metrics/stats_counters.h"
+#include "base/metrics/histogram.h"
#include "base/process_util.h"
#include "base/platform_file.h"
#include "base/singleton.h"
@@ -254,6 +255,30 @@ void WebKitClientImpl::incrementStatsCounter(const char* name) {
base::StatsCounter(name).Increment();
}
+void WebKitClientImpl::histogramCustomCounts(
+ const char* name, int sample, int min, int max, int bucket_count) {
+ // Copied from histogram macro, but without the static variable caching
+ // the histogram because name is dynamic.
+ scoped_refptr<base::Histogram> counter =
+ base::Histogram::FactoryGet(name, min, max, bucket_count,
+ base::Histogram::kUmaTargetedHistogramFlag);
+ DCHECK_EQ(name, counter->histogram_name());
+ if (counter.get())
+ counter->Add(sample);
+}
+
+void WebKitClientImpl::histogramEnumeration(
+ const char* name, int sample, int boundary_value) {
+ // Copied from histogram macro, but without the static variable caching
+ // the histogram because name is dynamic.
+ scoped_refptr<base::Histogram> counter =
+ base::LinearHistogram::FactoryGet(name, 1, boundary_value,
+ boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag);
+ DCHECK_EQ(name, counter->histogram_name());
+ if (counter.get())
+ counter->Add(sample);
+}
+
void WebKitClientImpl::traceEventBegin(const char* name, void* id,
const char* extra) {
TRACE_EVENT_BEGIN(name, id, extra);
« no previous file with comments | « webkit/glue/webkitclient_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698