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

Side by Side Diff: chrome/browser/net/pref_proxy_config_tracker_impl.cc

Issue 10912132: Move ProxyConfigService construction onto the IO thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tiny fix for get_server_time Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/net/pref_proxy_config_tracker_impl.h" 5 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/prefs/proxy_config_dictionary.h" 10 #include "chrome/browser/prefs/proxy_config_dictionary.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 pref_config_state_, pref_config_, 62 pref_config_state_, pref_config_,
63 system_availability, system_config, false, 63 system_availability, system_config, false,
64 &config_state, config); 64 &config_state, config);
65 } 65 }
66 66
67 void ChromeProxyConfigService::OnLazyPoll() { 67 void ChromeProxyConfigService::OnLazyPoll() {
68 if (base_service_.get()) 68 if (base_service_.get())
69 base_service_->OnLazyPoll(); 69 base_service_->OnLazyPoll();
70 } 70 }
71 71
72 void ChromeProxyConfigService::StartTearDown() {
73 if (base_service_.get())
74 base_service_->StartTearDown();
75 }
76
72 void ChromeProxyConfigService::UpdateProxyConfig( 77 void ChromeProxyConfigService::UpdateProxyConfig(
73 ProxyPrefs::ConfigState config_state, 78 ProxyPrefs::ConfigState config_state,
74 const net::ProxyConfig& config) { 79 const net::ProxyConfig& config) {
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
76 81
77 pref_config_read_pending_ = false; 82 pref_config_read_pending_ = false;
78 pref_config_state_ = config_state; 83 pref_config_state_ = config_state;
79 pref_config_ = config; 84 pref_config_ = config;
80 85
81 if (!observers_.size()) 86 if (!observers_.size())
(...skipping 19 matching lines...) Expand all
101 const net::ProxyConfig& config, 106 const net::ProxyConfig& config,
102 ConfigAvailability availability) { 107 ConfigAvailability availability) {
103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
104 109
105 // Check whether there is a proxy configuration defined by preferences. In 110 // Check whether there is a proxy configuration defined by preferences. In
106 // this case that proxy configuration takes precedence and the change event 111 // this case that proxy configuration takes precedence and the change event
107 // from the delegate proxy service can be disregarded. 112 // from the delegate proxy service can be disregarded.
108 if (!PrefProxyConfigTrackerImpl::PrefPrecedes(pref_config_state_)) { 113 if (!PrefProxyConfigTrackerImpl::PrefPrecedes(pref_config_state_)) {
109 net::ProxyConfig actual_config; 114 net::ProxyConfig actual_config;
110 availability = GetLatestProxyConfig(&actual_config); 115 availability = GetLatestProxyConfig(&actual_config);
111 FOR_EACH_OBSERVER(net::ProxyConfigService::Observer, observers_, 116 // Don't send out notification if we don't really have a configuration yet.
112 OnProxyConfigChanged(actual_config, availability)); 117 if (availability != net::ProxyConfigService::CONFIG_PENDING)
118 FOR_EACH_OBSERVER(net::ProxyConfigService::Observer, observers_,
119 OnProxyConfigChanged(actual_config, availability));
113 } 120 }
114 } 121 }
115 122
116 void ChromeProxyConfigService::RegisterObserver() { 123 void ChromeProxyConfigService::RegisterObserver() {
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
118 if (!registered_observer_ && base_service_.get()) { 125 if (!registered_observer_ && base_service_.get()) {
119 base_service_->AddObserver(this); 126 base_service_->AddObserver(this);
120 registered_observer_ = true; 127 registered_observer_ = true;
121 } 128 }
122 } 129 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 config_state = ProxyPrefs::CONFIG_EXTENSION; 342 config_state = ProxyPrefs::CONFIG_EXTENSION;
336 else 343 else
337 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; 344 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE;
338 } else { 345 } else {
339 config_state = ProxyPrefs::CONFIG_FALLBACK; 346 config_state = ProxyPrefs::CONFIG_FALLBACK;
340 } 347 }
341 } 348 }
342 349
343 return config_state; 350 return config_state;
344 } 351 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698