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

Unified Diff: net/proxy/proxy_service.cc

Issue 1439053002: Change ProxyResolver::GetProxyForURL() to take a scoped_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last fixes Created 4 years, 10 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: net/proxy/proxy_service.cc
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index d6d410c205ef380d4f2209a2848fa08c6db8eae6..7a9871da085ae97fbaaa7b89c9db7e0602f849da 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -185,18 +185,10 @@ class ProxyResolverNull : public ProxyResolver {
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
const CompletionCallback& callback,
- RequestHandle* request,
+ scoped_ptr<Request>* request,
const BoundNetLog& net_log) override {
return ERR_NOT_IMPLEMENTED;
}
-
- void CancelRequest(RequestHandle request) override { NOTREACHED(); }
-
- LoadState GetLoadState(RequestHandle request) const override {
- NOTREACHED();
- return LOAD_STATE_IDLE;
- }
-
};
// ProxyResolver that simulates a PAC script which returns
@@ -209,19 +201,12 @@ class ProxyResolverFromPacString : public ProxyResolver {
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
const CompletionCallback& callback,
- RequestHandle* request,
+ scoped_ptr<Request>* request,
const BoundNetLog& net_log) override {
results->UsePacString(pac_string_);
return OK;
}
- void CancelRequest(RequestHandle request) override { NOTREACHED(); }
-
- LoadState GetLoadState(RequestHandle request) const override {
- NOTREACHED();
- return LOAD_STATE_IDLE;
- }
-
private:
const std::string pac_string_;
};
@@ -778,7 +763,6 @@ class ProxyService::PacRequest
url_(url),
load_flags_(load_flags),
proxy_delegate_(proxy_delegate),
- resolve_job_(NULL),
config_id_(ProxyConfig::kInvalidConfigID),
config_source_(PROXY_CONFIG_SOURCE_UNKNOWN),
net_log_(net_log),
@@ -804,7 +788,7 @@ class ProxyService::PacRequest
bool is_started() const {
// Note that !! casts to bool. (VS gives a warning otherwise).
- return !!resolve_job_;
+ return !!resolve_job_.get();
}
void StartAndCompleteCheckingForSynchronous() {
@@ -819,8 +803,7 @@ class ProxyService::PacRequest
void CancelResolveJob() {
DCHECK(is_started());
// The request may already be running in the resolver.
- resolver()->CancelRequest(resolve_job_);
- resolve_job_ = NULL;
+ resolve_job_.reset();
DCHECK(!is_started());
}
@@ -853,7 +836,7 @@ class ProxyService::PacRequest
// Clear |resolve_job_| so is_started() returns false while
// DidFinishResolvingProxy() runs.
- resolve_job_ = nullptr;
+ resolve_job_.reset();
// Note that DidFinishResolvingProxy might modify |results_|.
int rv = service_->DidFinishResolvingProxy(
@@ -879,7 +862,7 @@ class ProxyService::PacRequest
LoadState GetLoadState() const {
if (is_started())
- return resolver()->GetLoadState(resolve_job_);
+ return resolve_job_->GetLoadState();
return LOAD_STATE_RESOLVING_PROXY_FOR_URL;
}
@@ -912,7 +895,7 @@ class ProxyService::PacRequest
GURL url_;
int load_flags_;
ProxyDelegate* proxy_delegate_;
- ProxyResolver::RequestHandle resolve_job_;
+ scoped_ptr<ProxyResolver::Request> resolve_job_;
ProxyConfig::ID config_id_; // The config id when the resolve was started.
ProxyConfigSource config_source_; // The source of proxy settings.
BoundNetLog net_log_;

Powered by Google App Engine
This is Rietveld 408576698