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

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: 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
Index: net/proxy/proxy_service.h
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index 41eabb33c2160148519d8de4a2949b8e50906f38..5f70062cd96ae3842b39ee9316862d739d7ab946 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 currently
+ // active policy.
wtc 2012/01/03 23:54:45 Nit: currently active => previously active ?
eroman 2012/01/04 03:41:47 Done.
+ 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;
@@ -347,6 +366,7 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// Note that the declaration is important here: |proxy_script_fetcher_| and
// |proxy_resolver_| must outlive |init_proxy_resolver_|.
scoped_ptr<InitProxyResolver> init_proxy_resolver_;
+ scoped_ptr<ProxyScriptDeciderPoller> script_poller_;
wtc 2012/01/03 23:54:45 Nit: should we document this member?
eroman 2012/01/04 03:41:47 Done.
State current_state_;

Powered by Google App Engine
This is Rietveld 408576698