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

Unified Diff: chrome/browser/io_thread.cc

Issue 1390993005: Amortize data usage using TrafficStats on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data_use_buffering
Patch Set: Simplified and polished design, still ironing out tests Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index cd92dbbecc9983922294f4b0ba6bec6c886be996..e7814e2428147dabb40a564e39e619fea61ed306 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -43,6 +43,7 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h"
+#include "components/data_usage/core/data_use_amortizer.h"
#include "components/net_log/chrome_net_log.h"
#include "components/policy/core/common/policy_service.h"
#include "components/proxy_config/pref_proxy_config_tracker.h"
@@ -115,6 +116,7 @@
#include "base/android/build_info.h"
#include "chrome/browser/android/datausage/external_data_use_observer.h"
#include "chrome/browser/android/net/external_estimate_provider_android.h"
+#include "components/data_usage/android/traffic_stats_amortizer.h"
#endif
#if defined(OS_CHROMEOS)
@@ -606,9 +608,15 @@ void IOThread::Init() {
extension_event_router_forwarder_;
#endif
+ scoped_ptr<data_usage::DataUseAmortizer> data_use_amortizer;
+#if defined(OS_ANDROID)
+ data_use_amortizer.reset(new data_usage::android::TrafficStatsAmortizer());
bengr 2015/11/10 18:12:50 It would be better if you didn't specialize for An
tbansal1 2015/11/10 18:53:55 Why can this not be constructed in DataUseAggregat
sclittle 2015/11/11 02:10:07 I don't think I understand what you mean. It has t
sclittle 2015/11/11 02:10:07 Because the DataUseAggregator doesn't have visibil
bengr 2015/11/11 15:41:37 I was hoping that you could set up the platform sp
+#endif
+
data_use_aggregator_.reset(new data_usage::DataUseAggregator(
scoped_ptr<data_usage::DataUseAnnotator>(
- new chrome_browser_data_usage::TabIdAnnotator())));
+ new chrome_browser_data_usage::TabIdAnnotator()),
+ data_use_amortizer.Pass()));
// TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
// is fixed.

Powered by Google App Engine
This is Rietveld 408576698