| Index: net/proxy/proxy_service.cc
|
| ===================================================================
|
| --- net/proxy/proxy_service.cc (revision 141995)
|
| +++ net/proxy/proxy_service.cc (working copy)
|
| @@ -333,62 +333,40 @@
|
| }
|
| };
|
|
|
| -// NetLog parameter to describe a proxy configuration change.
|
| -class ProxyConfigChangedNetLogParam : public NetLog::EventParameters {
|
| - public:
|
| - ProxyConfigChangedNetLogParam(const ProxyConfig& old_config,
|
| - const ProxyConfig& new_config)
|
| - : old_config_(old_config),
|
| - new_config_(new_config) {
|
| - }
|
| +// Returns NetLog parameters describing a proxy configuration change.
|
| +Value* NetLogProxyConfigChangedCallback(const ProxyConfig* old_config,
|
| + const ProxyConfig* new_config,
|
| + NetLog::LogLevel /* log_level */) {
|
| + DictionaryValue* dict = new DictionaryValue();
|
| + // The "old_config" is optional -- the first notification will not have
|
| + // any "previous" configuration.
|
| + if (old_config->is_valid())
|
| + dict->Set("old_config", old_config->ToValue());
|
| + dict->Set("new_config", new_config->ToValue());
|
| + return dict;
|
| +}
|
|
|
| - virtual Value* ToValue() const OVERRIDE {
|
| - DictionaryValue* dict = new DictionaryValue();
|
| - // The "old_config" is optional -- the first notification will not have
|
| - // any "previous" configuration.
|
| - if (old_config_.is_valid())
|
| - dict->Set("old_config", old_config_.ToValue());
|
| - dict->Set("new_config", new_config_.ToValue());
|
| - return dict;
|
| - }
|
| +Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info,
|
| + NetLog::LogLevel /* log_level */) {
|
| + DictionaryValue* dict = new DictionaryValue();
|
| + ListValue* list = new ListValue();
|
|
|
| - protected:
|
| - virtual ~ProxyConfigChangedNetLogParam() {}
|
| -
|
| - private:
|
| - const ProxyConfig old_config_;
|
| - const ProxyConfig new_config_;
|
| - 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);
|
| - }
|
| + for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin();
|
| + iter != retry_info->end(); ++iter) {
|
| + list->Append(Value::CreateStringValue(iter->first));
|
| }
|
| + dict->Set("bad_proxy_list", list);
|
| + return dict;
|
| +}
|
|
|
| - 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;
|
| - }
|
| +// Returns NetLog parameters on a successfuly proxy resolution.
|
| +Value* NetLogFinishedResolvingProxyCallback(ProxyInfo* result,
|
| + NetLog::LogLevel /* log_level */) {
|
| + DictionaryValue* dict = new DictionaryValue();
|
| + dict->SetString("pac_string", result->ToPacString());
|
| + return dict;
|
| +}
|
|
|
| - protected:
|
| - virtual ~BadProxyListNetLogParam() {}
|
| -
|
| - private:
|
| - std::vector<std::string> proxy_list_;
|
| - DISALLOW_COPY_AND_ASSIGN(BadProxyListNetLogParam);
|
| -};
|
| -
|
| #if defined(OS_CHROMEOS)
|
| class UnsetProxyConfigService : public ProxyConfigService {
|
| public:
|
| @@ -846,7 +824,7 @@
|
| }
|
|
|
| void Cancel() {
|
| - net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL);
|
| + net_log_.AddEvent(NetLog::TYPE_CANCELLED);
|
|
|
| if (is_started())
|
| CancelResolveJob();
|
| @@ -856,7 +834,7 @@
|
| user_callback_.Reset();
|
| results_ = NULL;
|
|
|
| - net_log_.EndEvent(NetLog::TYPE_PROXY_SERVICE, NULL);
|
| + net_log_.EndEvent(NetLog::TYPE_PROXY_SERVICE);
|
| }
|
|
|
| // Returns true if Cancel() has been called.
|
| @@ -1059,7 +1037,7 @@
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(!callback.is_null());
|
|
|
| - net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE, NULL);
|
| + net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE);
|
|
|
| // Notify our polling-based dependencies that a resolve is taking place.
|
| // This way they can schedule their polls in response to network activity.
|
| @@ -1089,8 +1067,7 @@
|
| if (rv != ERR_IO_PENDING)
|
| return req->QueryDidComplete(rv);
|
| } else {
|
| - req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC,
|
| - NULL);
|
| + req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC);
|
| }
|
|
|
| DCHECK_EQ(ERR_IO_PENDING, rv);
|
| @@ -1149,7 +1126,7 @@
|
| req->CancelResolveJob();
|
|
|
| req->net_log()->BeginEvent(
|
| - NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC, NULL);
|
| + NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC);
|
| }
|
| }
|
| }
|
| @@ -1168,8 +1145,7 @@
|
| ++it) {
|
| PacRequest* req = it->get();
|
| if (!req->is_started() && !req->was_cancelled()) {
|
| - req->net_log()->EndEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC,
|
| - NULL);
|
| + req->net_log()->EndEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC);
|
|
|
| // Note that we re-check for synchronous completion, in case we are
|
| // no longer using a ProxyResolver (can happen if we fell-back to manual).
|
| @@ -1299,8 +1275,7 @@
|
| if (net_log_) {
|
| net_log_->AddGlobalEntry(
|
| NetLog::TYPE_BAD_PROXY_LIST_REPORTED,
|
| - make_scoped_refptr(
|
| - new BadProxyListNetLogParam(new_retry_info)));
|
| + base::Bind(&NetLogBadProxyListCallback, &new_retry_info));
|
| }
|
| }
|
|
|
| @@ -1338,15 +1313,12 @@
|
| if (net_log.IsLoggingAllEvents()) {
|
| net_log.AddEvent(
|
| NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST,
|
| - make_scoped_refptr(new NetLogStringParameter(
|
| - "pac_string", result->ToPacString())));
|
| + base::Bind(&NetLogFinishedResolvingProxyCallback, result));
|
| }
|
| result->DeprioritizeBadProxies(proxy_retry_info_);
|
| } else {
|
| - net_log.AddEvent(
|
| - NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST,
|
| - make_scoped_refptr(new NetLogIntegerParameter(
|
| - "net_error", result_code)));
|
| + net_log.AddEventWithNetErrorCode(
|
| + NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code);
|
|
|
| if (!config_.pac_mandatory()) {
|
| // Fall-back to direct when the proxy resolver fails. This corresponds
|
| @@ -1363,7 +1335,7 @@
|
| }
|
| }
|
|
|
| - net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE, NULL);
|
| + net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE);
|
| return result_code;
|
| }
|
|
|
| @@ -1509,10 +1481,10 @@
|
|
|
| // Emit the proxy settings change to the NetLog stream.
|
| if (net_log_) {
|
| - scoped_refptr<NetLog::EventParameters> params(
|
| - new ProxyConfigChangedNetLogParam(fetched_config_, effective_config));
|
| - net_log_->AddGlobalEntry(net::NetLog::TYPE_PROXY_CONFIG_CHANGED,
|
| - params);
|
| + net_log_->AddGlobalEntry(
|
| + net::NetLog::TYPE_PROXY_CONFIG_CHANGED,
|
| + base::Bind(&NetLogProxyConfigChangedCallback,
|
| + &fetched_config_, &effective_config));
|
| }
|
|
|
| // Set the new configuration as the most recently fetched one.
|
|
|