Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Unified Diff: net/proxy/proxy_script_decider.cc

Issue 10534132: NetLogEventParameter to Callback refactoring 7. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Update unit test Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/proxy/proxy_script_decider.cc
===================================================================
--- net/proxy/proxy_script_decider.cc (revision 141814)
+++ net/proxy/proxy_script_decider.cc (working copy)
@@ -72,7 +72,7 @@
DCHECK(!callback.is_null());
DCHECK(config.HasAutomaticSettings());
- net_log_.BeginEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER, NULL);
+ net_log_.BeginEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER);
fetch_pac_bytes_ = fetch_pac_bytes;
@@ -187,7 +187,7 @@
// Otherwise wait the specified amount of time.
wait_timer_.Start(FROM_HERE, wait_delay_, this,
&ProxyScriptDecider::OnWaitTimerFired);
- net_log_.BeginEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER_WAIT, NULL);
+ net_log_.BeginEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER_WAIT);
return ERR_IO_PENDING;
}
@@ -209,16 +209,17 @@
const PacSource& pac_source = current_pac_source();
GURL effective_pac_url;
- NetLogStringParameter* log_parameter =
- CreateNetLogParameterAndDetermineURL(pac_source, &effective_pac_url);
+ std::string source_string;
+ CreateSourceStringAndDetermineURL(pac_source, &effective_pac_url,
eroman 2012/06/13 18:55:33 Can this string construction be internalized into
mmenke 2012/06/13 20:27:58 Done. This does add a little ugliness (Have to du
+ &source_string);
net_log_.BeginEvent(
NetLog::TYPE_PROXY_SCRIPT_DECIDER_FETCH_PAC_SCRIPT,
- make_scoped_refptr(log_parameter));
+ NetLog::StringCallback("source", &source_string));
if (pac_source.type == PacSource::WPAD_DHCP) {
if (!dhcp_proxy_script_fetcher_) {
- net_log_.AddEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER_HAS_NO_FETCHER, NULL);
+ net_log_.AddEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER_HAS_NO_FETCHER);
return ERR_UNEXPECTED;
}
@@ -228,7 +229,7 @@
}
if (!proxy_script_fetcher_) {
- net_log_.AddEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER_HAS_NO_FETCHER, NULL);
+ net_log_.AddEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER_HAS_NO_FETCHER);
return ERR_UNEXPECTED;
}
@@ -322,7 +323,7 @@
++current_pac_source_index_;
net_log_.AddEvent(
- NetLog::TYPE_PROXY_SCRIPT_DECIDER_FALLING_BACK_TO_NEXT_PAC_SOURCE, NULL);
+ NetLog::TYPE_PROXY_SCRIPT_DECIDER_FALLING_BACK_TO_NEXT_PAC_SOURCE);
next_state_ = GetStartState();
@@ -333,28 +334,28 @@
return fetch_pac_bytes_ ? STATE_FETCH_PAC_SCRIPT : STATE_VERIFY_PAC_SCRIPT;
}
-NetLogStringParameter* ProxyScriptDecider::CreateNetLogParameterAndDetermineURL(
+void ProxyScriptDecider::CreateSourceStringAndDetermineURL(
const PacSource& pac_source,
- GURL* effective_pac_url) {
+ GURL* effective_pac_url,
+ std::string* source_string) {
DCHECK(effective_pac_url);
std::string source_field;
switch (pac_source.type) {
case PacSource::WPAD_DHCP:
- source_field = "WPAD DHCP";
+ *source_string = "WPAD DHCP";
break;
case PacSource::WPAD_DNS:
*effective_pac_url = GURL(kWpadUrl);
- source_field = "WPAD DNS: ";
- source_field += effective_pac_url->possibly_invalid_spec();
+ *source_string = "WPAD DNS: ";
+ *source_string += effective_pac_url->possibly_invalid_spec();
break;
case PacSource::CUSTOM:
*effective_pac_url = pac_source.url;
- source_field = "Custom PAC URL: ";
- source_field += effective_pac_url->possibly_invalid_spec();
+ *source_string = "Custom PAC URL: ";
+ *source_string += effective_pac_url->possibly_invalid_spec();
break;
}
- return new NetLogStringParameter("source", source_field);
}
const ProxyScriptDecider::PacSource&
@@ -368,13 +369,13 @@
}
void ProxyScriptDecider::DidComplete() {
- net_log_.EndEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER, NULL);
+ net_log_.EndEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER);
}
void ProxyScriptDecider::Cancel() {
DCHECK_NE(STATE_NONE, next_state_);
- net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL);
+ net_log_.AddEvent(NetLog::TYPE_CANCELLED);
switch (next_state_) {
case STATE_WAIT_COMPLETE:

Powered by Google App Engine
This is Rietveld 408576698