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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 473723002: Update data reduction proxy statistics prefs less often on desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tooManyWritesPatch
Patch Set: Fixing nits Created 6 years, 3 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/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/net/http_server_properties_manager_factory.h" 27 #include "chrome/browser/net/http_server_properties_manager_factory.h"
28 #include "chrome/browser/net/predictor.h" 28 #include "chrome/browser/net/predictor.h"
29 #include "chrome/browser/net/quota_policy_channel_id_store.h" 29 #include "chrome/browser/net/quota_policy_channel_id_store.h"
30 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" 30 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h"
31 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/common/chrome_constants.h" 32 #include "chrome/common/chrome_constants.h"
33 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/chrome_version_info.h" 34 #include "chrome/common/chrome_version_info.h"
35 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
36 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic s_prefs.h"
37 #include "components/domain_reliability/monitor.h" 38 #include "components/domain_reliability/monitor.h"
38 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/cookie_store_factory.h" 40 #include "content/public/browser/cookie_store_factory.h"
40 #include "content/public/browser/notification_service.h" 41 #include "content/public/browser/notification_service.h"
41 #include "content/public/browser/resource_context.h" 42 #include "content/public/browser/resource_context.h"
42 #include "content/public/browser/storage_partition.h" 43 #include "content/public/browser/storage_partition.h"
43 #include "extensions/browser/extension_protocols.h" 44 #include "extensions/browser/extension_protocols.h"
44 #include "extensions/common/constants.h" 45 #include "extensions/common/constants.h"
45 #include "net/base/cache_type.h" 46 #include "net/base/cache_type.h"
46 #include "net/base/sdch_dictionary_fetcher.h" 47 #include "net/base/sdch_dictionary_fetcher.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 ProfileImplIOData::Handle::Handle(Profile* profile) 96 ProfileImplIOData::Handle::Handle(Profile* profile)
96 : io_data_(new ProfileImplIOData), 97 : io_data_(new ProfileImplIOData),
97 profile_(profile), 98 profile_(profile),
98 initialized_(false) { 99 initialized_(false) {
99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
100 DCHECK(profile); 101 DCHECK(profile);
101 } 102 }
102 103
103 ProfileImplIOData::Handle::~Handle() { 104 ProfileImplIOData::Handle::~Handle() {
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
106 #if defined(SPDY_PROXY_AUTH_ORIGIN)
107 io_data_->data_reduction_proxy_statistics_prefs_->WritePrefs();
108 #endif
109
105 if (io_data_->predictor_ != NULL) { 110 if (io_data_->predictor_ != NULL) {
106 // io_data_->predictor_ might be NULL if Init() was never called 111 // io_data_->predictor_ might be NULL if Init() was never called
107 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). 112 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called).
108 bool save_prefs = true; 113 bool save_prefs = true;
109 #if defined(OS_CHROMEOS) 114 #if defined(OS_CHROMEOS)
110 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); 115 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_);
111 #endif 116 #endif
112 if (save_prefs) 117 if (save_prefs)
113 io_data_->predictor_->SaveStateForNextStartupAndTrim(); 118 io_data_->predictor_->SaveStateForNextStartupAndTrim();
114 io_data_->predictor_->ShutdownOnUIThread(); 119 io_data_->predictor_->ShutdownOnUIThread();
(...skipping 20 matching lines...) Expand all
135 const base::FilePath& infinite_cache_path, 140 const base::FilePath& infinite_cache_path,
136 chrome_browser_net::Predictor* predictor, 141 chrome_browser_net::Predictor* predictor,
137 content::CookieStoreConfig::SessionCookieMode session_cookie_mode, 142 content::CookieStoreConfig::SessionCookieMode session_cookie_mode,
138 storage::SpecialStoragePolicy* special_storage_policy, 143 storage::SpecialStoragePolicy* special_storage_policy,
139 scoped_ptr<domain_reliability::DomainReliabilityMonitor> 144 scoped_ptr<domain_reliability::DomainReliabilityMonitor>
140 domain_reliability_monitor, 145 domain_reliability_monitor,
141 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, 146 const base::Callback<void(bool)>& data_reduction_proxy_unavailable,
142 scoped_ptr<DataReductionProxyChromeConfigurator> 147 scoped_ptr<DataReductionProxyChromeConfigurator>
143 data_reduction_proxy_chrome_configurator, 148 data_reduction_proxy_chrome_configurator,
144 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 149 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
145 data_reduction_proxy_params) { 150 data_reduction_proxy_params,
151 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
152 data_reduction_proxy_statistics_prefs) {
146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
147 DCHECK(!io_data_->lazy_params_); 154 DCHECK(!io_data_->lazy_params_);
148 DCHECK(predictor); 155 DCHECK(predictor);
149 156
150 LazyParams* lazy_params = new LazyParams(); 157 LazyParams* lazy_params = new LazyParams();
151 158
152 lazy_params->cookie_path = cookie_path; 159 lazy_params->cookie_path = cookie_path;
153 lazy_params->channel_id_path = channel_id_path; 160 lazy_params->channel_id_path = channel_id_path;
154 lazy_params->cache_path = cache_path; 161 lazy_params->cache_path = cache_path;
155 lazy_params->cache_max_size = cache_max_size; 162 lazy_params->cache_max_size = cache_max_size;
(...skipping 19 matching lines...) Expand all
175 if (io_data_->domain_reliability_monitor_) 182 if (io_data_->domain_reliability_monitor_)
176 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); 183 io_data_->domain_reliability_monitor_->MoveToNetworkThread();
177 184
178 #if defined(SPDY_PROXY_AUTH_ORIGIN) 185 #if defined(SPDY_PROXY_AUTH_ORIGIN)
179 io_data_->data_reduction_proxy_unavailable_callback_ = 186 io_data_->data_reduction_proxy_unavailable_callback_ =
180 data_reduction_proxy_unavailable; 187 data_reduction_proxy_unavailable;
181 io_data_->data_reduction_proxy_chrome_configurator_ = 188 io_data_->data_reduction_proxy_chrome_configurator_ =
182 data_reduction_proxy_chrome_configurator.Pass(); 189 data_reduction_proxy_chrome_configurator.Pass();
183 io_data_->data_reduction_proxy_params_ = 190 io_data_->data_reduction_proxy_params_ =
184 data_reduction_proxy_params.Pass(); 191 data_reduction_proxy_params.Pass();
192 io_data_->data_reduction_proxy_statistics_prefs_ =
193 data_reduction_proxy_statistics_prefs.Pass();
185 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 194 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
186 } 195 }
187 196
188 content::ResourceContext* 197 content::ResourceContext*
189 ProfileImplIOData::Handle::GetResourceContext() const { 198 ProfileImplIOData::Handle::GetResourceContext() const {
190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 199 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
191 LazyInitialize(); 200 LazyInitialize();
192 return GetResourceContextNoInit(); 201 return GetResourceContextNoInit();
193 } 202 }
194 203
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 data_reduction_proxy_usage_stats_->set_unavailable_callback( 454 data_reduction_proxy_usage_stats_->set_unavailable_callback(
446 data_reduction_proxy_unavailable_callback_); 455 data_reduction_proxy_unavailable_callback_);
447 456
448 457
449 network_delegate()->set_data_reduction_proxy_params( 458 network_delegate()->set_data_reduction_proxy_params(
450 data_reduction_proxy_params_.get()); 459 data_reduction_proxy_params_.get());
451 network_delegate()->set_data_reduction_proxy_usage_stats( 460 network_delegate()->set_data_reduction_proxy_usage_stats(
452 data_reduction_proxy_usage_stats_.get()); 461 data_reduction_proxy_usage_stats_.get());
453 network_delegate()->set_data_reduction_proxy_auth_request_handler( 462 network_delegate()->set_data_reduction_proxy_auth_request_handler(
454 data_reduction_proxy_auth_request_handler_.get()); 463 data_reduction_proxy_auth_request_handler_.get());
464 network_delegate()->set_data_reduction_proxy_statistics_prefs(
465 data_reduction_proxy_statistics_prefs_.get());
455 network_delegate()->set_on_resolve_proxy_handler( 466 network_delegate()->set_on_resolve_proxy_handler(
456 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); 467 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
457 network_delegate()->set_proxy_config_getter( 468 network_delegate()->set_proxy_config_getter(
458 base::Bind( 469 base::Bind(
459 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIO, 470 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIO,
460 base::Unretained(data_reduction_proxy_chrome_configurator_.get()))); 471 base::Unretained(data_reduction_proxy_chrome_configurator_.get())));
461 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 472 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
462 473
463 network_delegate()->set_predictor(predictor_.get()); 474 network_delegate()->set_predictor(predictor_.get());
464 475
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 const base::Closure& completion) { 841 const base::Closure& completion) {
831 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 842 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
832 DCHECK(initialized()); 843 DCHECK(initialized());
833 844
834 DCHECK(transport_security_state()); 845 DCHECK(transport_security_state());
835 // Completes synchronously. 846 // Completes synchronously.
836 transport_security_state()->DeleteAllDynamicDataSince(time); 847 transport_security_state()->DeleteAllDynamicDataSince(time);
837 DCHECK(http_server_properties_manager_); 848 DCHECK(http_server_properties_manager_);
838 http_server_properties_manager_->Clear(completion); 849 http_server_properties_manager_->Clear(completion);
839 } 850 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/test/data/webui/net_internals/bandwidth_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698