summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-08 09:41:44 +0000
committerbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-08 09:41:44 +0000
commit5138bbffd1b2d5151ad74b4e7ae8091fc7d44114 (patch)
treee5fdf5b5b87bfdf27df6d2dcd82e528ebd40ece1 /chrome/browser/net
parent20f4534eb02566c6a1fa86988a6b968e51cb1fd2 (diff)
downloadchromium_src-5138bbffd1b2d5151ad74b4e7ae8091fc7d44114.zip
chromium_src-5138bbffd1b2d5151ad74b4e7ae8091fc7d44114.tar.gz
chromium_src-5138bbffd1b2d5151ad74b4e7ae8091fc7d44114.tar.bz2
Fixed minor atomicity issue in PrefProxyConfigService::GetLatestProxyConfig and remaining comments of 5005002.
See http://codereview.chromium.org/5005002. BUG=48930 TEST=none Review URL: http://codereview.chromium.org/5537002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_url_request_context.h1
-rw-r--r--chrome/browser/net/pref_proxy_config_service.cc15
-rw-r--r--chrome/browser/net/pref_proxy_config_service.h14
3 files changed, 15 insertions, 15 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index ddc3550..1815c01 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -35,7 +35,6 @@ class Profile;
namespace net {
class DnsCertProvenanceChecker;
class NetworkDelegate;
-class ProxyConfig;
}
class ChromeURLRequestContext;
diff --git a/chrome/browser/net/pref_proxy_config_service.cc b/chrome/browser/net/pref_proxy_config_service.cc
index 5cd6213..27155e6 100644
--- a/chrome/browser/net/pref_proxy_config_service.cc
+++ b/chrome/browser/net/pref_proxy_config_service.cc
@@ -38,13 +38,13 @@ void PrefProxyConfigTracker::DetachFromPrefService() {
}
void PrefProxyConfigTracker::AddObserver(
- PrefProxyConfigTracker::ObserverInterface* observer) {
+ PrefProxyConfigTracker::Observer* observer) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
observers_.AddObserver(observer);
}
void PrefProxyConfigTracker::RemoveObserver(
- PrefProxyConfigTracker::ObserverInterface* observer) {
+ PrefProxyConfigTracker::Observer* observer) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
observers_.RemoveObserver(observer);
}
@@ -70,12 +70,11 @@ void PrefProxyConfigTracker::Observe(NotificationType type,
void PrefProxyConfigTracker::InstallProxyConfig(const net::ProxyConfig& config,
bool valid) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (valid_ != valid || !pref_config_.Equals(config)) {
+ if (valid_ != valid || (valid && !pref_config_.Equals(config))) {
valid_ = valid;
if (valid_)
pref_config_ = config;
- FOR_EACH_OBSERVER(ObserverInterface, observers_,
- OnPrefProxyConfigChanged());
+ FOR_EACH_OBSERVER(Observer, observers_, OnPrefProxyConfigChanged());
}
}
@@ -169,9 +168,11 @@ void PrefProxyConfigService::RemoveObserver(
bool PrefProxyConfigService::GetLatestProxyConfig(net::ProxyConfig* config) {
RegisterObservers();
- const net::ProxyConfig pref_config;
- if (pref_config_tracker_->GetProxyConfig(config))
+ net::ProxyConfig pref_config;
+ if (pref_config_tracker_->GetProxyConfig(&pref_config)) {
+ *config = pref_config;
return true;
+ }
return base_service_->GetLatestProxyConfig(config);
}
diff --git a/chrome/browser/net/pref_proxy_config_service.h b/chrome/browser/net/pref_proxy_config_service.h
index 362b109..f8c7061 100644
--- a/chrome/browser/net/pref_proxy_config_service.h
+++ b/chrome/browser/net/pref_proxy_config_service.h
@@ -26,9 +26,9 @@ class PrefProxyConfigTracker
public:
// Observer interface used to send out notifications on the IO thread about
// changes to the proxy configuration.
- class ObserverInterface {
+ class Observer {
public:
- virtual ~ObserverInterface() {}
+ virtual ~Observer() {}
virtual void OnPrefProxyConfigChanged() = 0;
};
@@ -36,8 +36,8 @@ class PrefProxyConfigTracker
virtual ~PrefProxyConfigTracker();
// Observer manipulation is only valid on the IO thread.
- void AddObserver(ObserverInterface* observer);
- void RemoveObserver(ObserverInterface* observer);
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
// Get the proxy configuration currently defined by preferences. Writes the
// configuration to |config| and returns true on success. |config| is not
@@ -68,14 +68,14 @@ class PrefProxyConfigTracker
bool ReadPrefConfig(net::ProxyConfig* config);
// Configuration as defined by prefs. Only to be accessed from the IO thread
- // (expect for construction).
+ // (except for construction).
net::ProxyConfig pref_config_;
// Whether |pref_config_| is valid. Only accessed from the IO thread.
bool valid_;
// List of observers, accessed exclusively from the IO thread.
- ObserverList<ObserverInterface, true> observers_;
+ ObserverList<Observer, true> observers_;
// Pref-related members that should only be accessed from the UI thread.
PrefService* pref_service_;
@@ -90,7 +90,7 @@ class PrefProxyConfigTracker
class PrefProxyConfigService
: public net::ProxyConfigService,
public net::ProxyConfigService::Observer,
- public PrefProxyConfigTracker::ObserverInterface {
+ public PrefProxyConfigTracker::Observer {
public:
// Takes ownership of the passed |base_service|.
PrefProxyConfigService(PrefProxyConfigTracker* tracker,