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

Unified Diff: components/proxy_config/pref_proxy_config_tracker_impl.cc

Issue 2860033003: Don't delay creation of system URLRequestContext until first use (Closed)
Patch Set: Remove comment Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/proxy_config/pref_proxy_config_tracker_impl.cc
diff --git a/components/proxy_config/pref_proxy_config_tracker_impl.cc b/components/proxy_config/pref_proxy_config_tracker_impl.cc
index f8077aa9032038126769864d3a64ebc23e3f82f1..0fead147cefb8c5e3bfd17f77cdc9a1eaf801dc8 100644
--- a/components/proxy_config/pref_proxy_config_tracker_impl.cc
+++ b/components/proxy_config/pref_proxy_config_tracker_impl.cc
@@ -24,10 +24,12 @@
//============================= ProxyConfigServiceImpl =======================
ProxyConfigServiceImpl::ProxyConfigServiceImpl(
- net::ProxyConfigService* base_service)
- : base_service_(base_service),
- pref_config_state_(ProxyPrefs::CONFIG_UNSET),
- pref_config_read_pending_(true),
+ std::unique_ptr<net::ProxyConfigService> base_service,
+ ProxyPrefs::ConfigState initial_config_state,
+ const net::ProxyConfig& initial_config)
+ : base_service_(std::move(base_service)),
+ pref_config_state_(initial_config_state),
+ pref_config_(initial_config),
registered_observer_(false) {
// ProxyConfigServiceImpl is created on the UI thread, but used on the network
// thread.
@@ -54,9 +56,6 @@ net::ProxyConfigService::ConfigAvailability
ProxyConfigServiceImpl::GetLatestProxyConfig(net::ProxyConfig* config) {
RegisterObserver();
- if (pref_config_read_pending_)
- return net::ProxyConfigService::CONFIG_PENDING;
-
// Ask the base service if available.
net::ProxyConfig system_config;
ConfigAvailability system_availability =
@@ -79,7 +78,6 @@ void ProxyConfigServiceImpl::UpdateProxyConfig(
ProxyPrefs::ConfigState config_state,
const net::ProxyConfig& config) {
DCHECK(thread_checker_.CalledOnValidThread());
- pref_config_read_pending_ = false;
pref_config_state_ = config_state;
pref_config_ = config;
@@ -109,7 +107,7 @@ void ProxyConfigServiceImpl::OnProxyConfigChanged(
// Check whether there is a proxy configuration defined by preferences. In
// this case that proxy configuration takes precedence and the change event
- // from the delegate proxy service can be disregarded.
+ // from the delegate proxy config service can be disregarded.
if (!PrefProxyConfigTrackerImpl::PrefPrecedes(pref_config_state_)) {
net::ProxyConfig actual_config;
availability = GetLatestProxyConfig(&actual_config);
@@ -149,12 +147,12 @@ PrefProxyConfigTrackerImpl::~PrefProxyConfigTrackerImpl() {
std::unique_ptr<net::ProxyConfigService>
PrefProxyConfigTrackerImpl::CreateTrackingProxyConfigService(
std::unique_ptr<net::ProxyConfigService> base_service) {
- proxy_config_service_impl_ =
- new ProxyConfigServiceImpl(base_service.release());
+ DCHECK(!proxy_config_service_impl_);
+ proxy_config_service_impl_ = new ProxyConfigServiceImpl(
+ std::move(base_service), config_state_, pref_config_);
VLOG(1) << this << ": set chrome proxy config service to "
<< proxy_config_service_impl_;
- if (proxy_config_service_impl_ && update_pending_)
- OnProxyConfigChanged(config_state_, pref_config_);
+ update_pending_ = false;
return std::unique_ptr<net::ProxyConfigService>(proxy_config_service_impl_);
}

Powered by Google App Engine
This is Rietveld 408576698