summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_service.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 23:02:18 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 23:02:18 +0000
commit18547425e7a2ccb072f0788ec0d69e3dc8c47b72 (patch)
treee98793afdef50df8c3eb8b79efd2b5ec44e98a18 /net/proxy/proxy_service.cc
parentf9f54129c04affdbdc83804333b8625e11987559 (diff)
downloadchromium_src-18547425e7a2ccb072f0788ec0d69e3dc8c47b72.zip
chromium_src-18547425e7a2ccb072f0788ec0d69e3dc8c47b72.tar.gz
chromium_src-18547425e7a2ccb072f0788ec0d69e3dc8c47b72.tar.bz2
Log the results of proxy resolution to LoadLog when "full logging mode" is enabled.
Examples of what the logged text looks like: "Resolved proxy list: PROXY foobar:6233" "Resolved proxy list: DIRECT" "Resolved proxy list: PROXY foobar:80;SOCKS5 baz:1080;DIRECT" Review URL: http://codereview.chromium.org/518042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.cc')
-rw-r--r--net/proxy/proxy_service.cc37
1 files changed, 26 insertions, 11 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 9ac6fcd..01a42ac 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -158,13 +158,7 @@ class ProxyService::PacRequest
resolve_job_ = NULL;
config_id_ = ProxyConfig::INVALID_ID;
- // Clean up the results list.
- if (result_code == OK)
- results_->RemoveBadProxies(service_->proxy_retry_info_);
-
- LoadLog::EndEvent(load_log_, LoadLog::TYPE_PROXY_SERVICE);
-
- return result_code;
+ return service_->DidFinishResolvingProxy(results_, result_code, load_log_);
}
LoadLog* load_log() const { return load_log_; }
@@ -277,10 +271,8 @@ int ProxyService::ResolveProxy(const GURL& raw_url,
// using a direct connection, or when the config is bad.
UpdateConfigIfOld(load_log);
int rv = TryToCompleteSynchronously(url, result);
- if (rv != ERR_IO_PENDING) {
- LoadLog::EndEvent(load_log, LoadLog::TYPE_PROXY_SERVICE);
- return rv;
- }
+ if (rv != ERR_IO_PENDING)
+ return DidFinishResolvingProxy(result, rv, load_log);
scoped_refptr<PacRequest> req =
new PacRequest(this, url, result, callback, load_log);
@@ -477,6 +469,29 @@ void ProxyService::RemovePendingRequest(PacRequest* req) {
pending_requests_.erase(it);
}
+int ProxyService::DidFinishResolvingProxy(ProxyInfo* result,
+ int result_code,
+ LoadLog* load_log) {
+ // Log the result of the proxy resolution.
+ if (result_code == OK) {
+ // When full logging is enabled, dump the proxy list.
+ if (LoadLog::IsUnbounded(load_log)) {
+ LoadLog::AddString(
+ load_log,
+ std::string("Resolved proxy list: ") + result->ToPacString());
+ }
+ } else {
+ LoadLog::AddErrorCode(load_log, result_code);
+ }
+
+ // Clean up the results list.
+ if (result_code == OK)
+ result->RemoveBadProxies(proxy_retry_info_);
+
+ LoadLog::EndEvent(load_log, LoadLog::TYPE_PROXY_SERVICE);
+ return result_code;
+}
+
void ProxyService::SetProxyScriptFetcher(
ProxyScriptFetcher* proxy_script_fetcher) {
if (init_proxy_resolver_.get()) {