OLD | NEW |
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" |
11 #include "base/prefs/pref_member.h" | 11 #include "base/prefs/pref_member.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
17 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
| 18 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
21 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 22 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
22 #include "chrome/browser/io_thread.h" | 23 #include "chrome/browser/io_thread.h" |
23 #include "chrome/browser/net/chrome_net_log.h" | 24 #include "chrome/browser/net/chrome_net_log.h" |
24 #include "chrome/browser/net/chrome_network_delegate.h" | 25 #include "chrome/browser/net/chrome_network_delegate.h" |
25 #include "chrome/browser/net/connect_interceptor.h" | 26 #include "chrome/browser/net/connect_interceptor.h" |
26 #include "chrome/browser/net/cookie_store_util.h" | 27 #include "chrome/browser/net/cookie_store_util.h" |
27 #include "chrome/browser/net/http_server_properties_manager_factory.h" | 28 #include "chrome/browser/net/http_server_properties_manager_factory.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); | 110 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); |
110 #endif | 111 #endif |
111 if (save_prefs) | 112 if (save_prefs) |
112 io_data_->predictor_->SaveStateForNextStartupAndTrim(); | 113 io_data_->predictor_->SaveStateForNextStartupAndTrim(); |
113 io_data_->predictor_->ShutdownOnUIThread(); | 114 io_data_->predictor_->ShutdownOnUIThread(); |
114 } | 115 } |
115 | 116 |
116 if (io_data_->http_server_properties_manager_) | 117 if (io_data_->http_server_properties_manager_) |
117 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); | 118 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); |
118 | 119 |
| 120 if (io_data_->domain_reliability_monitor_) |
| 121 io_data_->domain_reliability_monitor_->DestroyReportingPref(); |
| 122 |
119 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); | 123 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); |
120 } | 124 } |
121 | 125 |
122 void ProfileImplIOData::Handle::Init( | 126 void ProfileImplIOData::Handle::Init( |
123 const base::FilePath& cookie_path, | 127 const base::FilePath& cookie_path, |
124 const base::FilePath& channel_id_path, | 128 const base::FilePath& channel_id_path, |
125 const base::FilePath& cache_path, | 129 const base::FilePath& cache_path, |
126 int cache_max_size, | 130 int cache_max_size, |
127 const base::FilePath& media_cache_path, | 131 const base::FilePath& media_cache_path, |
128 int media_cache_max_size, | 132 int media_cache_max_size, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Keep track of profile path and cache sizes separately so we can use them | 165 // Keep track of profile path and cache sizes separately so we can use them |
162 // on demand when creating storage isolated URLRequestContextGetters. | 166 // on demand when creating storage isolated URLRequestContextGetters. |
163 io_data_->profile_path_ = profile_path; | 167 io_data_->profile_path_ = profile_path; |
164 io_data_->app_cache_max_size_ = cache_max_size; | 168 io_data_->app_cache_max_size_ = cache_max_size; |
165 io_data_->app_media_cache_max_size_ = media_cache_max_size; | 169 io_data_->app_media_cache_max_size_ = media_cache_max_size; |
166 | 170 |
167 io_data_->predictor_.reset(predictor); | 171 io_data_->predictor_.reset(predictor); |
168 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); | 172 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); |
169 | 173 |
170 io_data_->InitializeMetricsEnabledStateOnUIThread(); | 174 io_data_->InitializeMetricsEnabledStateOnUIThread(); |
| 175 if (io_data_->domain_reliability_monitor_) { |
| 176 io_data_->domain_reliability_monitor_->InitReportingPref( |
| 177 g_browser_process->local_state(), |
| 178 prefs::kMetricsReportingEnabled, |
| 179 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 180 } |
171 | 181 |
172 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 182 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
173 io_data_->data_reduction_proxy_unavailable_callback_ = | 183 io_data_->data_reduction_proxy_unavailable_callback_ = |
174 data_reduction_proxy_unavailable; | 184 data_reduction_proxy_unavailable; |
175 io_data_->data_reduction_proxy_chrome_configurator_ = | 185 io_data_->data_reduction_proxy_chrome_configurator_ = |
176 data_reduction_proxy_chrome_configurator.Pass(); | 186 data_reduction_proxy_chrome_configurator.Pass(); |
177 io_data_->data_reduction_proxy_params_ = | 187 io_data_->data_reduction_proxy_params_ = |
178 data_reduction_proxy_params.Pass(); | 188 data_reduction_proxy_params.Pass(); |
179 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 189 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
180 } | 190 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 | 600 |
591 main_context->set_sdch_manager(sdch_manager_.get()); | 601 main_context->set_sdch_manager(sdch_manager_.get()); |
592 | 602 |
593 // Create a media request context based on the main context, but using a | 603 // Create a media request context based on the main context, but using a |
594 // media cache. It shares the same job factory as the main context. | 604 // media cache. It shares the same job factory as the main context. |
595 StoragePartitionDescriptor details(profile_path_, false); | 605 StoragePartitionDescriptor details(profile_path_, false); |
596 media_request_context_.reset(InitializeMediaRequestContext(main_context, | 606 media_request_context_.reset(InitializeMediaRequestContext(main_context, |
597 details)); | 607 details)); |
598 | 608 |
599 if (domain_reliability_monitor_) { | 609 if (domain_reliability_monitor_) { |
600 domain_reliability_monitor_->Init( | 610 domain_reliability_monitor_->InitURLRequestContext( |
601 main_context, | 611 main_context, |
602 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 612 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
603 domain_reliability_monitor_->AddBakedInConfigs(); | 613 domain_reliability_monitor_->AddBakedInConfigs(); |
604 network_delegate()->set_domain_reliability_monitor( | 614 network_delegate()->set_domain_reliability_monitor( |
605 domain_reliability_monitor_.get()); | 615 domain_reliability_monitor_.get()); |
606 } | 616 } |
607 | 617 |
608 lazy_params_.reset(); | 618 lazy_params_.reset(); |
609 } | 619 } |
610 | 620 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 const base::Closure& completion) { | 841 const base::Closure& completion) { |
832 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 842 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
833 DCHECK(initialized()); | 843 DCHECK(initialized()); |
834 | 844 |
835 DCHECK(transport_security_state()); | 845 DCHECK(transport_security_state()); |
836 // Completes synchronously. | 846 // Completes synchronously. |
837 transport_security_state()->DeleteAllDynamicDataSince(time); | 847 transport_security_state()->DeleteAllDynamicDataSince(time); |
838 DCHECK(http_server_properties_manager_); | 848 DCHECK(http_server_properties_manager_); |
839 http_server_properties_manager_->Clear(completion); | 849 http_server_properties_manager_->Clear(completion); |
840 } | 850 } |
OLD | NEW |