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

Unified Diff: components/ukm/public/ukm_entry_builder.h

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/interfaces/ukm_interface.mojom ('k') | components/ukm/public/ukm_entry_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ukm/public/ukm_entry_builder.h
diff --git a/components/ukm/ukm_entry_builder.h b/components/ukm/public/ukm_entry_builder.h
similarity index 71%
rename from components/ukm/ukm_entry_builder.h
rename to components/ukm/public/ukm_entry_builder.h
index e2400ee5cb5afe47e7022ad343735a6a0dc58225..242a79f3630dfe00af5445a1c6bc2607b54d5e0b 100644
--- a/components/ukm/ukm_entry_builder.h
+++ b/components/ukm/public/ukm_entry_builder.h
@@ -8,19 +8,18 @@
#include <string>
#include "base/macros.h"
-#include "components/ukm/ukm_service.h"
+#include "components/ukm/public/interfaces/ukm_interface.mojom.h"
namespace ukm {
-class UkmEntry;
-class UkmService;
+typedef int64_t SourceId;
-// The builder that builds UkmEntry and adds it to UkmService.
+// The builder that builds UkmEntry and adds it to UkmRecorder.
// The example usage is:
//
// {
// unique_ptr<UkmEntryBuilder> builder =
-// ukm_service->GetEntryBuilder(source_id, "PageLoad");
+// ukm_recorder->GetEntryBuilder(source_id, "PageLoad");
// builder->AddMetric("NavigationStart", navigation_start_time);
// builder->AddMetric("ResponseStart", response_start_time);
// builder->AddMetric("FirstPaint", first_paint_time);
@@ -31,20 +30,18 @@ class UkmService;
// UkmEntry to UkmService upon destruction when going out of scope.
class UkmEntryBuilder {
public:
+ using AddEntryCallback = base::Callback<void(mojom::UkmEntryPtr)>;
+ UkmEntryBuilder(const AddEntryCallback& callback,
+ ukm::SourceId source_id,
+ const char* event_name);
+ ~UkmEntryBuilder();
+
// Add metric to the entry. A metric contains a metric name and value.
void AddMetric(const char* metric_name, int64_t value);
- ~UkmEntryBuilder();
-
private:
- friend class UkmService;
-
- UkmEntryBuilder(const UkmService::AddEntryCallback& callback,
- int32_t source_id,
- const char* event_name);
-
- UkmService::AddEntryCallback add_entry_callback_;
- std::unique_ptr<UkmEntry> entry_;
+ AddEntryCallback add_entry_callback_;
+ mojom::UkmEntryPtr entry_;
DISALLOW_COPY_AND_ASSIGN(UkmEntryBuilder);
};
« no previous file with comments | « components/ukm/public/interfaces/ukm_interface.mojom ('k') | components/ukm/public/ukm_entry_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698