summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_script_decider.cc
diff options
context:
space:
mode:
authorellyjones@chromium.org <ellyjones@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 21:57:17 +0000
committerellyjones@chromium.org <ellyjones@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 21:57:17 +0000
commit67378145a8849a75f3f7d8e5a248e4dc309c327f (patch)
tree420d33156d60eadf0ae4006199dc57a64739f00d /net/proxy/proxy_script_decider.cc
parent348529eb31ab09a3b70b0223b53b593f2bddf810 (diff)
downloadchromium_src-67378145a8849a75f3f7d8e5a248e4dc309c327f.zip
chromium_src-67378145a8849a75f3f7d8e5a248e4dc309c327f.tar.gz
chromium_src-67378145a8849a75f3f7d8e5a248e4dc309c327f.tar.bz2
Add a preference (proxy.quick_check_enabled, default true) to control QuickCheck.
Add a quick_check_enabled_ property to ProxyScriptDecider, InitProxyResolver, ProxyScriptDeciderPoller and ProxyService. Set the property as appropriate in ProxyServiceFactory. The main design wrinkle here is that we can't access the pref service directly in ProxyServiceFactory::CreateProxyService, since the pref service has to be accessed entirely on the UI thread. We could post a task onto the UI thread to fetch the necessary prefs for us, but that entails blocking the IO thread on the UI thread while we wait for the response. Instead, we fetch the necessary pref values at the call sites of CreateProxyService() (IOThread and ProfileIOData), both of which have UI thread initialization methods. TEST=trybot,unit BUG=320696 Review URL: https://codereview.chromium.org/114193004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241374 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_script_decider.cc')
-rw-r--r--net/proxy/proxy_script_decider.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/proxy/proxy_script_decider.cc b/net/proxy/proxy_script_decider.cc
index eab59ac..3e606a6 100644
--- a/net/proxy/proxy_script_decider.cc
+++ b/net/proxy/proxy_script_decider.cc
@@ -86,7 +86,8 @@ ProxyScriptDecider::ProxyScriptDecider(
next_state_(STATE_NONE),
net_log_(BoundNetLog::Make(
net_log, NetLog::SOURCE_PROXY_SCRIPT_DECIDER)),
- fetch_pac_bytes_(false) {
+ fetch_pac_bytes_(false),
+ quick_check_enabled_(true) {
if (proxy_script_fetcher &&
proxy_script_fetcher->GetRequestContext() &&
proxy_script_fetcher->GetRequestContext()->host_resolver()) {
@@ -240,7 +241,7 @@ int ProxyScriptDecider::DoWaitComplete(int result) {
net_log_.EndEventWithNetErrorCode(NetLog::TYPE_PROXY_SCRIPT_DECIDER_WAIT,
result);
}
- if (current_pac_source().type == PacSource::WPAD_DNS)
+ if (quick_check_enabled_ && current_pac_source().type == PacSource::WPAD_DNS)
next_state_ = STATE_QUICK_CHECK;
else
next_state_ = GetStartState();
@@ -248,6 +249,7 @@ int ProxyScriptDecider::DoWaitComplete(int result) {
}
int ProxyScriptDecider::DoQuickCheck() {
+ DCHECK(quick_check_enabled_);
if (host_resolver_.get() == NULL) {
// If we have no resolver, skip QuickCheck altogether.
next_state_ = GetStartState();
@@ -274,6 +276,7 @@ int ProxyScriptDecider::DoQuickCheck() {
}
int ProxyScriptDecider::DoQuickCheckComplete(int result) {
+ DCHECK(quick_check_enabled_);
base::TimeDelta delta = base::Time::Now() - quick_check_start_time_;
if (result == OK)
UMA_HISTOGRAM_TIMES("Net.WpadQuickCheckSuccess", delta);
@@ -409,7 +412,7 @@ int ProxyScriptDecider::TryToFallbackPacSource(int error) {
net_log_.AddEvent(
NetLog::TYPE_PROXY_SCRIPT_DECIDER_FALLING_BACK_TO_NEXT_PAC_SOURCE);
- if (current_pac_source().type == PacSource::WPAD_DNS)
+ if (quick_check_enabled_ && current_pac_source().type == PacSource::WPAD_DNS)
next_state_ = STATE_QUICK_CHECK;
else
next_state_ = GetStartState();