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

Unified Diff: net/proxy/proxy_service.cc

Issue 2299963002: Reland "Change ProxyResolver::GetProxyForURL() to take a unique_ptr<Request>* " (Closed)
Patch Set: remove fields proposed by eroman Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_resolver_winhttp.cc ('k') | net/proxy/proxy_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_service.cc
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 96f2360f1008ffa99aa24d17146aaeaf48cdce53..a81d3f66bc7547e22e813ff62ec94e9c0dd72e7d 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -187,18 +187,11 @@ class ProxyResolverNull : public ProxyResolver {
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
const CompletionCallback& callback,
- RequestHandle* request,
+ std::unique_ptr<Request>* request,
const NetLogWithSource& 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
@@ -211,19 +204,12 @@ class ProxyResolverFromPacString : public ProxyResolver {
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
const CompletionCallback& callback,
- RequestHandle* request,
+ std::unique_ptr<Request>* request,
const NetLogWithSource& 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_;
};
@@ -800,7 +786,7 @@ class ProxyService::PacRequest
url_(url),
method_(method),
proxy_delegate_(proxy_delegate),
- resolve_job_(NULL),
+ resolve_job_(nullptr),
config_id_(ProxyConfig::kInvalidConfigID),
config_source_(PROXY_CONFIG_SOURCE_UNKNOWN),
net_log_(net_log),
@@ -826,7 +812,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() {
@@ -841,8 +827,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());
}
@@ -870,12 +855,12 @@ class ProxyService::PacRequest
int QueryDidComplete(int result_code) {
DCHECK(!was_cancelled());
- // This state is cleared when resolve_job_ is set to nullptr below.
+ // This state is cleared when resolve_job_ is reset below.
bool script_executed = is_started();
// 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(url_, method_, proxy_delegate_,
@@ -901,7 +886,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;
}
@@ -934,7 +919,7 @@ class ProxyService::PacRequest
GURL url_;
std::string method_;
ProxyDelegate* proxy_delegate_;
- ProxyResolver::RequestHandle resolve_job_;
+ std::unique_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.
NetLogWithSource net_log_;
« no previous file with comments | « net/proxy/proxy_resolver_winhttp.cc ('k') | net/proxy/proxy_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698