| Index: net/proxy/proxy_service.cc
|
| diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
|
| index 66bf929005ea982dc18d44460a7c21122c7eb96d..643b9be9370e2c18a7f7ece32a24d2fc09c87972 100644
|
| --- a/net/proxy/proxy_service.cc
|
| +++ b/net/proxy/proxy_service.cc
|
| @@ -264,6 +264,31 @@ class ProxyConfigChangedNetLogParam : public NetLog::EventParameters {
|
| DISALLOW_COPY_AND_ASSIGN(ProxyConfigChangedNetLogParam);
|
| };
|
|
|
| +class BadProxyListNetLogParam : public NetLog::EventParameters {
|
| + public:
|
| + BadProxyListNetLogParam(const ProxyRetryInfoMap& retry_info) {
|
| + proxy_list_.reserve(retry_info.size());
|
| + for (ProxyRetryInfoMap::const_iterator iter = retry_info.begin();
|
| + iter != retry_info.end(); ++iter) {
|
| + proxy_list_.push_back(iter->first);
|
| + }
|
| + }
|
| +
|
| + virtual Value* ToValue() const OVERRIDE {
|
| + DictionaryValue* dict = new DictionaryValue();
|
| + ListValue* list = new ListValue();
|
| + for (std::vector<std::string>::const_iterator iter = proxy_list_.begin();
|
| + iter != proxy_list_.end(); ++iter)
|
| + list->Append(Value::CreateStringValue(*iter));
|
| + dict->Set("bad_proxy_list", list);
|
| + return dict;
|
| + }
|
| +
|
| + private:
|
| + std::vector<std::string> proxy_list_;
|
| + DISALLOW_COPY_AND_ASSIGN(BadProxyListNetLogParam);
|
| +};
|
| +
|
| } // namespace
|
|
|
| // ProxyService::PacRequest ---------------------------------------------------
|
| @@ -715,13 +740,38 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url,
|
|
|
| // We don't have new proxy settings to try, try to fallback to the next proxy
|
| // in the list.
|
| - bool did_fallback = result->Fallback(&proxy_retry_info_);
|
| + bool did_fallback = result->Fallback(net_log);
|
|
|
| // Return synchronous failure if there is nothing left to fall-back to.
|
| // TODO(eroman): This is a yucky API, clean it up.
|
| return did_fallback ? OK : ERR_FAILED;
|
| }
|
|
|
| +void ProxyService::ReportSuccess(const ProxyInfo& result) {
|
| + DCHECK(CalledOnValidThread());
|
| +
|
| + const ProxyRetryInfoMap& new_retry_info = result.proxy_retry_info();
|
| + if (new_retry_info.empty())
|
| + return;
|
| +
|
| + for (ProxyRetryInfoMap::const_iterator iter = new_retry_info.begin();
|
| + iter != new_retry_info.end(); ++iter) {
|
| + ProxyRetryInfoMap::iterator existing = proxy_retry_info_.find(iter->first);
|
| + if (existing == proxy_retry_info_.end())
|
| + proxy_retry_info_[iter->first] = iter->second;
|
| + else if (existing->second.bad_until < iter->second.bad_until)
|
| + existing->second.bad_until = iter->second.bad_until;
|
| + }
|
| + if (net_log_) {
|
| + net_log_->AddEntry(NetLog::TYPE_BAD_PROXY_LIST_REPORTED,
|
| + base::TimeTicks::Now(),
|
| + NetLog::Source(),
|
| + NetLog::PHASE_NONE,
|
| + make_scoped_refptr(
|
| + new BadProxyListNetLogParam(new_retry_info)));
|
| + }
|
| +}
|
| +
|
| void ProxyService::CancelPacRequest(PacRequest* req) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(req);
|
|
|