Reland "Change ProxyResolver::GetProxyForURL() to take a unique_ptr<Request>*"
Original issue's description:
> Change ProxyResolver::GetProxyForURL() to take a scoped_ptr<Request>* rather than a RequestHandle*
>
> * ProxyResolver::GetProxyForURL() fills a |scoped_pointer<Request>*|
> rather than a |void*|
> * ProxyResolver::CancelRequest(void*) has been removed. Requests
> are instead cancelled by resetting the scoped_ptr<Request>.
>
> This makes for less error prone code as cancellation of
> requests is automatic when the
> scoped_ptr<Request> goes out of scope.
> ProxyResolver::GetLoadState() is removed and replaced
> by Request::GetLoadState().
>
> Also made some renaming, as there were similar class
> named Job or Request. Now they are all Job and this new thing
> is Request.
>
> Referencing by address to object in vector was not wise in net/proxy/mojo_proxy_resolver_impl_unittest.cc which is now fixed by using scoped_ptrs in that vector.
>
> BUG=478934
>
> Committed: https://crrev.com/a750e126346aa42df1b0cbc2ae6a58abbe7a5069
> Cr-Commit-Position: refs/heads/master@{#377856}
BUG=478934
Review-Url: https://chromiumcodereview.appspot.com/2299963002
Cr-Commit-Position: refs/heads/master@{#426450}
diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc
index 6f184c75..8b6692e 100644
--- a/net/proxy/proxy_resolver_winhttp.cc
+++ b/net/proxy/proxy_resolver_winhttp.cc
@@ -60,11 +60,8 @@
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
const CompletionCallback& /*callback*/,
- RequestHandle* /*request*/,
+ std::unique_ptr<Request>* /*request*/,
const NetLogWithSource& /*net_log*/) override;
- void CancelRequest(RequestHandle request) override;
-
- LoadState GetLoadState(RequestHandle request) const override;
private:
bool OpenWinHttpSession();
@@ -93,7 +90,7 @@
int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url,
ProxyInfo* results,
const CompletionCallback& /*callback*/,
- RequestHandle* /*request*/,
+ std::unique_ptr<Request>* /*request*/,
const NetLogWithSource& /*net_log*/) {
// If we don't have a WinHTTP session, then create a new one.
if (!session_handle_ && !OpenWinHttpSession())
@@ -173,16 +170,6 @@
return rv;
}
-void ProxyResolverWinHttp::CancelRequest(RequestHandle request) {
- // This is a synchronous ProxyResolver; no possibility for async requests.
- NOTREACHED();
-}
-
-LoadState ProxyResolverWinHttp::GetLoadState(RequestHandle request) const {
- NOTREACHED();
- return LOAD_STATE_IDLE;
-}
-
bool ProxyResolverWinHttp::OpenWinHttpSession() {
DCHECK(!session_handle_);
session_handle_ = WinHttpOpen(NULL,