| Index: chrome/browser/android/data_usage/external_data_use_observer.h
|
| diff --git a/chrome/browser/android/data_usage/external_data_use_observer.h b/chrome/browser/android/data_usage/external_data_use_observer.h
|
| index 1db5416a40cdb7b20bd6ed14c9f2933d43ea67cc..57f82c496c6e98d56027169164d775d5d676bcb9 100644
|
| --- a/chrome/browser/android/data_usage/external_data_use_observer.h
|
| +++ b/chrome/browser/android/data_usage/external_data_use_observer.h
|
| @@ -9,11 +9,11 @@
|
| #include <stdint.h>
|
|
|
| #include <string>
|
| -#include <unordered_map>
|
| #include <vector>
|
|
|
| #include "base/android/jni_array.h"
|
| #include "base/android/scoped_java_ref.h"
|
| +#include "base/containers/hash_tables.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| @@ -80,6 +80,9 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| // called on UI thread.
|
| void OnReportDataUseDone(JNIEnv* env, jobject obj, bool success);
|
|
|
| + // Returns the external data use observer field trial name.
|
| + const std::string GetExternalDataUseObserverFieldTrialName() const;
|
| +
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex);
|
| @@ -93,6 +96,10 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| TimestampsMergedCorrectly);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize);
|
| + FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest,
|
| + PeriodicFetchMatchingRules);
|
| + FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports);
|
| + FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations);
|
|
|
| // DataUseReportKey is a unique identifier for a data use report.
|
| struct DataUseReportKey {
|
| @@ -182,9 +189,8 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| }
|
| };
|
|
|
| - typedef std::unordered_map<DataUseReportKey,
|
| - DataUseReport,
|
| - DataUseReportKeyHash> DataUseReports;
|
| + typedef base::hash_map<DataUseReportKey, DataUseReport, DataUseReportKeyHash>
|
| + DataUseReports;
|
|
|
| // Stores the matching rules.
|
| class MatchingRule {
|
| @@ -312,6 +318,20 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| // Time when the data use reports were last received from DataUseAggregator.
|
| base::Time previous_report_time_;
|
|
|
| + // Time when the matching rules were last fetched.
|
| + base::TimeTicks last_matching_rules_fetch_time_;
|
| +
|
| + // Total number of bytes transmitted or received across all the buffered
|
| + // reports.
|
| + int64_t total_bytes_buffered_;
|
| +
|
| + // Duration after which matching rules are periodically fetched.
|
| + const base::TimeDelta fetch_matching_rules_duration_;
|
| +
|
| + // Minimum number of bytes that should be buffered before a data use report is
|
| + // submitted.
|
| + const int64_t data_use_report_min_bytes_;
|
| +
|
| base::ThreadChecker thread_checker_;
|
|
|
| // |io_weak_factory_| and |ui_weak_factory_| are used for posting tasks on the
|
|
|