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

Unified Diff: components/metrics/metrics_service.h

Issue 1818613002: Implement UMA log throttling for cellular connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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: components/metrics/metrics_service.h
diff --git a/components/metrics/metrics_service.h b/components/metrics/metrics_service.h
index ce4102b8dfa36408fe037bd6772184d759a48a4e..c95b9a31b668c4e2a54c69d546ed4d0af7f3751f 100644
--- a/components/metrics/metrics_service.h
+++ b/components/metrics/metrics_service.h
@@ -27,6 +27,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/metrics/clean_exit_beacon.h"
+#include "components/metrics/data_use_tracker.h"
#include "components/metrics/metrics_log.h"
#include "components/metrics/metrics_log_manager.h"
#include "components/metrics/metrics_provider.h"
@@ -80,6 +81,12 @@ class MetricsService : public base::HistogramFlattener {
MetricsService(MetricsStateManager* state_manager,
MetricsServiceClient* client,
PrefService* local_state);
+
+ // Creates the MetricsService as above with given |cellular_callback|
+ MetricsService(MetricsStateManager* state_manager,
+ MetricsServiceClient* client,
+ PrefService* local_state,
+ base::Callback<void(bool*)> cellular_callback);
~MetricsService() override;
// Initializes metrics recording state. Updates various bookkeeping values in
@@ -214,6 +221,10 @@ class MetricsService : public base::HistogramFlattener {
// Pushes a log that has been generated by an external component.
void PushExternalLog(const std::string& log);
+ // Returns a callback to data use pref updating function which can be called
+ // from any thread, but this function should be called on UI thread.
Alexei Svitkine (slow) 2016/03/31 22:18:03 Nit: Remove extra space before "this"
gayane -on leave until 09-2017 2016/04/01 19:49:31 Done.
+ UpdateUsagePrefCallbackType GetDataUseForwardingCallback();
+
protected:
// Exposed for testing.
MetricsLogManager* log_manager() { return &log_manager_; }
@@ -468,7 +479,7 @@ class MetricsService : public base::HistogramFlattener {
// Execution phase the browser is in.
static ExecutionPhase execution_phase_;
- // Reduntant marker to check that we completed our shutdown, and set the
+ // Redundant marker to check that we completed our shutdown, and set the
// exited-cleanly bit in the prefs.
static ShutdownCleanliness clean_shutdown_status_;
@@ -477,6 +488,13 @@ class MetricsService : public base::HistogramFlattener {
PermutedEntropyCacheClearedWhenLowEntropyReset);
FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial);
+ // Assigns true to output param if current connection type is cellular and
+ // user is assigned to experimental group for enabled cellular uploads.
+ base::Callback<void(bool*)> cellular_callback_;
+
+ // Pointer used for obtaining data use pref updater callback on above layers.
+ scoped_ptr<DataUseTracker> data_use_tracker_;
+
// Weak pointers factory used to post task on different threads. All weak
// pointers managed by this factory have the same lifetime as MetricsService.
base::WeakPtrFactory<MetricsService> self_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698