Index: net/proxy/mojo_proxy_resolver_impl.cc |
diff --git a/net/proxy/mojo_proxy_resolver_impl.cc b/net/proxy/mojo_proxy_resolver_impl.cc |
index 3568b202d98c07c90139883e9c629a536b16b5fa..9cba1db4a7377615864d4bbb4b573c0bce10d164 100644 |
--- a/net/proxy/mojo_proxy_resolver_impl.cc |
+++ b/net/proxy/mojo_proxy_resolver_impl.cc |
@@ -24,6 +24,9 @@ class MojoProxyResolverImpl::Job : public mojo::ErrorHandler { |
void Start(); |
+ // Invoked when the LoadState for this job changes. |
+ void LoadStateChanged(LoadState load_state); |
+ |
private: |
// mojo::ErrorHandler override. |
// This is invoked in response to the client disconnecting, indicating |
@@ -66,6 +69,16 @@ MojoProxyResolverImpl::~MojoProxyResolverImpl() { |
STLDeleteElements(&resolve_jobs_); |
} |
+void MojoProxyResolverImpl::LoadStateChanged( |
+ net::ProxyResolver::RequestHandle handle, |
+ LoadState load_state) { |
+ auto it = request_handle_to_job_.find(handle); |
+ if (it == request_handle_to_job_.end()) |
+ return; |
+ |
+ it->second->LoadStateChanged(load_state); |
+} |
+ |
void MojoProxyResolverImpl::SetPacScript( |
const mojo::String& data, |
const mojo::Callback<void(int32_t)>& callback) { |
@@ -86,7 +99,11 @@ void MojoProxyResolverImpl::GetProxyForUrl( |
job->Start(); |
} |
-void MojoProxyResolverImpl::DeleteJob(Job* job) { |
+void MojoProxyResolverImpl::DeleteJob( |
+ Job* job, |
+ net::ProxyResolver::RequestHandle handle) { |
eroman
2015/02/25 00:08:05
Does this need another parameter? the handle is al
Sam McNally
2015/02/26 04:00:00
Done.
|
+ if (handle) |
+ request_handle_to_job_.erase(handle); |
size_t num_erased = resolve_jobs_.erase(job); |
DCHECK(num_erased); |
delete job; |
@@ -135,10 +152,15 @@ void MojoProxyResolverImpl::Job::Start() { |
return; |
} |
client_.set_error_handler(this); |
+ resolver_->request_handle_to_job_.insert( |
+ std::make_pair(request_handle_, this)); |
+} |
+ |
+void MojoProxyResolverImpl::Job::LoadStateChanged(LoadState load_state) { |
+ client_->LoadStateChanged(load_state); |
eroman
2015/02/25 00:08:05
What is the implication of calling this? Other cal
Anand Mistry (off Chromium)
2015/02/25 04:42:27
As an optimisation, I wonder if we should try to c
Sam McNally
2015/02/26 04:00:00
client_ is the mojo binding so it only sends a mes
|
} |
void MojoProxyResolverImpl::Job::GetProxyDone(int error) { |
- request_handle_ = nullptr; |
DVLOG(1) << "GetProxyForUrl(" << url_ << ") finished with error " << error |
<< ". " << result_.proxy_list().size() << " Proxies returned:"; |
for (const auto& proxy : result_.proxy_list().GetAll()) { |
@@ -150,11 +172,13 @@ void MojoProxyResolverImpl::Job::GetProxyDone(int error) { |
result_.proxy_list().GetAll()); |
} |
client_->ReportResult(error, result.Pass()); |
- resolver_->DeleteJob(this); |
+ auto request_handle = request_handle_; |
+ request_handle_ = nullptr; |
+ resolver_->DeleteJob(this, request_handle); |
} |
void MojoProxyResolverImpl::Job::OnConnectionError() { |
- resolver_->DeleteJob(this); |
+ resolver_->DeleteJob(this, request_handle_); |
} |
MojoProxyResolverImpl::SetPacScriptRequest::SetPacScriptRequest( |