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 2cb052439b16fae87f43a9ca64799d17e8c52dd5..8e62156e986f06892c23b0af1dea75373d4d5266 100644 |
--- a/chrome/browser/android/data_usage/external_data_use_observer.h |
+++ b/chrome/browser/android/data_usage/external_data_use_observer.h |
@@ -54,6 +54,19 @@ class DataUseTabModel; |
// TODO(tbansal): Create an inner class that manages the UI and IO threads. |
class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer { |
public: |
+ // Result of data usage report submission. |
sclittle
2015/12/08 00:36:21
nit: mention that this should be kept in sync with
tbansal1
2015/12/08 02:01:25
Done.
|
+ 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_BOUNDARY = 4 |
sclittle
2015/12/08 00:36:21
nit: isn't the typical naming for this "..._MAX"?
tbansal1
2015/12/08 02:01:25
Done. Not sure, I have seen both.
|
+ }; |
+ |
// External data use observer field trial name. |
static const char kExternalDataUseObserverFieldTrial[]; |
@@ -103,10 +116,10 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer { |
private: |
friend class DataUseTabModelTest; |
friend class ExternalDataUseObserverTest; |
- FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); |
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); |
@@ -114,6 +127,7 @@ class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer { |
FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
PeriodicFetchMatchingRules); |
FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); |
+ FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); |
FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); |
FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
TimestampsMergedCorrectly); |
@@ -279,8 +293,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_; |
@@ -317,6 +337,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_; |
// |io_weak_factory_| and |ui_weak_factory_| are used for posting tasks on the |