0

Rename net::Proxy::PacRequest to net::Proxy::Request

TBR=raymes@chromium.org
TBR=dimich@chromium.org
TBR=yhirano@chromium.org
TBR=boliu@chromium.org

Bug: 613640
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I0841e8cd01a1eb970327a8a6247efac20ba734eb
Reviewed-on: https://chromium-review.googlesource.com/847460
Commit-Queue: Lily Houghton <lilyhoughton@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529071}
This commit is contained in:
Lily Houghton
2018-01-12 21:40:39 +00:00
committed by Commit Bot
parent 76473d4ff5
commit 00e124d42c
16 changed files with 116 additions and 120 deletions

@@ -51,8 +51,8 @@ PepperNetworkProxyHost::~PepperNetworkProxyHost() {
// If the proxy_service_ is NULL, we shouldn't have any outstanding // If the proxy_service_ is NULL, we shouldn't have any outstanding
// requests. // requests.
DCHECK(proxy_service_); DCHECK(proxy_service_);
net::ProxyService::PacRequest* request = pending_requests_.front(); net::ProxyService::Request* request = pending_requests_.front();
proxy_service_->CancelPacRequest(request); proxy_service_->CancelRequest(request);
pending_requests_.pop(); pending_requests_.pop();
} }
} }
@@ -139,7 +139,7 @@ void PepperNetworkProxyHost::TryToSendUnsentRequests() {
} else { } else {
// Everything looks valid, so try to resolve the proxy. // Everything looks valid, so try to resolve the proxy.
net::ProxyInfo* proxy_info = new net::ProxyInfo; net::ProxyInfo* proxy_info = new net::ProxyInfo;
net::ProxyService::PacRequest* pending_request = nullptr; net::ProxyService::Request* pending_request = nullptr;
base::Callback<void(int)> callback = base::Callback<void(int)> callback =
base::Bind(&PepperNetworkProxyHost::OnResolveProxyCompleted, base::Bind(&PepperNetworkProxyHost::OnResolveProxyCompleted,
weak_factory_.GetWeakPtr(), weak_factory_.GetWeakPtr(),

@@ -97,7 +97,7 @@ class CONTENT_EXPORT PepperNetworkProxyHost : public ppapi::host::ResourceHost {
// Requests awaiting a response from ProxyService. We need to store these so // Requests awaiting a response from ProxyService. We need to store these so
// that we can cancel them if we get destroyed. // that we can cancel them if we get destroyed.
base::queue<net::ProxyService::PacRequest*> pending_requests_; base::queue<net::ProxyService::Request*> pending_requests_;
base::WeakPtrFactory<PepperNetworkProxyHost> weak_factory_; base::WeakPtrFactory<PepperNetworkProxyHost> weak_factory_;

@@ -50,7 +50,7 @@ ResolveProxyMsgHelper::~ResolveProxyMsgHelper() {
// default request context or override). // default request context or override).
if (!pending_requests_.empty()) { if (!pending_requests_.empty()) {
PendingRequest req = pending_requests_.front(); PendingRequest req = pending_requests_.front();
proxy_service_->CancelPacRequest(req.pac_req); proxy_service_->CancelRequest(req.request);
} }
for (PendingRequestList::iterator it = pending_requests_.begin(); for (PendingRequestList::iterator it = pending_requests_.begin();
@@ -82,7 +82,7 @@ void ResolveProxyMsgHelper::StartPendingRequest() {
PendingRequest& req = pending_requests_.front(); PendingRequest& req = pending_requests_.front();
// Verify the request wasn't started yet. // Verify the request wasn't started yet.
DCHECK(nullptr == req.pac_req); DCHECK(nullptr == req.request);
if (context_getter_.get()) { if (context_getter_.get()) {
proxy_service_ = context_getter_->GetURLRequestContext()->proxy_service(); proxy_service_ = context_getter_->GetURLRequestContext()->proxy_service();
@@ -94,7 +94,7 @@ void ResolveProxyMsgHelper::StartPendingRequest() {
req.url, std::string(), &proxy_info_, req.url, std::string(), &proxy_info_,
base::Bind(&ResolveProxyMsgHelper::OnResolveProxyCompleted, base::Bind(&ResolveProxyMsgHelper::OnResolveProxyCompleted,
base::Unretained(this)), base::Unretained(this)),
&req.pac_req, nullptr, net::NetLogWithSource()); &req.request, nullptr, net::NetLogWithSource());
// Completed synchronously. // Completed synchronously.
if (result != net::ERR_IO_PENDING) if (result != net::ERR_IO_PENDING)

@@ -57,17 +57,17 @@ class CONTENT_EXPORT ResolveProxyMsgHelper : public BrowserMessageFilter {
// A PendingRequest is a resolve request that is in progress, or queued. // A PendingRequest is a resolve request that is in progress, or queued.
struct PendingRequest { struct PendingRequest {
public: public:
PendingRequest(const GURL& url, IPC::Message* reply_msg) : PendingRequest(const GURL& url, IPC::Message* reply_msg)
url(url), reply_msg(reply_msg), pac_req(NULL) { } : url(url), reply_msg(reply_msg), request(NULL) {}
// The URL of the request. // The URL of the request.
GURL url; GURL url;
// Data to pass back to the delegate on completion (we own it until then). // Data to pass back to the delegate on completion (we own it until then).
IPC::Message* reply_msg; IPC::Message* reply_msg;
// Handle for cancelling the current request if it has started (else NULL). // Handle for cancelling the current request if it has started (else NULL).
net::ProxyService::PacRequest* pac_req; net::ProxyService::Request* request;
}; };
// Info about the current outstanding proxy request. // Info about the current outstanding proxy request.

@@ -619,10 +619,10 @@ TEST_F(NetworkContextTest, NoInitialProxyConfig) {
// Before there's a proxy configuration, proxy requests should hang. // Before there's a proxy configuration, proxy requests should hang.
net::ProxyInfo proxy_info; net::ProxyInfo proxy_info;
net::TestCompletionCallback test_callback; net::TestCompletionCallback test_callback;
net::ProxyService::PacRequest* pac_request = nullptr; net::ProxyService::Request* request = nullptr;
ASSERT_EQ(net::ERR_IO_PENDING, ASSERT_EQ(net::ERR_IO_PENDING,
proxy_service->ResolveProxy(GURL("http://bar/"), "GET", &proxy_info, proxy_service->ResolveProxy(GURL("http://bar/"), "GET", &proxy_info,
test_callback.callback(), &pac_request, test_callback.callback(), &request,
nullptr, net::NetLogWithSource())); nullptr, net::NetLogWithSource()));
scoped_task_environment_.RunUntilIdle(); scoped_task_environment_.RunUntilIdle();
EXPECT_FALSE(proxy_service->config().is_valid()); EXPECT_FALSE(proxy_service->config().is_valid());

@@ -62,7 +62,7 @@ ConnectionFactoryImpl::ConnectionFactoryImpl(
http_network_session_(http_network_session), http_network_session_(http_network_session),
net_log_( net_log_(
net::NetLogWithSource::Make(net_log, net::NetLogSourceType::SOCKET)), net::NetLogWithSource::Make(net_log, net::NetLogSourceType::SOCKET)),
pac_request_(NULL), proxy_resolve_request_(NULL),
connecting_(false), connecting_(false),
waiting_for_backoff_(false), waiting_for_backoff_(false),
waiting_for_network_online_(false), waiting_for_network_online_(false),
@@ -78,9 +78,10 @@ ConnectionFactoryImpl::ConnectionFactoryImpl(
ConnectionFactoryImpl::~ConnectionFactoryImpl() { ConnectionFactoryImpl::~ConnectionFactoryImpl() {
CloseSocket(); CloseSocket();
net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
if (pac_request_) { if (proxy_resolve_request_) {
gcm_network_session_->proxy_service()->CancelPacRequest(pac_request_); gcm_network_session_->proxy_service()->CancelRequest(
pac_request_ = NULL; proxy_resolve_request_);
proxy_resolve_request_ = NULL;
} }
} }
@@ -326,14 +327,10 @@ void ConnectionFactoryImpl::StartConnection() {
recorder_->RecordConnectionInitiated(current_endpoint.host()); recorder_->RecordConnectionInitiated(current_endpoint.host());
UpdateFromHttpNetworkSession(); UpdateFromHttpNetworkSession();
int status = gcm_network_session_->proxy_service()->ResolveProxy( int status = gcm_network_session_->proxy_service()->ResolveProxy(
current_endpoint, current_endpoint, std::string(), &proxy_info_,
std::string(),
&proxy_info_,
base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
&pac_request_, &proxy_resolve_request_, NULL, net_log_);
NULL,
net_log_);
if (status != net::ERR_IO_PENDING) if (status != net::ERR_IO_PENDING)
OnProxyResolveDone(status); OnProxyResolveDone(status);
} }
@@ -447,7 +444,7 @@ void ConnectionFactoryImpl::ConnectionHandlerCallback(int result) {
// HttpStreamFactoryImpl::Job::DoResolveProxyComplete. This should be // HttpStreamFactoryImpl::Job::DoResolveProxyComplete. This should be
// refactored into some common place. // refactored into some common place.
void ConnectionFactoryImpl::OnProxyResolveDone(int status) { void ConnectionFactoryImpl::OnProxyResolveDone(int status) {
pac_request_ = NULL; proxy_resolve_request_ = NULL;
DVLOG(1) << "Proxy resolution status: " << status; DVLOG(1) << "Proxy resolution status: " << status;
DCHECK_NE(status, net::ERR_IO_PENDING); DCHECK_NE(status, net::ERR_IO_PENDING);
@@ -497,7 +494,7 @@ void ConnectionFactoryImpl::OnProxyResolveDone(int status) {
// a proxy it always returns ERR_IO_PENDING and posts a call to // a proxy it always returns ERR_IO_PENDING and posts a call to
// OnProxyResolveDone with the result of the reconsideration. // OnProxyResolveDone with the result of the reconsideration.
int ConnectionFactoryImpl::ReconsiderProxyAfterError(int error) { int ConnectionFactoryImpl::ReconsiderProxyAfterError(int error) {
DCHECK(!pac_request_); DCHECK(!proxy_resolve_request_);
DCHECK_NE(error, net::OK); DCHECK_NE(error, net::OK);
DCHECK_NE(error, net::ERR_IO_PENDING); DCHECK_NE(error, net::ERR_IO_PENDING);
// A failure to resolve the hostname or any error related to establishing a // A failure to resolve the hostname or any error related to establishing a
@@ -553,7 +550,7 @@ int ConnectionFactoryImpl::ReconsiderProxyAfterError(int error) {
GetCurrentEndpoint(), std::string(), error, &proxy_info_, GetCurrentEndpoint(), std::string(), error, &proxy_info_,
base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
&pac_request_, NULL, net_log_); &proxy_resolve_request_, NULL, net_log_);
if (status == net::OK || status == net::ERR_IO_PENDING) { if (status == net::OK || status == net::ERR_IO_PENDING) {
CloseSocket(); CloseSocket();
} else { } else {

@@ -159,8 +159,9 @@ class GCM_EXPORT ConnectionFactoryImpl :
net::HttpNetworkSession* http_network_session_; net::HttpNetworkSession* http_network_session_;
// Net log to use in connection attempts. // Net log to use in connection attempts.
net::NetLogWithSource net_log_; net::NetLogWithSource net_log_;
// The current PAC request, if one exists. Owned by the proxy service. // The current proxy resolution request, if one exists. Owned by the proxy
net::ProxyService::PacRequest* pac_request_; // service.
net::ProxyService::Request* proxy_resolve_request_;
// The current proxy info. // The current proxy info.
net::ProxyInfo proxy_info_; net::ProxyInfo proxy_info_;
// The handle to the socket for the current connection, if one exists. // The handle to the socket for the current connection, if one exists.

@@ -84,7 +84,7 @@ HttpStreamFactoryImpl::JobController::JobController(
bound_job_(nullptr), bound_job_(nullptr),
can_start_alternative_proxy_job_(true), can_start_alternative_proxy_job_(true),
next_state_(STATE_RESOLVE_PROXY), next_state_(STATE_RESOLVE_PROXY),
pac_request_(nullptr), proxy_resolve_request_(nullptr),
io_callback_( io_callback_(
base::Bind(&JobController::OnIOComplete, base::Unretained(this))), base::Bind(&JobController::OnIOComplete, base::Unretained(this))),
request_info_(request_info), request_info_(request_info),
@@ -106,9 +106,9 @@ HttpStreamFactoryImpl::JobController::~JobController() {
main_job_.reset(); main_job_.reset();
alternative_job_.reset(); alternative_job_.reset();
bound_job_ = nullptr; bound_job_ = nullptr;
if (pac_request_) { if (proxy_resolve_request_) {
DCHECK_EQ(STATE_RESOLVE_PROXY_COMPLETE, next_state_); DCHECK_EQ(STATE_RESOLVE_PROXY_COMPLETE, next_state_);
session_->proxy_service()->CancelPacRequest(pac_request_); session_->proxy_service()->CancelRequest(proxy_resolve_request_);
} }
net_log_.EndEvent(NetLogEventType::HTTP_STREAM_JOB_CONTROLLER); net_log_.EndEvent(NetLogEventType::HTTP_STREAM_JOB_CONTROLLER);
} }
@@ -161,7 +161,7 @@ void HttpStreamFactoryImpl::JobController::Preconnect(int num_streams) {
LoadState HttpStreamFactoryImpl::JobController::GetLoadState() const { LoadState HttpStreamFactoryImpl::JobController::GetLoadState() const {
DCHECK(request_); DCHECK(request_);
if (next_state_ == STATE_RESOLVE_PROXY_COMPLETE) if (next_state_ == STATE_RESOLVE_PROXY_COMPLETE)
return session_->proxy_service()->GetLoadState(pac_request_); return session_->proxy_service()->GetLoadState(proxy_resolve_request_);
if (bound_job_) if (bound_job_)
return bound_job_->GetLoadState(); return bound_job_->GetLoadState();
if (main_job_) if (main_job_)
@@ -739,7 +739,7 @@ int HttpStreamFactoryImpl::JobController::DoLoop(int rv) {
} }
int HttpStreamFactoryImpl::JobController::DoResolveProxy() { int HttpStreamFactoryImpl::JobController::DoResolveProxy() {
DCHECK(!pac_request_); DCHECK(!proxy_resolve_request_);
DCHECK(session_); DCHECK(session_);
next_state_ = STATE_RESOLVE_PROXY_COMPLETE; next_state_ = STATE_RESOLVE_PROXY_COMPLETE;
@@ -754,13 +754,13 @@ int HttpStreamFactoryImpl::JobController::DoResolveProxy() {
return session_->proxy_service()->ResolveProxy( return session_->proxy_service()->ResolveProxy(
origin_url, request_info_.method, &proxy_info_, io_callback_, origin_url, request_info_.method, &proxy_info_, io_callback_,
&pac_request_, session_->context().proxy_delegate, net_log_); &proxy_resolve_request_, session_->context().proxy_delegate, net_log_);
} }
int HttpStreamFactoryImpl::JobController::DoResolveProxyComplete(int rv) { int HttpStreamFactoryImpl::JobController::DoResolveProxyComplete(int rv) {
DCHECK_NE(ERR_IO_PENDING, rv); DCHECK_NE(ERR_IO_PENDING, rv);
pac_request_ = nullptr; proxy_resolve_request_ = nullptr;
net_log_.AddEvent( net_log_.AddEvent(
NetLogEventType::HTTP_STREAM_JOB_CONTROLLER_PROXY_SERVER_RESOLVED, NetLogEventType::HTTP_STREAM_JOB_CONTROLLER_PROXY_SERVER_RESOLVED,
base::Bind( base::Bind(
@@ -1275,7 +1275,7 @@ int HttpStreamFactoryImpl::JobController::ReconsiderProxyAfterError(Job* job,
int error) { int error) {
// ReconsiderProxyAfterError() should only be called when the last job fails. // ReconsiderProxyAfterError() should only be called when the last job fails.
DCHECK(!(alternative_job_ && main_job_)); DCHECK(!(alternative_job_ && main_job_));
DCHECK(!pac_request_); DCHECK(!proxy_resolve_request_);
DCHECK(session_); DCHECK(session_);
if (!job->should_reconsider_proxy()) if (!job->should_reconsider_proxy())
@@ -1300,7 +1300,7 @@ int HttpStreamFactoryImpl::JobController::ReconsiderProxyAfterError(Job* job,
int rv = session_->proxy_service()->ReconsiderProxyAfterError( int rv = session_->proxy_service()->ReconsiderProxyAfterError(
origin_url, request_info_.method, error, &proxy_info_, io_callback_, origin_url, request_info_.method, error, &proxy_info_, io_callback_,
&pac_request_, session_->context().proxy_delegate, net_log_); &proxy_resolve_request_, session_->context().proxy_delegate, net_log_);
if (rv == OK || rv == ERR_IO_PENDING) { if (rv == OK || rv == ERR_IO_PENDING) {
if (!job->using_quic()) if (!job->using_quic())
RemoveRequestFromSpdySessionRequestMap(); RemoveRequestFromSpdySessionRequestMap();

@@ -369,7 +369,7 @@ class HttpStreamFactoryImpl::JobController
bool can_start_alternative_proxy_job_; bool can_start_alternative_proxy_job_;
State next_state_; State next_state_;
ProxyService::PacRequest* pac_request_; ProxyService::Request* proxy_resolve_request_;
CompletionCallback io_callback_; CompletionCallback io_callback_;
const HttpRequestInfo request_info_; const HttpRequestInfo request_info_;
ProxyInfo proxy_info_; ProxyInfo proxy_info_;

@@ -773,18 +773,17 @@ class ProxyService::ProxyScriptDeciderPoller {
const ProxyService::PacPollPolicy* const ProxyService::PacPollPolicy*
ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL; ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL;
// ProxyService::PacRequest --------------------------------------------------- // ProxyService::Request ---------------------------------------------------
class ProxyService::PacRequest class ProxyService::Request : public base::RefCounted<ProxyService::Request> {
: public base::RefCounted<ProxyService::PacRequest> {
public: public:
PacRequest(ProxyService* service, Request(ProxyService* service,
const GURL& url, const GURL& url,
const std::string& method, const std::string& method,
ProxyDelegate* proxy_delegate, ProxyDelegate* proxy_delegate,
ProxyInfo* results, ProxyInfo* results,
const CompletionCallback& user_callback, const CompletionCallback& user_callback,
const NetLogWithSource& net_log) const NetLogWithSource& net_log)
: service_(service), : service_(service),
user_callback_(user_callback), user_callback_(user_callback),
results_(results), results_(results),
@@ -811,7 +810,7 @@ class ProxyService::PacRequest
return resolver()->GetProxyForURL( return resolver()->GetProxyForURL(
url_, results_, url_, results_,
base::Bind(&PacRequest::QueryComplete, base::Unretained(this)), base::Bind(&Request::QueryComplete, base::Unretained(this)),
&resolve_job_, net_log_); &resolve_job_, net_log_);
} }
@@ -892,15 +891,15 @@ class ProxyService::PacRequest
} }
private: private:
friend class base::RefCounted<ProxyService::PacRequest>; friend class base::RefCounted<ProxyService::Request>;
~PacRequest() = default; ~Request() = default;
// Callback for when the ProxyResolver request has completed. // Callback for when the ProxyResolver request has completed.
void QueryComplete(int result_code) { void QueryComplete(int result_code) {
result_code = QueryDidComplete(result_code); result_code = QueryDidComplete(result_code);
// Remove this completed PacRequest from the service's pending list. // Remove this completed Request from the service's pending list.
/// (which will probably cause deletion of |this|). /// (which will probably cause deletion of |this|).
if (!user_callback_.is_null()) { if (!user_callback_.is_null()) {
CompletionCallback callback = user_callback_; CompletionCallback callback = user_callback_;
@@ -1020,7 +1019,7 @@ int ProxyService::ResolveProxy(const GURL& raw_url,
const std::string& method, const std::string& method,
ProxyInfo* result, ProxyInfo* result,
const CompletionCallback& callback, const CompletionCallback& callback,
PacRequest** pac_request, Request** pac_request,
ProxyDelegate* proxy_delegate, ProxyDelegate* proxy_delegate,
const NetLogWithSource& net_log) { const NetLogWithSource& net_log) {
DCHECK(!callback.is_null()); DCHECK(!callback.is_null());
@@ -1032,7 +1031,7 @@ int ProxyService::ResolveProxyHelper(const GURL& raw_url,
const std::string& method, const std::string& method,
ProxyInfo* result, ProxyInfo* result,
const CompletionCallback& callback, const CompletionCallback& callback,
PacRequest** pac_request, Request** pac_request,
ProxyDelegate* proxy_delegate, ProxyDelegate* proxy_delegate,
const NetLogWithSource& net_log) { const NetLogWithSource& net_log) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
@@ -1066,8 +1065,8 @@ int ProxyService::ResolveProxyHelper(const GURL& raw_url,
if (callback.is_null()) if (callback.is_null())
return ERR_IO_PENDING; return ERR_IO_PENDING;
scoped_refptr<PacRequest> req(new PacRequest( scoped_refptr<Request> req(new Request(this, url, method, proxy_delegate,
this, url, method, proxy_delegate, result, callback, net_log)); result, callback, net_log));
if (current_state_ == STATE_READY) { if (current_state_ == STATE_READY) {
// Start the resolve request. // Start the resolve request.
@@ -1146,7 +1145,7 @@ void ProxyService::SuspendAllPendingRequests() {
for (PendingRequests::iterator it = pending_requests_.begin(); for (PendingRequests::iterator it = pending_requests_.begin();
it != pending_requests_.end(); it != pending_requests_.end();
++it) { ++it) {
PacRequest* req = it->get(); Request* req = it->get();
if (req->is_started()) { if (req->is_started()) {
req->CancelResolveJob(); req->CancelResolveJob();
@@ -1161,14 +1160,14 @@ void ProxyService::SetReady() {
current_state_ = STATE_READY; current_state_ = STATE_READY;
// Make a copy in case |this| is deleted during the synchronous completion // Make a copy in case |this| is deleted during the synchronous completion
// of one of the requests. If |this| is deleted then all of the PacRequest // of one of the requests. If |this| is deleted then all of the Request
// instances will be Cancel()-ed. // instances will be Cancel()-ed.
PendingRequests pending_copy = pending_requests_; PendingRequests pending_copy = pending_requests_;
for (PendingRequests::iterator it = pending_copy.begin(); for (PendingRequests::iterator it = pending_copy.begin();
it != pending_copy.end(); it != pending_copy.end();
++it) { ++it) {
PacRequest* req = it->get(); Request* req = it->get();
if (!req->is_started() && !req->was_cancelled()) { if (!req->is_started() && !req->was_cancelled()) {
req->net_log()->EndEvent( req->net_log()->EndEvent(
NetLogEventType::PROXY_SERVICE_WAITING_FOR_INIT_PAC); NetLogEventType::PROXY_SERVICE_WAITING_FOR_INIT_PAC);
@@ -1256,7 +1255,7 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url,
int net_error, int net_error,
ProxyInfo* result, ProxyInfo* result,
const CompletionCallback& callback, const CompletionCallback& callback,
PacRequest** pac_request, Request** pac_request,
ProxyDelegate* proxy_delegate, ProxyDelegate* proxy_delegate,
const NetLogWithSource& net_log) { const NetLogWithSource& net_log) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
@@ -1329,25 +1328,25 @@ void ProxyService::ReportSuccess(const ProxyInfo& result,
} }
} }
void ProxyService::CancelPacRequest(PacRequest* req) { void ProxyService::CancelRequest(Request* req) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(req); DCHECK(req);
req->Cancel(); req->Cancel();
RemovePendingRequest(req); RemovePendingRequest(req);
} }
LoadState ProxyService::GetLoadState(const PacRequest* req) const { LoadState ProxyService::GetLoadState(const Request* req) const {
CHECK(req); CHECK(req);
if (current_state_ == STATE_WAITING_FOR_INIT_PROXY_RESOLVER) if (current_state_ == STATE_WAITING_FOR_INIT_PROXY_RESOLVER)
return init_proxy_resolver_->GetLoadState(); return init_proxy_resolver_->GetLoadState();
return req->GetLoadState(); return req->GetLoadState();
} }
bool ProxyService::ContainsPendingRequest(PacRequest* req) { bool ProxyService::ContainsPendingRequest(Request* req) {
return pending_requests_.count(req) == 1; return pending_requests_.count(req) == 1;
} }
void ProxyService::RemovePendingRequest(PacRequest* req) { void ProxyService::RemovePendingRequest(Request* req) {
DCHECK(ContainsPendingRequest(req)); DCHECK(ContainsPendingRequest(req));
pending_requests_.erase(req); pending_requests_.erase(req);
} }

@@ -119,9 +119,8 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
~ProxyService() override; ~ProxyService() override;
// Used internally to handle PAC queries. // Used to track proxy resolution requests that complete asynchronously.
// TODO(eroman): consider naming this simply "Request". class Request;
class PacRequest;
// Determines the appropriate proxy for |url| for a |method| request and // Determines the appropriate proxy for |url| for a |method| request and
// stores the result in |results|. If |method| is empty, the caller can expect // stores the result in |results|. If |method| is empty, the caller can expect
@@ -133,9 +132,9 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// ResolveProxy. // ResolveProxy.
// //
// The caller is responsible for ensuring that |results| and |callback| // The caller is responsible for ensuring that |results| and |callback|
// remain valid until the callback is run or until |pac_request| is cancelled // remain valid until the callback is run or until |request| is cancelled
// via CancelPacRequest. |pac_request| is only valid while the completion // via CancelRequest. |request| is only valid while the completion
// callback is still pending. NULL can be passed for |pac_request| if // callback is still pending. NULL can be passed for |request| if
// the caller will not need to cancel the request. // the caller will not need to cancel the request.
// //
// We use the three possible proxy access types in the following order, // We use the three possible proxy access types in the following order,
@@ -150,7 +149,7 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
const std::string& method, const std::string& method,
ProxyInfo* results, ProxyInfo* results,
const CompletionCallback& callback, const CompletionCallback& callback,
PacRequest** pac_request, Request** request,
ProxyDelegate* proxy_delegate, ProxyDelegate* proxy_delegate,
const NetLogWithSource& net_log); const NetLogWithSource& net_log);
@@ -170,7 +169,7 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// list of possible values. The semantics of this call are otherwise // list of possible values. The semantics of this call are otherwise
// similar to ResolveProxy. // similar to ResolveProxy.
// //
// NULL can be passed for |pac_request| if the caller will not need to // NULL can be passed for |request| if the caller will not need to
// cancel the request. // cancel the request.
// //
// Returns ERR_FAILED if there is not another proxy config to try. // Returns ERR_FAILED if there is not another proxy config to try.
@@ -181,7 +180,7 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
int net_error, int net_error,
ProxyInfo* results, ProxyInfo* results,
const CompletionCallback& callback, const CompletionCallback& callback,
PacRequest** pac_request, Request** request,
ProxyDelegate* proxy_delegate, ProxyDelegate* proxy_delegate,
const NetLogWithSource& net_log); const NetLogWithSource& net_log);
@@ -208,11 +207,11 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
void ReportSuccess(const ProxyInfo& proxy_info, void ReportSuccess(const ProxyInfo& proxy_info,
ProxyDelegate* proxy_delegate); ProxyDelegate* proxy_delegate);
// Call this method with a non-null |pac_request| to cancel the PAC request. // Call this method with a non-null |request| to cancel the PAC request.
void CancelPacRequest(PacRequest* pac_request); void CancelRequest(Request* request);
// Returns the LoadState for this |pac_request| which must be non-NULL. // Returns the LoadState for this |request| which must be non-NULL.
LoadState GetLoadState(const PacRequest* pac_request) const; LoadState GetLoadState(const Request* request) const;
// Sets the ProxyScriptFetcher and DhcpProxyScriptFetcher dependencies. This // Sets the ProxyScriptFetcher and DhcpProxyScriptFetcher dependencies. This
// is needed if the ProxyResolver is of type ProxyResolverWithoutFetch. // is needed if the ProxyResolver is of type ProxyResolverWithoutFetch.
@@ -318,11 +317,11 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
private: private:
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect);
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect);
friend class PacRequest; friend class Request;
class InitProxyResolver; class InitProxyResolver;
class ProxyScriptDeciderPoller; class ProxyScriptDeciderPoller;
typedef std::set<scoped_refptr<PacRequest>> PendingRequests; typedef std::set<scoped_refptr<Request>> PendingRequests;
enum State { enum State {
STATE_NONE, STATE_NONE,
@@ -361,7 +360,7 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
const std::string& method, const std::string& method,
ProxyInfo* results, ProxyInfo* results,
const CompletionCallback& callback, const CompletionCallback& callback,
PacRequest** pac_request, Request** request,
ProxyDelegate* proxy_delegate, ProxyDelegate* proxy_delegate,
const NetLogWithSource& net_log); const NetLogWithSource& net_log);
@@ -374,10 +373,10 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
void SetReady(); void SetReady();
// Returns true if |pending_requests_| contains |req|. // Returns true if |pending_requests_| contains |req|.
bool ContainsPendingRequest(PacRequest* req); bool ContainsPendingRequest(Request* req);
// Removes |req| from the list of pending requests. // Removes |req| from the list of pending requests.
void RemovePendingRequest(PacRequest* req); void RemovePendingRequest(Request* req);
// Called when proxy resolution has completed (either synchronously or // Called when proxy resolution has completed (either synchronously or
// asynchronously). Handles logging the result, and cleaning out // asynchronously). Handles logging the result, and cleaning out

@@ -499,7 +499,7 @@ TEST_F(ProxyServiceTest, PAC) {
ProxyInfo info; ProxyInfo info;
TestCompletionCallback callback; TestCompletionCallback callback;
ProxyService::PacRequest* request; ProxyService::Request* request;
BoundTestNetLog log; BoundTestNetLog log;
int rv = service.ResolveProxy(url, std::string(), &info, callback.callback(), int rv = service.ResolveProxy(url, std::string(), &info, callback.callback(),
@@ -1948,7 +1948,7 @@ TEST_F(ProxyServiceTest, CancelInProgressRequest) {
ProxyInfo info2; ProxyInfo info2;
TestCompletionCallback callback2; TestCompletionCallback callback2;
ProxyService::PacRequest* request2; ProxyService::Request* request2;
rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(), rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(),
&request2, nullptr, NetLogWithSource()); &request2, nullptr, NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
@@ -1963,7 +1963,7 @@ TEST_F(ProxyServiceTest, CancelInProgressRequest) {
GetPendingJobsForURLs(resolver, url1, url2, url3); GetPendingJobsForURLs(resolver, url1, url2, url3);
// Cancel the second request // Cancel the second request
service.CancelPacRequest(request2); service.CancelRequest(request2);
JobMap jobs = GetPendingJobsForURLs(resolver, url1, url3); JobMap jobs = GetPendingJobsForURLs(resolver, url1, url3);
@@ -2009,7 +2009,7 @@ TEST_F(ProxyServiceTest, InitialPACScriptDownload) {
ProxyInfo info1; ProxyInfo info1;
TestCompletionCallback callback1; TestCompletionCallback callback1;
ProxyService::PacRequest* request1; ProxyService::Request* request1;
int rv = int rv =
service.ResolveProxy(url1, std::string(), &info1, callback1.callback(), service.ResolveProxy(url1, std::string(), &info1, callback1.callback(),
&request1, nullptr, NetLogWithSource()); &request1, nullptr, NetLogWithSource());
@@ -2021,14 +2021,14 @@ TEST_F(ProxyServiceTest, InitialPACScriptDownload) {
ProxyInfo info2; ProxyInfo info2;
TestCompletionCallback callback2; TestCompletionCallback callback2;
ProxyService::PacRequest* request2; ProxyService::Request* request2;
rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(), rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(),
&request2, nullptr, NetLogWithSource()); &request2, nullptr, NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
ProxyInfo info3; ProxyInfo info3;
TestCompletionCallback callback3; TestCompletionCallback callback3;
ProxyService::PacRequest* request3; ProxyService::Request* request3;
rv = service.ResolveProxy(url3, std::string(), &info3, callback3.callback(), rv = service.ResolveProxy(url3, std::string(), &info3, callback3.callback(),
&request3, nullptr, NetLogWithSource()); &request3, nullptr, NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
@@ -2178,7 +2178,7 @@ TEST_F(ProxyServiceTest, CancelWhilePACFetching) {
// Start 3 requests. // Start 3 requests.
ProxyInfo info1; ProxyInfo info1;
TestCompletionCallback callback1; TestCompletionCallback callback1;
ProxyService::PacRequest* request1; ProxyService::Request* request1;
BoundTestNetLog log1; BoundTestNetLog log1;
int rv = service.ResolveProxy(GURL("http://request1"), std::string(), &info1, int rv = service.ResolveProxy(GURL("http://request1"), std::string(), &info1,
callback1.callback(), &request1, nullptr, callback1.callback(), &request1, nullptr,
@@ -2191,7 +2191,7 @@ TEST_F(ProxyServiceTest, CancelWhilePACFetching) {
ProxyInfo info2; ProxyInfo info2;
TestCompletionCallback callback2; TestCompletionCallback callback2;
ProxyService::PacRequest* request2; ProxyService::Request* request2;
rv = service.ResolveProxy(GURL("http://request2"), std::string(), &info2, rv = service.ResolveProxy(GURL("http://request2"), std::string(), &info2,
callback2.callback(), &request2, nullptr, callback2.callback(), &request2, nullptr,
NetLogWithSource()); NetLogWithSource());
@@ -2208,8 +2208,8 @@ TEST_F(ProxyServiceTest, CancelWhilePACFetching) {
EXPECT_TRUE(factory->pending_requests().empty()); EXPECT_TRUE(factory->pending_requests().empty());
// Cancel the first 2 jobs. // Cancel the first 2 jobs.
service.CancelPacRequest(request1); service.CancelRequest(request1);
service.CancelPacRequest(request2); service.CancelRequest(request2);
// At this point the ProxyService should be waiting for the // At this point the ProxyService should be waiting for the
// ProxyScriptFetcher to invoke its completion callback, notifying it of // ProxyScriptFetcher to invoke its completion callback, notifying it of
@@ -2285,7 +2285,7 @@ TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomPac) {
ProxyInfo info2; ProxyInfo info2;
TestCompletionCallback callback2; TestCompletionCallback callback2;
ProxyService::PacRequest* request2; ProxyService::Request* request2;
rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(), rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(),
&request2, nullptr, NetLogWithSource()); &request2, nullptr, NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
@@ -2369,7 +2369,7 @@ TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomPac2) {
ProxyInfo info2; ProxyInfo info2;
TestCompletionCallback callback2; TestCompletionCallback callback2;
ProxyService::PacRequest* request2; ProxyService::Request* request2;
rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(), rv = service.ResolveProxy(url2, std::string(), &info2, callback2.callback(),
&request2, nullptr, NetLogWithSource()); &request2, nullptr, NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
@@ -2446,7 +2446,7 @@ TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomToManual) {
ProxyInfo info2; ProxyInfo info2;
TestCompletionCallback callback2; TestCompletionCallback callback2;
ProxyService::PacRequest* request2; ProxyService::Request* request2;
rv = service.ResolveProxy(GURL("http://request2"), std::string(), &info2, rv = service.ResolveProxy(GURL("http://request2"), std::string(), &info2,
callback2.callback(), &request2, nullptr, callback2.callback(), &request2, nullptr,
NetLogWithSource()); NetLogWithSource());
@@ -3700,7 +3700,7 @@ TEST_F(ProxyServiceTest, OnShutdownWithLiveRequest) {
ProxyInfo info; ProxyInfo info;
TestCompletionCallback callback; TestCompletionCallback callback;
ProxyService::PacRequest* request; ProxyService::Request* request;
int rv = service.ResolveProxy(GURL("http://request/"), std::string(), &info, int rv = service.ResolveProxy(GURL("http://request/"), std::string(), &info,
callback.callback(), &request, nullptr, callback.callback(), &request, nullptr,
NetLogWithSource()); NetLogWithSource());
@@ -3736,7 +3736,7 @@ TEST_F(ProxyServiceTest, OnShutdownFollowedByRequest) {
ProxyInfo info; ProxyInfo info;
TestCompletionCallback callback; TestCompletionCallback callback;
ProxyService::PacRequest* request; ProxyService::Request* request;
int rv = service.ResolveProxy(GURL("http://request/"), std::string(), &info, int rv = service.ResolveProxy(GURL("http://request/"), std::string(), &info,
callback.callback(), &request, nullptr, callback.callback(), &request, nullptr,
NetLogWithSource()); NetLogWithSource());

@@ -45,7 +45,7 @@ URLRequestFtpJob::URLRequestFtpJob(
: URLRequestJob(request, network_delegate), : URLRequestJob(request, network_delegate),
priority_(DEFAULT_PRIORITY), priority_(DEFAULT_PRIORITY),
proxy_service_(request_->context()->proxy_service()), proxy_service_(request_->context()->proxy_service()),
pac_request_(NULL), proxy_resolve_request_(NULL),
http_response_info_(NULL), http_response_info_(NULL),
read_in_progress_(false), read_in_progress_(false),
ftp_transaction_factory_(ftp_transaction_factory), ftp_transaction_factory_(ftp_transaction_factory),
@@ -104,7 +104,7 @@ void URLRequestFtpJob::SetPriority(RequestPriority priority) {
} }
void URLRequestFtpJob::Start() { void URLRequestFtpJob::Start() {
DCHECK(!pac_request_); DCHECK(!proxy_resolve_request_);
DCHECK(!ftp_transaction_); DCHECK(!ftp_transaction_);
DCHECK(!http_transaction_); DCHECK(!http_transaction_);
@@ -117,7 +117,7 @@ void URLRequestFtpJob::Start() {
request_->url(), "GET", &proxy_info_, request_->url(), "GET", &proxy_info_,
base::Bind(&URLRequestFtpJob::OnResolveProxyComplete, base::Bind(&URLRequestFtpJob::OnResolveProxyComplete,
base::Unretained(this)), base::Unretained(this)),
&pac_request_, NULL, request_->net_log()); &proxy_resolve_request_, NULL, request_->net_log());
if (rv == ERR_IO_PENDING) if (rv == ERR_IO_PENDING)
return; return;
@@ -126,9 +126,9 @@ void URLRequestFtpJob::Start() {
} }
void URLRequestFtpJob::Kill() { void URLRequestFtpJob::Kill() {
if (pac_request_) { if (proxy_resolve_request_) {
proxy_service_->CancelPacRequest(pac_request_); proxy_service_->CancelRequest(proxy_resolve_request_);
pac_request_ = nullptr; proxy_resolve_request_ = nullptr;
} }
if (ftp_transaction_) if (ftp_transaction_)
ftp_transaction_.reset(); ftp_transaction_.reset();
@@ -139,7 +139,7 @@ void URLRequestFtpJob::Kill() {
} }
void URLRequestFtpJob::OnResolveProxyComplete(int result) { void URLRequestFtpJob::OnResolveProxyComplete(int result) {
pac_request_ = NULL; proxy_resolve_request_ = NULL;
if (result != OK) { if (result != OK) {
OnStartCompletedAsync(result); OnStartCompletedAsync(result);
@@ -278,8 +278,8 @@ void URLRequestFtpJob::RestartTransactionWithAuth() {
} }
LoadState URLRequestFtpJob::GetLoadState() const { LoadState URLRequestFtpJob::GetLoadState() const {
if (pac_request_) if (proxy_resolve_request_)
return proxy_service_->GetLoadState(pac_request_); return proxy_service_->GetLoadState(proxy_resolve_request_);
if (proxy_info_.is_direct()) { if (proxy_info_.is_direct()) {
return ftp_transaction_ ? return ftp_transaction_ ?
ftp_transaction_->GetLoadState() : LOAD_STATE_IDLE; ftp_transaction_->GetLoadState() : LOAD_STATE_IDLE;

@@ -81,7 +81,7 @@ class NET_EXPORT_PRIVATE URLRequestFtpJob : public URLRequestJob {
ProxyService* proxy_service_; ProxyService* proxy_service_;
ProxyInfo proxy_info_; ProxyInfo proxy_info_;
ProxyService::PacRequest* pac_request_; ProxyService::Request* proxy_resolve_request_;
FtpRequestInfo ftp_request_info_; FtpRequestInfo ftp_request_info_;
std::unique_ptr<FtpTransaction> ftp_transaction_; std::unique_ptr<FtpTransaction> ftp_transaction_;

@@ -34,7 +34,7 @@ ProxyResolvingClientSocket::ProxyResolvingClientSocket(
const net::SSLConfig& ssl_config, const net::SSLConfig& ssl_config,
const GURL& url) const GURL& url)
: ssl_config_(ssl_config), : ssl_config_(ssl_config),
pac_request_(NULL), proxy_resolve_request_(NULL),
url_(url), url_(url),
net_log_(net::NetLogWithSource::Make( net_log_(net::NetLogWithSource::Make(
request_context_getter->GetURLRequestContext()->net_log(), request_context_getter->GetURLRequestContext()->net_log(),
@@ -148,7 +148,7 @@ int ProxyResolvingClientSocket::Connect(
url_, "POST", &proxy_info_, url_, "POST", &proxy_info_,
base::BindRepeating(&ProxyResolvingClientSocket::ConnectToProxy, base::BindRepeating(&ProxyResolvingClientSocket::ConnectToProxy,
base::Unretained(this)), base::Unretained(this)),
&pac_request_, nullptr /*proxy_delegate*/, net_log_); &proxy_resolve_request_, nullptr /*proxy_delegate*/, net_log_);
if (net_error != net::ERR_IO_PENDING) { if (net_error != net::ERR_IO_PENDING) {
// Defer execution of ConnectToProxy instead of calling it // Defer execution of ConnectToProxy instead of calling it
// directly here for simplicity. From the caller's point of view, // directly here for simplicity. From the caller's point of view,
@@ -163,9 +163,9 @@ int ProxyResolvingClientSocket::Connect(
void ProxyResolvingClientSocket::Disconnect() { void ProxyResolvingClientSocket::Disconnect() {
CloseTransportSocket(); CloseTransportSocket();
if (pac_request_) { if (proxy_resolve_request_) {
network_session_->proxy_service()->CancelPacRequest(pac_request_); network_session_->proxy_service()->CancelRequest(proxy_resolve_request_);
pac_request_ = NULL; proxy_resolve_request_ = NULL;
} }
user_connect_callback_.Reset(); user_connect_callback_.Reset();
} }
@@ -258,7 +258,7 @@ void ProxyResolvingClientSocket::ApplySocketTag(const net::SocketTag& tag) {
} }
void ProxyResolvingClientSocket::ConnectToProxy(int net_error) { void ProxyResolvingClientSocket::ConnectToProxy(int net_error) {
pac_request_ = NULL; proxy_resolve_request_ = NULL;
DCHECK_NE(net_error, net::ERR_IO_PENDING); DCHECK_NE(net_error, net::ERR_IO_PENDING);
if (net_error == net::OK) { if (net_error == net::OK) {
@@ -330,7 +330,7 @@ void ProxyResolvingClientSocket::CloseTransportSocket() {
// reconsider a proxy it always returns ERR_IO_PENDING and posts a call to // reconsider a proxy it always returns ERR_IO_PENDING and posts a call to
// ConnectToProxy with the result of the reconsideration. // ConnectToProxy with the result of the reconsideration.
int ProxyResolvingClientSocket::ReconsiderProxyAfterError(int error) { int ProxyResolvingClientSocket::ReconsiderProxyAfterError(int error) {
DCHECK(!pac_request_); DCHECK(!proxy_resolve_request_);
DCHECK_NE(error, net::OK); DCHECK_NE(error, net::OK);
DCHECK_NE(error, net::ERR_IO_PENDING); DCHECK_NE(error, net::ERR_IO_PENDING);
// A failure to resolve the hostname or any error related to establishing a // A failure to resolve the hostname or any error related to establishing a
@@ -388,7 +388,7 @@ int ProxyResolvingClientSocket::ReconsiderProxyAfterError(int error) {
url_, std::string(), error, &proxy_info_, url_, std::string(), error, &proxy_info_,
base::BindRepeating(&ProxyResolvingClientSocket::ConnectToProxy, base::BindRepeating(&ProxyResolvingClientSocket::ConnectToProxy,
base::Unretained(this)), base::Unretained(this)),
&pac_request_, NULL, net_log_); &proxy_resolve_request_, NULL, net_log_);
if (rv == net::OK || rv == net::ERR_IO_PENDING) { if (rv == net::OK || rv == net::ERR_IO_PENDING) {
CloseTransportSocket(); CloseTransportSocket();
} else { } else {

@@ -107,7 +107,7 @@ class ProxyResolvingClientSocket : public net::StreamSocket {
std::unique_ptr<net::ClientSocketHandle> transport_; std::unique_ptr<net::ClientSocketHandle> transport_;
const net::SSLConfig ssl_config_; const net::SSLConfig ssl_config_;
net::ProxyService::PacRequest* pac_request_; net::ProxyService::Request* proxy_resolve_request_;
net::ProxyInfo proxy_info_; net::ProxyInfo proxy_info_;
const GURL url_; const GURL url_;
net::NetLogWithSource net_log_; net::NetLogWithSource net_log_;