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

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: Created 5 years, 2 months 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 23 matching lines...) Expand all
34 #include "chrome/browser/net/connect_interceptor.h" 34 #include "chrome/browser/net/connect_interceptor.h"
35 #include "chrome/browser/net/dns_probe_service.h" 35 #include "chrome/browser/net/dns_probe_service.h"
36 #include "chrome/browser/net/proxy_service_factory.h" 36 #include "chrome/browser/net/proxy_service_factory.h"
37 #include "chrome/common/channel_info.h" 37 #include "chrome/common/channel_info.h"
38 #include "chrome/common/chrome_content_client.h" 38 #include "chrome/common/chrome_content_client.h"
39 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
40 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h"
42 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 42 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
43 #include "components/data_usage/core/data_use_aggregator.h" 43 #include "components/data_usage/core/data_use_aggregator.h"
44 #include "components/data_usage/core/data_use_amortizer.h"
44 #include "components/net_log/chrome_net_log.h" 45 #include "components/net_log/chrome_net_log.h"
45 #include "components/policy/core/common/policy_service.h" 46 #include "components/policy/core/common/policy_service.h"
46 #include "components/proxy_config/pref_proxy_config_tracker.h" 47 #include "components/proxy_config/pref_proxy_config_tracker.h"
47 #include "components/variations/variations_associated_data.h" 48 #include "components/variations/variations_associated_data.h"
48 #include "components/version_info/version_info.h" 49 #include "components/version_info/version_info.h"
49 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
50 #include "content/public/browser/cookie_store_factory.h" 51 #include "content/public/browser/cookie_store_factory.h"
51 #include "content/public/common/user_agent.h" 52 #include "content/public/common/user_agent.h"
52 #include "net/base/external_estimate_provider.h" 53 #include "net/base/external_estimate_provider.h"
53 #include "net/base/host_mapping_rules.h" 54 #include "net/base/host_mapping_rules.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 #include "chrome/browser/extensions/event_router_forwarder.h" 103 #include "chrome/browser/extensions/event_router_forwarder.h"
103 #endif 104 #endif
104 105
105 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 106 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
106 #include "net/cert_net/nss_ocsp.h" 107 #include "net/cert_net/nss_ocsp.h"
107 #endif 108 #endif
108 109
109 #if defined(OS_ANDROID) 110 #if defined(OS_ANDROID)
110 #include "base/android/build_info.h" 111 #include "base/android/build_info.h"
111 #include "chrome/browser/android/net/external_estimate_provider_android.h" 112 #include "chrome/browser/android/net/external_estimate_provider_android.h"
113 #include "components/data_usage/android/traffic_stats_amortizer.h"
112 #endif 114 #endif
113 115
114 #if defined(OS_CHROMEOS) 116 #if defined(OS_CHROMEOS)
115 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 117 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
116 #include "chromeos/network/host_resolver_impl_chromeos.h" 118 #include "chromeos/network/host_resolver_impl_chromeos.h"
117 #endif 119 #endif
118 120
119 using content::BrowserThread; 121 using content::BrowserThread;
120 122
121 class SafeBrowsingURLRequestContext; 123 class SafeBrowsingURLRequestContext;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 new LoggingNetworkChangeObserver(net_log_)); 563 new LoggingNetworkChangeObserver(net_log_));
562 564
563 // Setup the HistogramWatcher to run on the IO thread. 565 // Setup the HistogramWatcher to run on the IO thread.
564 net::NetworkChangeNotifier::InitHistogramWatcher(); 566 net::NetworkChangeNotifier::InitHistogramWatcher();
565 567
566 #if defined(ENABLE_EXTENSIONS) 568 #if defined(ENABLE_EXTENSIONS)
567 globals_->extension_event_router_forwarder = 569 globals_->extension_event_router_forwarder =
568 extension_event_router_forwarder_; 570 extension_event_router_forwarder_;
569 #endif 571 #endif
570 572
571 globals_->data_use_aggregator.reset(new data_usage::DataUseAggregator()); 573 scoped_ptr<data_usage::DataUseAmortizer> data_use_amortizer;
574 #if defined(OS_ANDROID)
575 data_use_amortizer.reset(new data_usage::android::TrafficStatsAmortizer());
576 #endif
577 globals_->data_use_aggregator.reset(
578 new data_usage::DataUseAggregator(data_use_amortizer.Pass()));
572 579
573 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 580 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
574 // is fixed. 581 // is fixed.
575 tracked_objects::ScopedTracker tracking_profile3( 582 tracked_objects::ScopedTracker tracking_profile3(
576 FROM_HERE_WITH_EXPLICIT_FUNCTION( 583 FROM_HERE_WITH_EXPLICIT_FUNCTION(
577 "466432 IOThread::InitAsync::ChromeNetworkDelegate")); 584 "466432 IOThread::InitAsync::ChromeNetworkDelegate"));
578 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate( 585 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate(
579 new ChromeNetworkDelegate(extension_event_router_forwarder(), 586 new ChromeNetworkDelegate(extension_event_router_forwarder(),
580 &system_enable_referrers_)); 587 &system_enable_referrers_));
581 // By default, data usage is considered off the record. 588 // By default, data usage is considered off the record.
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); 1597 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass();
1591 1598
1592 context->set_job_factory( 1599 context->set_job_factory(
1593 globals->proxy_script_fetcher_url_request_job_factory.get()); 1600 globals->proxy_script_fetcher_url_request_job_factory.get());
1594 1601
1595 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1602 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1596 // system URLRequestContext too. There's no reason this should be tied to a 1603 // system URLRequestContext too. There's no reason this should be tied to a
1597 // profile. 1604 // profile.
1598 return context; 1605 return context;
1599 } 1606 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698