| 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 808960ed95827ed1951d0a6810763127bf84a64e..354b4001b5226f31e26cca0f2f4d8824ab68e306 100644
|
| --- a/chrome/browser/android/data_usage/external_data_use_observer.h
|
| +++ b/chrome/browser/android/data_usage/external_data_use_observer.h
|
| @@ -51,6 +51,20 @@ class ExternalDataUseObserverBridge;
|
| // only be accessed on IO thread.
|
| class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| public:
|
| + // Result of data usage report submission. This enum must remain synchronized
|
| + // with the enum of the same name in metrics/histograms/histograms.xml.
|
| + enum DataUsageReportSubmissionResult {
|
| + // Submission of data use report to the external observer was successful.
|
| + DATAUSAGE_REPORT_SUBMISSION_SUCCESSFUL = 0,
|
| + // Submission of data use report to the external observer returned error.
|
| + DATAUSAGE_REPORT_SUBMISSION_FAILED = 1,
|
| + // Submission of data use report to the external observer timed out.
|
| + DATAUSAGE_REPORT_SUBMISSION_TIMED_OUT = 2,
|
| + // Data use report was lost before an attempt was made to submit it.
|
| + DATAUSAGE_REPORT_SUBMISSION_LOST = 3,
|
| + DATAUSAGE_REPORT_SUBMISSION_MAX = 4
|
| + };
|
| +
|
| // External data use observer field trial name.
|
| static const char kExternalDataUseObserverFieldTrial[];
|
|
|
| @@ -101,6 +115,7 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex);
|
| + FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, DataUseReportTimedOut);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, LabelRemoved);
|
| FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules);
|
| @@ -242,8 +257,14 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| // True if callback from |FetchMatchingRulesDone| is currently pending.
|
| bool matching_rules_fetch_pending_;
|
|
|
| - // True if callback from |SubmitDataUseReportCallback| is currently pending.
|
| - bool submit_data_report_pending_;
|
| + // Time when the currently pending data use report was submitted.
|
| + // |last_data_report_submitted_ticks_| is null if no data use report is
|
| + // currently pending.
|
| + base::TimeTicks last_data_report_submitted_ticks_;
|
| +
|
| + // |pending_report_bytes_| is the total byte count in the data use report that
|
| + // is currently pending.
|
| + int64_t pending_report_bytes_;
|
|
|
| // Contains matching rules.
|
| std::vector<scoped_ptr<MatchingRule>> matching_rules_;
|
| @@ -281,6 +302,10 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer {
|
| // submitted.
|
| const int64_t data_use_report_min_bytes_;
|
|
|
| + // If a data use report is pending for more than |data_report_submit_timeout_|
|
| + // duration, it is considered as timed out.
|
| + const base::TimeDelta data_report_submit_timeout_;
|
| +
|
| base::ThreadChecker thread_checker_;
|
|
|
| base::WeakPtrFactory<ExternalDataUseObserver> weak_factory_;
|
|
|