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

Unified Diff: base/metrics/single_value_histograms.cc

Issue 2687583002: Add support for single sample metrics. (Closed)
Patch Set: Use thread local storage. Created 3 years, 8 months 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
Index: base/metrics/single_value_histograms.cc
diff --git a/base/metrics/single_value_histograms.cc b/base/metrics/single_value_histograms.cc
new file mode 100644
index 0000000000000000000000000000000000000000..79ba94ec7e8673c696ac2e19133809008cb40220
--- /dev/null
+++ b/base/metrics/single_value_histograms.cc
@@ -0,0 +1,26 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/metrics/single_value_histograms.h"
+
+namespace base {
+
+static SingleValueHistogramsFactory* g_factory = nullptr;
+
+// TODO(dalecurtis): What to do about tests that don't have a ChildThread? Now
+// we'd need all run_all_unittests.cc to set this up, which is annoying...
Alexei Svitkine (slow) 2017/04/26 18:12:53 Can we have a default factor that creates instance
DaleCurtis 2017/04/29 00:30:35 Done; this also allows reuse of the default implem
+
+// static
+SingleValueHistogramsFactory* SingleValueHistogramsFactory::Get() {
+ return g_factory;
+}
+
+// static
+void SingleValueHistogramsFactory::SetFactory(
+ SingleValueHistogramsFactory* factory) {
+ DCHECK(!g_factory);
+ g_factory = factory;
+}
+
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698