summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_service.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-01 23:39:16 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-01 23:39:16 +0000
commit8412bbc1508c1966e66ae02ee70bdaf9329951de (patch)
tree00662dff907cc2899a64378da40380bb98e82fb2 /net/proxy/proxy_service.cc
parent04ec2cc698190721f2afe33325873e348d4882af (diff)
downloadchromium_src-8412bbc1508c1966e66ae02ee70bdaf9329951de.zip
chromium_src-8412bbc1508c1966e66ae02ee70bdaf9329951de.tar.gz
chromium_src-8412bbc1508c1966e66ae02ee70bdaf9329951de.tar.bz2
Add a new event to LoadLog:
PROXY_SERVICE_POLL_CONFIG_SERVICE_FOR_CHANGES which measures how much time was spent per request retrieving the system proxy settings. On Windows this corresponds with the function: WinHttpGetIEProxyConfigForCurrentUser(). Which seems to be very slow on some systems. BUG=12189 Review URL: http://codereview.chromium.org/452034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.cc')
-rw-r--r--net/proxy/proxy_service.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 92870fe..dc97d47 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -278,7 +278,7 @@ int ProxyService::ResolveProxy(const GURL& raw_url,
// Check if the request can be completed right away. This is the case when
// using a direct connection, or when the config is bad.
- UpdateConfigIfOld();
+ UpdateConfigIfOld(load_log);
int rv = TryToCompleteSynchronously(url, result);
if (rv != ERR_IO_PENDING) {
LoadLog::EndEvent(load_log, LoadLog::TYPE_PROXY_SERVICE);
@@ -450,7 +450,7 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url,
bool re_resolve = result->config_id_ != config_.id();
if (!re_resolve) {
- UpdateConfig();
+ UpdateConfig(load_log);
if (result->config_id_ != config_.id()) {
// A new configuration!
re_resolve = true;
@@ -535,7 +535,7 @@ ProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const {
void ProxyService::ResetConfigService(
ProxyConfigService* new_proxy_config_service) {
config_service_.reset(new_proxy_config_service);
- UpdateConfig();
+ UpdateConfig(NULL);
}
void ProxyService::PurgeMemory() {
@@ -602,11 +602,19 @@ ProxyResolver* ProxyService::CreateNonV8ProxyResolver() {
#endif
}
-void ProxyService::UpdateConfig() {
+void ProxyService::UpdateConfig(LoadLog* load_log) {
bool is_first_update = !config_has_been_initialized();
ProxyConfig latest;
- if (config_service_->GetProxyConfig(&latest) != OK) {
+
+ // Fetch the proxy settings.
+ LoadLog::BeginEvent(load_log,
+ LoadLog::TYPE_PROXY_SERVICE_POLL_CONFIG_SERVICE_FOR_CHANGES);
+ int rv = config_service_->GetProxyConfig(&latest);
+ LoadLog::EndEvent(load_log,
+ LoadLog::TYPE_PROXY_SERVICE_POLL_CONFIG_SERVICE_FOR_CHANGES);
+
+ if (rv != OK) {
if (is_first_update) {
// Default to direct-connection if the first fetch fails.
LOG(INFO) << "Failed initial proxy configuration fetch.";
@@ -665,14 +673,14 @@ void ProxyService::StartInitProxyResolver() {
OnInitProxyResolverComplete(rv);
}
-void ProxyService::UpdateConfigIfOld() {
+void ProxyService::UpdateConfigIfOld(LoadLog* load_log) {
// The overhead of calling ProxyConfigService::GetProxyConfig is very low.
const TimeDelta kProxyConfigMaxAge = TimeDelta::FromSeconds(5);
// Periodically check for a new config.
if (!config_has_been_initialized() ||
(TimeTicks::Now() - config_last_update_time_) > kProxyConfigMaxAge)
- UpdateConfig();
+ UpdateConfig(load_log);
}
bool ProxyService::ShouldBypassProxyForURL(const GURL& url) {