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

Unified Diff: net/proxy/proxy_service.h

Issue 9078003: Poll PAC scripts for content changes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix dcheck reached on bot Created 8 years, 12 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/proxy/proxy_resolver_script_data.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_service.h
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index 41eabb33c2160148519d8de4a2949b8e50906f38..8e9d50b473661dbb48176ce568cfb38d36171abd 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -32,6 +32,7 @@ class DhcpProxyScriptFetcher;
class HostResolver;
class NetworkDelegate;
class ProxyResolver;
+class ProxyResolverScriptData;
class ProxyScriptDecider;
class ProxyScriptFetcher;
@@ -42,6 +43,13 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
public ProxyConfigService::Observer,
NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
+ // Only used by unit-tests.
+ enum PollPolicy {
+ POLL_POLICY_REGULAR, // Normal PAC poll policy (retry periodically).
+ POLL_POLICY_NEVER, // Don't re-fetch PAC scripts for changes.
+ POLL_POLICY_IMMEDIATE, // Check every 1 ms.
+ };
+
// The instance takes ownership of |config_service| and |resolver|.
// |net_log| is a possibly NULL destination to send log events to. It must
// remain alive for the lifetime of this ProxyService.
@@ -236,11 +244,16 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
stall_proxy_auto_config_delay_ = delay;
}
+ // This method should only be used by unit tests. Returns the previously
+ // active policy.
+ static PollPolicy set_pac_script_poll_policy(PollPolicy policy);
+
private:
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect);
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect);
friend class PacRequest;
class InitProxyResolver;
+ class ProxyScriptDeciderPoller;
// TODO(eroman): change this to a std::set. Note that this requires updating
// some tests in proxy_service_unittest.cc such as:
@@ -300,6 +313,12 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// Start initialization using |fetched_config_|.
void InitializeUsingLastFetchedConfig();
+ // Start the initialization skipping past the "decision" phase.
+ void InitializeUsingDecidedConfig(
+ int decider_result,
+ ProxyResolverScriptData* script_data,
+ const ProxyConfig& effective_config);
+
// NetworkChangeNotifier::IPAddressObserver
// When this is called, we re-fetch PAC scripts and re-run WPAD.
virtual void OnIPAddressChanged() OVERRIDE;
@@ -348,6 +367,9 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// |proxy_resolver_| must outlive |init_proxy_resolver_|.
scoped_ptr<InitProxyResolver> init_proxy_resolver_;
+ // Helper to poll the PAC script for changes.
+ scoped_ptr<ProxyScriptDeciderPoller> script_poller_;
+
State current_state_;
// Either OK or an ERR_* value indicating that a permanent error (e.g.
« no previous file with comments | « net/proxy/proxy_resolver_script_data.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698