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

Side by Side Diff: components/metrics/metrics_data_use_measurements.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_METRICS_METRICS_DATA_USE_MEASUREMENT_H_
6 #define COMPONENTS_METRICS_METRICS_DATA_USE_MEASUREMENT_H_
7
8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/prefs/pref_service.h"
11
12 namespace metrics {
13
14 class MetricsDataUseMeasurements{
15 public:
16 static void Initialize(PrefService* local_state);
17 static MetricsDataUseMeasurements* GetInstance();
18
19 void UpdateMetricsUsagePrefs(const std::string& service_name, int message_size );
Alexei Svitkine (slow) 2016/03/18 22:23:30 Suggest running "git cl format" on your CL.
gayane -on leave until 09-2017 2016/03/29 16:06:20 hmm, didn't notice it didn't apply to new files
20 bool CanUploadUMALog(int log_bytes);
21
22 ~MetricsDataUseMeasurements();
23 private:
24 FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckUpdateUsagePref) ;
25 FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckRemoveExpiredEnt ries);
26 FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckTotalDataUse);
27 FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckCanUploadUMALog) ;
28 MetricsDataUseMeasurements(PrefService* local_state);
29
30 void UpdateMetricsUsagePrefsOnUIThread(const std::string& service_name, int me ssage_size);
31 void SetMeasurementDateForTesting(std::string date);
32 void RemoveExpiredEntries();
33 void UpdateUsagePref(const std::string& pref_name, int message_size);
34 std::string GetCurrentMeasurementDate();
35 int GetUmaQouta();
36 double GetUmaRatio();
37 int TotalDataUse(std::string pref_name);
38 void RemoveExpiredEntriesForPref(std::string pref_name);
39
40 PrefService* local_state_;
41 std::string date_for_testing_;
42 base::WeakPtrFactory<MetricsDataUseMeasurements> self_ptr_factory_;
Alexei Svitkine (slow) 2016/03/18 22:23:30 Nit: weak_ptr_factory_
gayane -on leave until 09-2017 2016/03/29 16:06:20 Done.
43 };
44
45 }// namespace metrics
46 #endif // COMPONENTS_METRICS_METRICS_DATA_USE_MEASUREMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698