summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 21:03:42 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 21:03:42 +0000
commit28d42dd690a7785694e7ad4fc2b981cb375b955f (patch)
tree1d9b1d870a66f467df756102eac03f280d0c1ec0
parent1f89f352af4edc119a7e63ac920ed32f6c83c884 (diff)
downloadchromium_src-28d42dd690a7785694e7ad4fc2b981cb375b955f.zip
chromium_src-28d42dd690a7785694e7ad4fc2b981cb375b955f.tar.gz
chromium_src-28d42dd690a7785694e7ad4fc2b981cb375b955f.tar.bz2
Tag ProxyService as NonThreadSafe.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6831018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81639 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/proxy/proxy_service.cc10
-rw-r--r--net/proxy/proxy_service.h8
2 files changed, 15 insertions, 3 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 7449204..ca3629e 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -500,6 +500,7 @@ int ProxyService::ResolveProxy(const GURL& raw_url,
CompletionCallback* callback,
PacRequest** pac_request,
const BoundNetLog& net_log) {
+ DCHECK(CalledOnValidThread());
DCHECK(callback);
net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE, NULL);
@@ -659,6 +660,8 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url,
CompletionCallback* callback,
PacRequest** pac_request,
const BoundNetLog& net_log) {
+ DCHECK(CalledOnValidThread());
+
// Check to see if we have a new config since ResolveProxy was called. We
// want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a
// direct connection failed and we never tried the current config.
@@ -682,6 +685,7 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url,
}
void ProxyService::CancelPacRequest(PacRequest* req) {
+ DCHECK(CalledOnValidThread());
DCHECK(req);
req->Cancel();
RemovePendingRequest(req);
@@ -736,6 +740,7 @@ int ProxyService::DidFinishResolvingProxy(ProxyInfo* result,
void ProxyService::SetProxyScriptFetcher(
ProxyScriptFetcher* proxy_script_fetcher) {
+ DCHECK(CalledOnValidThread());
State previous_state = ResetProxyConfig(false);
proxy_script_fetcher_.reset(proxy_script_fetcher);
if (previous_state != STATE_NONE)
@@ -743,10 +748,12 @@ void ProxyService::SetProxyScriptFetcher(
}
ProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const {
+ DCHECK(CalledOnValidThread());
return proxy_script_fetcher_.get();
}
ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) {
+ DCHECK(CalledOnValidThread());
State previous_state = current_state_;
proxy_retry_info_.clear();
@@ -762,6 +769,7 @@ ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) {
void ProxyService::ResetConfigService(
ProxyConfigService* new_proxy_config_service) {
+ DCHECK(CalledOnValidThread());
State previous_state = ResetProxyConfig(true);
// Release the old configuration service.
@@ -777,11 +785,13 @@ void ProxyService::ResetConfigService(
}
void ProxyService::PurgeMemory() {
+ DCHECK(CalledOnValidThread());
if (resolver_.get())
resolver_->PurgeMemory();
}
void ProxyService::ForceReloadProxyConfig() {
+ DCHECK(CalledOnValidThread());
ResetProxyConfig(false);
ApplyProxyConfigIfAvailable();
}
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index edb588d..8146470 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -12,6 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/waitable_event.h"
+#include "base/threading/non_thread_safe.h"
#include "net/base/completion_callback.h"
#include "net/base/net_log.h"
#include "net/base/network_change_notifier.h"
@@ -33,9 +34,10 @@ class URLRequestContext;
// This class can be used to resolve the proxy server to use when loading a
// HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy
// resolution. See ProxyResolverV8 for example.
-class ProxyService : public base::RefCountedThreadSafe<ProxyService>,
+class ProxyService : public base::RefCounted<ProxyService>,
public NetworkChangeNotifier::IPAddressObserver,
- public ProxyConfigService::Observer {
+ public ProxyConfigService::Observer,
+ public base::NonThreadSafe {
public:
// The instance takes ownership of |config_service| and |resolver|.
// |net_log| is a possibly NULL destination to send log events to. It must
@@ -215,7 +217,7 @@ class ProxyService : public base::RefCountedThreadSafe<ProxyService>,
#endif
private:
- friend class base::RefCountedThreadSafe<ProxyService>;
+ friend class base::RefCounted<ProxyService>;
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect);
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect);
friend class PacRequest;