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

Unified Diff: components/ukm/public/ukm_recorder.cc

Issue 2893943004: Refactor UKM interface for mojo-ification (Closed)
Patch Set: Fixed contextualsearch Created 3 years, 7 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
« no previous file with comments | « components/ukm/public/ukm_recorder.h ('k') | components/ukm/test_ukm_recorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ukm/public/ukm_recorder.cc
diff --git a/components/ukm/public/ukm_recorder.cc b/components/ukm/public/ukm_recorder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b088e81ab60db982a1f595b8a50fe2df1171359f
--- /dev/null
+++ b/components/ukm/public/ukm_recorder.cc
@@ -0,0 +1,34 @@
+// 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 "components/ukm/public/ukm_recorder.h"
+
+#include "base/atomic_sequence_num.h"
+#include "base/bind.h"
+#include "base/feature_list.h"
+#include "base/memory/ptr_util.h"
+#include "components/ukm/public/ukm_entry_builder.h"
+
+namespace ukm {
+
+const base::Feature kUkmFeature = {"Ukm", base::FEATURE_DISABLED_BY_DEFAULT};
+
+UkmRecorder::UkmRecorder() = default;
+UkmRecorder::~UkmRecorder() = default;
+
+// static
+ukm::SourceId UkmRecorder::GetNewSourceID() {
+ static base::StaticAtomicSequenceNumber seq;
+ return static_cast<ukm::SourceId>(seq.GetNext());
+}
+
+std::unique_ptr<UkmEntryBuilder> UkmRecorder::GetEntryBuilder(
+ ukm::SourceId source_id,
+ const char* event_name) {
+ return base::MakeUnique<UkmEntryBuilder>(
+ base::Bind(&UkmRecorder::AddEntry, base::Unretained(this)), source_id,
+ event_name);
+}
+
+} // namespace ukm
« no previous file with comments | « components/ukm/public/ukm_recorder.h ('k') | components/ukm/test_ukm_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698