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

Side by Side Diff: chrome/browser/android/data_usage/external_data_use_observer.h

Issue 1491793002: Add histograms for ExternalDataUseObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bool MatchesAppPackageName(const std::string& app_package_name, 96 bool MatchesAppPackageName(const std::string& app_package_name,
97 std::string* label) const; 97 std::string* label) const;
98 98
99 DataUseTabModel* data_use_tab_model() const { 99 DataUseTabModel* data_use_tab_model() const {
100 return data_use_tab_model_.get(); 100 return data_use_tab_model_.get();
101 } 101 }
102 102
103 private: 103 private:
104 friend class DataUseTabModelTest; 104 friend class DataUseTabModelTest;
105 friend class ExternalDataUseObserverTest; 105 friend class ExternalDataUseObserverTest;
106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, DataUseReportTimedOut);
106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex);
107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); 108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex);
108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex);
109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex);
110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, LabelRemoved); 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, LabelRemoved);
111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); 112 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules);
112 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); 113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly);
113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest,
114 TimestampsMergedCorrectly); 115 TimestampsMergedCorrectly);
115 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); 116 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // expressions are applied to the request URLs, and filtered data use is 272 // expressions are applied to the request URLs, and filtered data use is
272 // notified to |j_external_data_use_observer_|. 273 // notified to |j_external_data_use_observer_|.
273 base::android::ScopedJavaGlobalRef<jobject> j_external_data_use_observer_; 274 base::android::ScopedJavaGlobalRef<jobject> j_external_data_use_observer_;
274 275
275 // Maintains tab sessions. 276 // Maintains tab sessions.
276 scoped_ptr<DataUseTabModel> data_use_tab_model_; 277 scoped_ptr<DataUseTabModel> data_use_tab_model_;
277 278
278 // True if callback from |FetchMatchingRulesDone| is currently pending. 279 // True if callback from |FetchMatchingRulesDone| is currently pending.
279 bool matching_rules_fetch_pending_; 280 bool matching_rules_fetch_pending_;
280 281
281 // True if callback from |SubmitDataUseReportCallback| is currently pending. 282 // Time when the currently pending data use report was submitted.
282 bool submit_data_report_pending_; 283 // |last_data_report_submitted_| is null if no data use report is currently
sclittle 2015/12/02 19:07:54 The NULL timeticks is a valid, real time; it shoul
tbansal1 2015/12/03 03:19:45 That applies only when doing Maths with TimeTicks.
284 // pending.
285 base::TimeTicks last_data_report_submitted_;
sclittle 2015/12/02 19:07:54 nit: Name this so that it's obvious it's a point i
tbansal1 2015/12/03 03:19:45 Done.
286
287 // |pending_report_bytes_| is the total byte count in the data use report that
288 // is currently pending. |pending_report_bytes_| is 0 if no data use report is
sclittle 2015/12/02 19:07:54 FYI: Be careful here - the DataUseAggregator could
tbansal1 2015/12/03 03:19:45 Added an early return statement to filter out repo
289 // currently pending.
290 int64_t pending_report_bytes_;
283 291
284 // Contains matching rules. 292 // Contains matching rules.
285 std::vector<scoped_ptr<MatchingRule>> matching_rules_; 293 std::vector<scoped_ptr<MatchingRule>> matching_rules_;
286 294
287 // Buffered data reports that need to be submitted to the Java data use 295 // Buffered data reports that need to be submitted to the Java data use
288 // observer. 296 // observer.
289 DataUseReports buffered_data_reports_; 297 DataUseReports buffered_data_reports_;
290 298
291 // True if |this| is currently registered as a data use observer. 299 // True if |this| is currently registered as a data use observer.
292 bool registered_as_observer_; 300 bool registered_as_observer_;
(...skipping 16 matching lines...) Expand all
309 // reports. 317 // reports.
310 int64_t total_bytes_buffered_; 318 int64_t total_bytes_buffered_;
311 319
312 // Duration after which matching rules are periodically fetched. 320 // Duration after which matching rules are periodically fetched.
313 const base::TimeDelta fetch_matching_rules_duration_; 321 const base::TimeDelta fetch_matching_rules_duration_;
314 322
315 // Minimum number of bytes that should be buffered before a data use report is 323 // Minimum number of bytes that should be buffered before a data use report is
316 // submitted. 324 // submitted.
317 const int64_t data_use_report_min_bytes_; 325 const int64_t data_use_report_min_bytes_;
318 326
327 // If a data use report is pending for more than |data_report_submit_timeout_|
328 // duration, it is considered as timed out.
329 const base::TimeDelta data_report_submit_timeout_;
330
319 base::ThreadChecker thread_checker_; 331 base::ThreadChecker thread_checker_;
320 332
321 // |io_weak_factory_| and |ui_weak_factory_| are used for posting tasks on the 333 // |io_weak_factory_| and |ui_weak_factory_| are used for posting tasks on the
322 // IO and UI thread, respectively. 334 // IO and UI thread, respectively.
323 base::WeakPtrFactory<ExternalDataUseObserver> io_weak_factory_; 335 base::WeakPtrFactory<ExternalDataUseObserver> io_weak_factory_;
324 base::WeakPtrFactory<ExternalDataUseObserver> ui_weak_factory_; 336 base::WeakPtrFactory<ExternalDataUseObserver> ui_weak_factory_;
325 337
326 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); 338 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver);
327 }; 339 };
328 340
329 bool RegisterExternalDataUseObserver(JNIEnv* env); 341 bool RegisterExternalDataUseObserver(JNIEnv* env);
330 342
331 } // namespace android 343 } // namespace android
332 344
333 } // namespace chrome 345 } // namespace chrome
334 346
335 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ 347 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698