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

Unified Diff: components/ukm/ukm_service.h

Issue 2671603002: Add network information to UKM (Closed)
Patch Set: fix comments and includes Created 3 years, 10 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/metrics/test_metrics_provider.cc ('k') | components/ukm/ukm_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ukm/ukm_service.h
diff --git a/components/ukm/ukm_service.h b/components/ukm/ukm_service.h
index d154c7ce1f9b43fba5a2bd05a3baea232e9fbd0c..181ad085a46d32321a7c8774a2449a3911163757 100644
--- a/components/ukm/ukm_service.h
+++ b/components/ukm/ukm_service.h
@@ -7,12 +7,14 @@
#include <stddef.h>
#include <memory>
+#include <vector>
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "build/build_config.h"
+#include "components/metrics/metrics_provider.h"
#include "components/metrics/metrics_reporting_scheduler.h"
#include "components/metrics/persisted_logs.h"
@@ -31,7 +33,7 @@ class UkmSource;
// This feature controls whether UkmService should be created.
extern const base::Feature kUkmFeature;
-// The Url-Keyed Metrics (UKM) service is responsible for gathering and
+// The URL-Keyed Metrics (UKM) service is responsible for gathering and
// uploading reports that contain fine grained performance metrics including
// URLs for top-level navigations.
class UkmService : public base::SupportsWeakPtr<UkmService> {
@@ -45,7 +47,7 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
// Initializes the UKM service.
void Initialize();
- // Enable/disable transmission of accumulated logs. Logs that have already
+ // Enables/disables transmission of accumulated logs. Logs that have already
// been created will remain persisted to disk.
void EnableReporting();
void DisableReporting();
@@ -54,12 +56,17 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
// until periodically serialized for upload, and then deleted.
void RecordSource(std::unique_ptr<UkmSource> source);
- // Record any collected data into logs, and write to disk.
+ // Records any collected data into logs, and writes to disk.
void Flush();
- // Delete any unsent local data.
+ // Deletes any unsent local data.
void Purge();
+ // Registers the specified |provider| to provide additional metrics into the
+ // UKM log. Should be called during MetricsService initialization only.
+ void RegisterMetricsProvider(
+ std::unique_ptr<metrics::MetricsProvider> provider);
+
// Registers the names of all of the preferences used by UkmService in
// the provided PrefRegistry.
static void RegisterPrefs(PrefRegistrySimple* registry);
@@ -70,7 +77,7 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
}
private:
- // Start metrics client initialization.
+ // Starts metrics client initialization.
void StartInitTask();
// Called when initialization tasks are complete, to notify the scheduler
@@ -84,7 +91,7 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
// persisted_logs_.
void BuildAndStoreLog();
- // Start an upload of the next log from persisted_logs_.
+ // Starts an upload of the next log from persisted_logs_.
void StartScheduledUpload();
// Called by log_uploader_ when the an upload is completed.
@@ -100,6 +107,9 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
// instance.
metrics::MetricsServiceClient* const client_;
+ // Registered metrics providers.
+ std::vector<std::unique_ptr<metrics::MetricsProvider>> metrics_providers_;
+
// Logs that have not yet been sent.
metrics::PersistedLogs persisted_logs_;
« no previous file with comments | « components/metrics/test_metrics_provider.cc ('k') | components/ukm/ukm_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698