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

Side by Side 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: Fixed nit 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 25 matching lines...) Expand all
36 #include "chrome/browser/net/connect_interceptor.h" 36 #include "chrome/browser/net/connect_interceptor.h"
37 #include "chrome/browser/net/dns_probe_service.h" 37 #include "chrome/browser/net/dns_probe_service.h"
38 #include "chrome/browser/net/proxy_service_factory.h" 38 #include "chrome/browser/net/proxy_service_factory.h"
39 #include "chrome/common/channel_info.h" 39 #include "chrome/common/channel_info.h"
40 #include "chrome/common/chrome_content_client.h" 40 #include "chrome/common/chrome_content_client.h"
41 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
42 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
43 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" 43 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h"
44 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 44 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
45 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" 45 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h"
46 #include "components/data_usage/core/data_use_amortizer.h"
46 #include "components/net_log/chrome_net_log.h" 47 #include "components/net_log/chrome_net_log.h"
47 #include "components/policy/core/common/policy_service.h" 48 #include "components/policy/core/common/policy_service.h"
48 #include "components/proxy_config/pref_proxy_config_tracker.h" 49 #include "components/proxy_config/pref_proxy_config_tracker.h"
49 #include "components/variations/variations_associated_data.h" 50 #include "components/variations/variations_associated_data.h"
50 #include "components/version_info/version_info.h" 51 #include "components/version_info/version_info.h"
51 #include "content/public/browser/browser_thread.h" 52 #include "content/public/browser/browser_thread.h"
52 #include "content/public/browser/cookie_store_factory.h" 53 #include "content/public/browser/cookie_store_factory.h"
53 #include "content/public/common/content_switches.h" 54 #include "content/public/common/content_switches.h"
54 #include "content/public/common/user_agent.h" 55 #include "content/public/common/user_agent.h"
55 #include "net/base/external_estimate_provider.h" 56 #include "net/base/external_estimate_provider.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #endif 109 #endif
109 110
110 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 111 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
111 #include "net/cert_net/nss_ocsp.h" 112 #include "net/cert_net/nss_ocsp.h"
112 #endif 113 #endif
113 114
114 #if defined(OS_ANDROID) 115 #if defined(OS_ANDROID)
115 #include "base/android/build_info.h" 116 #include "base/android/build_info.h"
116 #include "chrome/browser/android/data_usage/external_data_use_observer.h" 117 #include "chrome/browser/android/data_usage/external_data_use_observer.h"
117 #include "chrome/browser/android/net/external_estimate_provider_android.h" 118 #include "chrome/browser/android/net/external_estimate_provider_android.h"
119 #include "components/data_usage/android/traffic_stats_amortizer.h"
118 #endif 120 #endif
119 121
120 #if defined(OS_CHROMEOS) 122 #if defined(OS_CHROMEOS)
121 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 123 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
122 #include "chromeos/network/host_resolver_impl_chromeos.h" 124 #include "chromeos/network/host_resolver_impl_chromeos.h"
123 #endif 125 #endif
124 126
125 using content::BrowserThread; 127 using content::BrowserThread;
126 128
127 class SafeBrowsingURLRequestContext; 129 class SafeBrowsingURLRequestContext;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 new LoggingNetworkChangeObserver(net_log_)); 601 new LoggingNetworkChangeObserver(net_log_));
600 602
601 // Setup the HistogramWatcher to run on the IO thread. 603 // Setup the HistogramWatcher to run on the IO thread.
602 net::NetworkChangeNotifier::InitHistogramWatcher(); 604 net::NetworkChangeNotifier::InitHistogramWatcher();
603 605
604 #if defined(ENABLE_EXTENSIONS) 606 #if defined(ENABLE_EXTENSIONS)
605 globals_->extension_event_router_forwarder = 607 globals_->extension_event_router_forwarder =
606 extension_event_router_forwarder_; 608 extension_event_router_forwarder_;
607 #endif 609 #endif
608 610
611 scoped_ptr<data_usage::DataUseAmortizer> data_use_amortizer;
612 #if defined(OS_ANDROID)
613 data_use_amortizer.reset(new data_usage::android::TrafficStatsAmortizer());
614 #endif
615
609 data_use_aggregator_.reset(new data_usage::DataUseAggregator( 616 data_use_aggregator_.reset(new data_usage::DataUseAggregator(
610 scoped_ptr<data_usage::DataUseAnnotator>( 617 scoped_ptr<data_usage::DataUseAnnotator>(
611 new chrome_browser_data_usage::TabIdAnnotator()))); 618 new chrome_browser_data_usage::TabIdAnnotator()),
619 data_use_amortizer.Pass()));
612 620
613 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 621 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
614 // is fixed. 622 // is fixed.
615 tracked_objects::ScopedTracker tracking_profile3( 623 tracked_objects::ScopedTracker tracking_profile3(
616 FROM_HERE_WITH_EXPLICIT_FUNCTION( 624 FROM_HERE_WITH_EXPLICIT_FUNCTION(
617 "466432 IOThread::InitAsync::ChromeNetworkDelegate")); 625 "466432 IOThread::InitAsync::ChromeNetworkDelegate"));
618 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate( 626 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate(
619 new ChromeNetworkDelegate(extension_event_router_forwarder(), 627 new ChromeNetworkDelegate(extension_event_router_forwarder(),
620 &system_enable_referrers_)); 628 &system_enable_referrers_));
621 // By default, data usage is considered off the record. 629 // By default, data usage is considered off the record.
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); 1665 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass();
1658 1666
1659 context->set_job_factory( 1667 context->set_job_factory(
1660 globals->proxy_script_fetcher_url_request_job_factory.get()); 1668 globals->proxy_script_fetcher_url_request_job_factory.get());
1661 1669
1662 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1670 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1663 // system URLRequestContext too. There's no reason this should be tied to a 1671 // system URLRequestContext too. There's no reason this should be tied to a
1664 // profile. 1672 // profile.
1665 return context; 1673 return context;
1666 } 1674 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698