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

Unified Diff: net/proxy/init_proxy_resolver.cc

Issue 1716007: Cleanup: Address some of the todos in net_log.h... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address willchan's comments Created 10 years, 8 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
« no previous file with comments | « net/base/net_log_util_unittest.cc ('k') | net/proxy/init_proxy_resolver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/init_proxy_resolver.cc
===================================================================
--- net/proxy/init_proxy_resolver.cc (revision 45472)
+++ net/proxy/init_proxy_resolver.cc (working copy)
@@ -122,17 +122,15 @@
int InitProxyResolver::DoFetchPacScript() {
DCHECK(resolver_->expects_pac_bytes());
- net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT);
-
next_state_ = STATE_FETCH_PAC_SCRIPT_COMPLETE;
const GURL& pac_url = current_pac_url();
- net_log_.AddString(pac_url.spec());
+ net_log_.BeginEventWithString(
+ NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, "url", pac_url.spec());
if (!proxy_script_fetcher_) {
- net_log_.AddStringLiteral(
- "Can't download PAC script, because no fetcher was specified");
+ net_log_.AddEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_HAS_NO_FETCHER);
return ERR_UNEXPECTED;
}
@@ -142,15 +140,14 @@
int InitProxyResolver::DoFetchPacScriptComplete(int result) {
DCHECK(resolver_->expects_pac_bytes());
- net_log_.AddString(StringPrintf(
- "Completed fetch with result %s. Received %" PRIuS " bytes",
- ErrorToString(result),
- pac_bytes_.size()));
-
- net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT);
-
- if (result != OK)
+ if (result == OK) {
+ net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT);
+ } else {
+ net_log_.EndEventWithInteger(
+ NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
+ "net_error", result);
return TryToFallbackPacUrl(result);
+ }
next_state_ = STATE_SET_PAC_SCRIPT;
return result;
@@ -170,15 +167,12 @@
int InitProxyResolver::DoSetPacScriptComplete(int result) {
if (result != OK) {
- net_log_.AddString(
- StringPrintf("Failed initializing the PAC script with error: %s",
- ErrorToString(result)));
- net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT);
+ net_log_.EndEventWithInteger(
+ NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
+ "net_error", result);
return TryToFallbackPacUrl(result);
}
- net_log_.AddStringLiteral("Successfully initialized PAC script.");
-
net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT);
return result;
}
@@ -194,7 +188,8 @@
// Advance to next URL in our list.
++current_pac_url_index_;
- net_log_.AddStringLiteral("Falling back to next PAC URL...");
+ net_log_.AddEvent(
+ NetLog::TYPE_INIT_PROXY_RESOLVER_FALLING_BACK_TO_NEXT_PAC_URL);
next_state_ = GetStartState();
« no previous file with comments | « net/base/net_log_util_unittest.cc ('k') | net/proxy/init_proxy_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698