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

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

Issue 491753003: Domain Reliability: Don't upload when metrics reporting is off. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make sure constructor and destructor are on correct threads. Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | components/domain_reliability.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
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"
noms (inactive) 2014/08/25 16:57:10 Is this include needed?
Deprecated (see juliatuttle) 2014/08/25 17:04:49 Oh, not anymore, thanks.
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
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
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_->MoveToNetworkThread();
171 177
172 #if defined(SPDY_PROXY_AUTH_ORIGIN) 178 #if defined(SPDY_PROXY_AUTH_ORIGIN)
173 io_data_->data_reduction_proxy_unavailable_callback_ = 179 io_data_->data_reduction_proxy_unavailable_callback_ =
174 data_reduction_proxy_unavailable; 180 data_reduction_proxy_unavailable;
175 io_data_->data_reduction_proxy_chrome_configurator_ = 181 io_data_->data_reduction_proxy_chrome_configurator_ =
176 data_reduction_proxy_chrome_configurator.Pass(); 182 data_reduction_proxy_chrome_configurator.Pass();
177 io_data_->data_reduction_proxy_params_ = 183 io_data_->data_reduction_proxy_params_ =
178 data_reduction_proxy_params.Pass(); 184 data_reduction_proxy_params.Pass();
179 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 185 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
180 } 186 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 596
591 main_context->set_sdch_manager(sdch_manager_.get()); 597 main_context->set_sdch_manager(sdch_manager_.get());
592 598
593 // Create a media request context based on the main context, but using a 599 // 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. 600 // media cache. It shares the same job factory as the main context.
595 StoragePartitionDescriptor details(profile_path_, false); 601 StoragePartitionDescriptor details(profile_path_, false);
596 media_request_context_.reset(InitializeMediaRequestContext(main_context, 602 media_request_context_.reset(InitializeMediaRequestContext(main_context,
597 details)); 603 details));
598 604
599 if (domain_reliability_monitor_) { 605 if (domain_reliability_monitor_) {
600 domain_reliability_monitor_->Init( 606 domain_reliability::DomainReliabilityMonitor* monitor =
601 main_context, 607 domain_reliability_monitor_.get();
602 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 608 monitor->InitURLRequestContext(main_context);
603 domain_reliability_monitor_->AddBakedInConfigs(); 609 monitor->AddBakedInConfigs();
604 network_delegate()->set_domain_reliability_monitor( 610 network_delegate()->set_domain_reliability_monitor(monitor);
605 domain_reliability_monitor_.get());
606 } 611 }
607 612
608 lazy_params_.reset(); 613 lazy_params_.reset();
609 } 614 }
610 615
611 void ProfileImplIOData:: 616 void ProfileImplIOData::
612 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { 617 InitializeExtensionsRequestContext(ProfileParams* profile_params) const {
613 net::URLRequestContext* extensions_context = extensions_request_context(); 618 net::URLRequestContext* extensions_context = extensions_request_context();
614 IOThread* const io_thread = profile_params->io_thread; 619 IOThread* const io_thread = profile_params->io_thread;
615 IOThread::Globals* const io_thread_globals = io_thread->globals(); 620 IOThread::Globals* const io_thread_globals = io_thread->globals();
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 const base::Closure& completion) { 836 const base::Closure& completion) {
832 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 837 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
833 DCHECK(initialized()); 838 DCHECK(initialized());
834 839
835 DCHECK(transport_security_state()); 840 DCHECK(transport_security_state());
836 // Completes synchronously. 841 // Completes synchronously.
837 transport_security_state()->DeleteAllDynamicDataSince(time); 842 transport_security_state()->DeleteAllDynamicDataSince(time);
838 DCHECK(http_server_properties_manager_); 843 DCHECK(http_server_properties_manager_);
839 http_server_properties_manager_->Clear(completion); 844 http_server_properties_manager_->Clear(completion);
840 } 845 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | components/domain_reliability.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698