| Index: ios/chrome/browser/ios_chrome_io_thread.h
|
| diff --git a/chrome/browser/io_thread.h b/ios/chrome/browser/ios_chrome_io_thread.h
|
| similarity index 60%
|
| copy from chrome/browser/io_thread.h
|
| copy to ios/chrome/browser/ios_chrome_io_thread.h
|
| index 41c042fe8ac9fd2e3c84bae2927a22e1a268c699..3dfe1ea6f08936315940683a0c9352e0c081c60c 100644
|
| --- a/chrome/browser/io_thread.h
|
| +++ b/ios/chrome/browser/ios_chrome_io_thread.h
|
| @@ -1,9 +1,9 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_IO_THREAD_H_
|
| -#define CHROME_BROWSER_IO_THREAD_H_
|
| +#ifndef IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
|
| +#define IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
|
|
|
| #include <map>
|
| #include <set>
|
| @@ -18,42 +18,19 @@
|
| #include "base/prefs/pref_member.h"
|
| #include "base/strings/string_piece.h"
|
| #include "base/time/time.h"
|
| -#include "chrome/browser/net/chrome_network_delegate.h"
|
| #include "components/ssl_config/ssl_config_service_manager.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| -#include "content/public/browser/browser_thread_delegate.h"
|
| +#include "ios/web/public/web_thread_delegate.h"
|
| #include "net/base/network_change_notifier.h"
|
| #include "net/http/http_network_session.h"
|
| #include "net/socket/next_proto.h"
|
|
|
| class PrefProxyConfigTracker;
|
| class PrefService;
|
| -class PrefRegistrySimple;
|
| class SystemURLRequestContextGetter;
|
|
|
| namespace base {
|
| class CommandLine;
|
| -}
|
| -
|
| -#if defined(OS_ANDROID)
|
| -namespace chrome {
|
| -namespace android {
|
| -class ExternalDataUseObserver;
|
| -}
|
| -}
|
| -#endif // defined(OS_ANDROID)
|
| -
|
| -namespace chrome_browser_net {
|
| -class DnsProbeService;
|
| -}
|
| -
|
| -namespace data_usage {
|
| -class DataUseAggregator;
|
| -}
|
| -
|
| -namespace extensions {
|
| -class EventRouterForwarder;
|
| -}
|
| +} // namespace base
|
|
|
| namespace net {
|
| class CertPolicyEnforcer;
|
| @@ -61,8 +38,6 @@ class CertVerifier;
|
| class ChannelIDService;
|
| class CookieStore;
|
| class CTVerifier;
|
| -class FtpTransactionFactory;
|
| -class HostMappingRules;
|
| class HostResolver;
|
| class HttpAuthHandlerFactory;
|
| class HttpNetworkSession;
|
| @@ -84,23 +59,14 @@ class URLSecurityManager;
|
|
|
| namespace net_log {
|
| class ChromeNetLog;
|
| -}
|
| -
|
| -namespace policy {
|
| -class PolicyService;
|
| -} // namespace policy
|
| -
|
| -namespace test {
|
| -class IOThreadPeer;
|
| -} // namespace test
|
| +} // namespace net_log
|
|
|
| // Contains state associated with, initialized and cleaned up on, and
|
| // primarily used on, the IO thread.
|
| //
|
| // If you are looking to interact with the IO thread (e.g. post tasks
|
| -// to it or check if it is the current thread), see
|
| -// content::BrowserThread.
|
| -class IOThread : public content::BrowserThreadDelegate {
|
| +// to it or check if it is the current thread), see web::WebThread.
|
| +class IOSChromeIOThread : public web::WebThreadDelegate {
|
| public:
|
| struct Globals {
|
| template <typename T>
|
| @@ -135,15 +101,8 @@ class IOThread : public content::BrowserThreadDelegate {
|
| Globals();
|
| ~Globals();
|
|
|
| - // Global aggregator of data use. It must outlive the
|
| - // |system_network_delegate|.
|
| - scoped_ptr<data_usage::DataUseAggregator> data_use_aggregator;
|
| -#if defined(OS_ANDROID)
|
| - // An external observer of data use.
|
| - scoped_ptr<chrome::android::ExternalDataUseObserver>
|
| - external_data_use_observer;
|
| -#endif // defined(OS_ANDROID)
|
| - // The "system" NetworkDelegate, used for Profile-agnostic network events.
|
| + // The "system" NetworkDelegate, used for BrowserState-agnostic network
|
| + // events.
|
| scoped_ptr<net::NetworkDelegate> system_network_delegate;
|
| scoped_ptr<net::HostResolver> host_resolver;
|
| scoped_ptr<net::CertVerifier> cert_verifier;
|
| @@ -158,41 +117,17 @@ class IOThread : public content::BrowserThreadDelegate {
|
| scoped_refptr<net::SSLConfigService> ssl_config_service;
|
| scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory;
|
| scoped_ptr<net::HttpServerProperties> http_server_properties;
|
| - scoped_ptr<net::ProxyService> proxy_script_fetcher_proxy_service;
|
| - scoped_ptr<net::HttpNetworkSession>
|
| - proxy_script_fetcher_http_network_session;
|
| - scoped_ptr<net::HttpTransactionFactory>
|
| - proxy_script_fetcher_http_transaction_factory;
|
| - scoped_ptr<net::FtpTransactionFactory>
|
| - proxy_script_fetcher_ftp_transaction_factory;
|
| - scoped_ptr<net::URLRequestJobFactory>
|
| - proxy_script_fetcher_url_request_job_factory;
|
| scoped_ptr<net::URLRequestBackoffManager> url_request_backoff_manager;
|
| scoped_ptr<net::URLSecurityManager> url_security_manager;
|
| - // TODO(willchan): Remove proxy script fetcher context since it's not
|
| - // necessary now that I got rid of refcounting URLRequestContexts.
|
| - //
|
| - // The first URLRequestContext is |system_url_request_context|. We introduce
|
| - // |proxy_script_fetcher_context| for the second context. It has a direct
|
| - // ProxyService, since we always directly connect to fetch the PAC script.
|
| - scoped_ptr<net::URLRequestContext> proxy_script_fetcher_context;
|
| scoped_ptr<net::ProxyService> system_proxy_service;
|
| scoped_ptr<net::HttpNetworkSession> system_http_network_session;
|
| scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory;
|
| scoped_ptr<net::URLRequestJobFactory> system_url_request_job_factory;
|
| scoped_ptr<net::URLRequestContext> system_request_context;
|
| SystemRequestContextLeakChecker system_request_context_leak_checker;
|
| - // |system_cookie_store| and |system_channel_id_service| are shared
|
| - // between |proxy_script_fetcher_context| and |system_request_context|.
|
| scoped_refptr<net::CookieStore> system_cookie_store;
|
| -#if defined(ENABLE_EXTENSIONS)
|
| - scoped_refptr<extensions::EventRouterForwarder>
|
| - extension_event_router_forwarder;
|
| -#endif
|
| - scoped_ptr<net::HostMappingRules> host_mapping_rules;
|
| scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings;
|
| scoped_ptr<net::NetworkQualityEstimator> network_quality_estimator;
|
| - bool ignore_certificate_errors;
|
| uint16 testing_fixed_http_port;
|
| uint16 testing_fixed_https_port;
|
| Optional<bool> enable_tcp_fast_open_for_ssl;
|
| @@ -200,9 +135,7 @@ class IOThread : public content::BrowserThreadDelegate {
|
| Optional<size_t> initial_max_spdy_concurrent_streams;
|
| Optional<bool> enable_spdy_compression;
|
| Optional<bool> enable_spdy_ping_based_connection_checking;
|
| - Optional<net::NextProto> spdy_default_protocol;
|
| net::NextProtoVector next_protos;
|
| - Optional<std::string> trusted_spdy_proxy;
|
| std::set<net::HostPortPair> forced_spdy_exclusions;
|
| Optional<bool> use_alternative_services;
|
| Optional<double> alternative_service_probability_threshold;
|
| @@ -211,7 +144,6 @@ class IOThread : public content::BrowserThreadDelegate {
|
|
|
| Optional<bool> enable_quic;
|
| Optional<bool> enable_quic_for_proxies;
|
| - Optional<bool> enable_quic_port_selection;
|
| Optional<bool> quic_always_require_handshake_confirmation;
|
| Optional<bool> quic_disable_connection_pooling;
|
| Optional<float> quic_load_server_info_timeout_srtt_multiplier;
|
| @@ -227,31 +159,20 @@ class IOThread : public content::BrowserThreadDelegate {
|
| net::QuicTagVector quic_connection_options;
|
| Optional<std::string> quic_user_agent_id;
|
| Optional<net::QuicVersionVector> quic_supported_versions;
|
| - Optional<net::HostPortPair> origin_to_force_quic_on;
|
| Optional<bool> quic_close_sessions_on_ip_change;
|
| - bool enable_user_alternate_protocol_ports;
|
| - // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a
|
| - // main frame load fails with a DNS error in order to provide more useful
|
| - // information to the renderer so it can show a more specific error page.
|
| - scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service;
|
| };
|
|
|
| - // |net_log| must either outlive the IOThread or be NULL.
|
| - IOThread(PrefService* local_state,
|
| - policy::PolicyService* policy_service,
|
| - net_log::ChromeNetLog* net_log,
|
| - extensions::EventRouterForwarder* extension_event_router_forwarder);
|
| + // |net_log| must either outlive the IOSChromeIOThread or be NULL.
|
| + IOSChromeIOThread(PrefService* local_state, net_log::ChromeNetLog* net_log);
|
|
|
| - ~IOThread() override;
|
| -
|
| - static void RegisterPrefs(PrefRegistrySimple* registry);
|
| + ~IOSChromeIOThread() override;
|
|
|
| // Can only be called on the IO thread.
|
| Globals* globals();
|
|
|
| - // Allows overriding Globals in tests where IOThread::Init() and
|
| - // IOThread::CleanUp() are not called. This allows for injecting mocks into
|
| - // IOThread global objects.
|
| + // Allows overriding Globals in tests where IOSChromeIOThread::Init() and
|
| + // IOSChromeIOThread::CleanUp() are not called. This allows for injecting
|
| + // mocks into IOSChromeIOThread global objects.
|
| void SetGlobalsForTesting(Globals* globals);
|
|
|
| net_log::ChromeNetLog* net_log();
|
| @@ -271,8 +192,8 @@ class IOThread : public content::BrowserThreadDelegate {
|
|
|
| base::TimeTicks creation_time() const;
|
|
|
| - // Returns true if QUIC should be enabled for data reduction proxy, either as
|
| - // a result of a field trial or a command line flag.
|
| + // Returns true if QUIC should be enabled for data reduction proxy as a result
|
| + // of a field trial.
|
| static bool ShouldEnableQuicForDataReductionProxy();
|
|
|
| private:
|
| @@ -283,12 +204,11 @@ class IOThread : public content::BrowserThreadDelegate {
|
| // InitSystemRequestContext().
|
| friend class SystemURLRequestContextGetter;
|
|
|
| - friend class test::IOThreadPeer;
|
| -
|
| - // BrowserThreadDelegate implementation, runs on the IO thread.
|
| + // WebThreadDelegate implementation, runs on the IO thread.
|
| // This handles initialization and destruction of state that must
|
| // live on the IO thread.
|
| void Init() override;
|
| + void InitAsync() override;
|
| void CleanUp() override;
|
|
|
| // Initializes |params| based on the settings in |globals|.
|
| @@ -296,16 +216,15 @@ class IOThread : public content::BrowserThreadDelegate {
|
| const Globals& globals,
|
| net::HttpNetworkSession::Params* params);
|
|
|
| - void InitializeNetworkOptions(const base::CommandLine& parsed_command_line);
|
| + void InitializeNetworkOptions();
|
|
|
| - // Sets up TCP FastOpen if enabled via field trials or via the command line.
|
| - void ConfigureTCPFastOpen(const base::CommandLine& command_line);
|
| + // Sets up SSL TCP FastOpen if enabled via field trials.
|
| + void ConfigureSSLTCPFastOpen();
|
|
|
| - // Configures available SPDY protocol versions in |globals| based on the flags
|
| - // in |command_lin| as well as SPDY field trial group and parameters. Must be
|
| - // called after ConfigureQuicGlobals.
|
| - static void ConfigureSpdyGlobals(const base::CommandLine& command_line,
|
| - base::StringPiece quic_trial_group,
|
| + // Configures available SPDY protocol versions in |globals| based on the SPDY
|
| + // field trial group and parameters.
|
| + // Must be called after ConfigureQuicGlobals.
|
| + static void ConfigureSpdyGlobals(base::StringPiece quic_trial_group,
|
| const VariationParameters& quic_trial_params,
|
| Globals* globals);
|
|
|
| @@ -331,49 +250,22 @@ class IOThread : public content::BrowserThreadDelegate {
|
|
|
| void ChangedToOnTheRecordOnIOThread();
|
|
|
| - void UpdateDnsClientEnabled();
|
| -
|
| - // Configures QUIC options based on the flags in |command_line| as
|
| - // well as the QUIC field trial group.
|
| - void ConfigureQuic(const base::CommandLine& command_line);
|
| + // Configures QUIC options based on the QUIC field trial group.
|
| + void ConfigureQuic();
|
|
|
| - extensions::EventRouterForwarder* extension_event_router_forwarder() {
|
| -#if defined(ENABLE_EXTENSIONS)
|
| - return extension_event_router_forwarder_;
|
| -#else
|
| - return NULL;
|
| -#endif
|
| - }
|
| // Configures QUIC options in |globals| based on the flags in |command_line|
|
| - // as well as the QUIC field trial group and parameters. Must be called
|
| - // before ConfigureSpdyGlobals.
|
| - static void ConfigureQuicGlobals(
|
| - const base::CommandLine& command_line,
|
| - base::StringPiece quic_trial_group,
|
| - const VariationParameters& quic_trial_params,
|
| - bool quic_allowed_by_policy,
|
| - Globals* globals);
|
| -
|
| - // Returns true if QUIC should be enabled, either as a result
|
| - // of a field trial or a command line flag.
|
| - static bool ShouldEnableQuic(
|
| - const base::CommandLine& command_line,
|
| - base::StringPiece quic_trial_group,
|
| - bool quic_allowed_by_policy);
|
| -
|
| - // Returns true if QUIC should be enabled for proxies, either as a result
|
| - // of a field trial or a command line flag.
|
| - static bool ShouldEnableQuicForProxies(
|
| - const base::CommandLine& command_line,
|
| - base::StringPiece quic_trial_group,
|
| - bool quic_allowed_by_policy);
|
| -
|
| - // Returns true if the selection of the ephemeral port in bind() should be
|
| - // performed by Chromium, and false if the OS should select the port. The OS
|
| - // option is used to prevent Windows from posting a security security warning
|
| - // dialog.
|
| - static bool ShouldEnableQuicPortSelection(
|
| - const base::CommandLine& command_line);
|
| + // as well as the QUIC field trial group and parameters.
|
| + // Must be called before ConfigureSpdyGlobals.
|
| + static void ConfigureQuicGlobals(base::StringPiece quic_trial_group,
|
| + const VariationParameters& quic_trial_params,
|
| + Globals* globals);
|
| +
|
| + // Returns true if QUIC should be enabled as a result of a field trial.
|
| + static bool ShouldEnableQuic(base::StringPiece quic_trial_group);
|
| +
|
| + // Returns true if QUIC should be enabled for proxies as a result of a
|
| + // field trial.
|
| + static bool ShouldEnableQuicForProxies(base::StringPiece quic_trial_group);
|
|
|
| // Returns true if QUIC should always require handshake confirmation during
|
| // the QUIC handshake.
|
| @@ -408,7 +300,6 @@ class IOThread : public content::BrowserThreadDelegate {
|
|
|
| // Returns true if QUIC should enable alternative services.
|
| static bool ShouldQuicEnableAlternativeServices(
|
| - const base::CommandLine& command_line,
|
| const VariationParameters& quic_trial_params);
|
|
|
| // Returns the maximum number of QUIC connections with high packet loss in a
|
| @@ -437,17 +328,14 @@ class IOThread : public content::BrowserThreadDelegate {
|
| static bool ShouldQuicCloseSessionsOnIpChange(
|
| const VariationParameters& quic_trial_params);
|
|
|
| - // Returns the maximum length for QUIC packets, based on any flags in
|
| - // |command_line| or the field trial. Returns 0 if there is an error
|
| - // parsing any of the options, or if the default value should be used.
|
| + // Returns the maximum length for QUIC packets, based on any flags in the
|
| + // field trial. Returns 0 if there is an error parsing any of the options,
|
| + // or if the default value should be used.
|
| static size_t GetQuicMaxPacketLength(
|
| - const base::CommandLine& command_line,
|
| const VariationParameters& quic_trial_params);
|
|
|
| - // Returns the QUIC versions specified by any flags in |command_line|
|
| - // or |quic_trial_params|.
|
| + // Returns the QUIC versions specified by any flags in |quic_trial_params|.
|
| static net::QuicVersion GetQuicVersion(
|
| - const base::CommandLine& command_line,
|
| const VariationParameters& quic_trial_params);
|
|
|
| // Returns the QUIC version specified by |quic_version| or
|
| @@ -455,42 +343,27 @@ class IOThread : public content::BrowserThreadDelegate {
|
| static net::QuicVersion ParseQuicVersion(const std::string& quic_version);
|
|
|
| // Returns the QUIC connection options specified by any flags in
|
| - // |command_line| or |quic_trial_params|.
|
| + // |quic_trial_params|.
|
| static net::QuicTagVector GetQuicConnectionOptions(
|
| - const base::CommandLine& command_line,
|
| const VariationParameters& quic_trial_params);
|
|
|
| // Returns the alternative service probability threshold specified by
|
| - // any flags in |command_line| or |quic_trial_params|.
|
| + // any flags in |quic_trial_params|.
|
| static double GetAlternativeProtocolProbabilityThreshold(
|
| - const base::CommandLine& command_line,
|
| const VariationParameters& quic_trial_params);
|
|
|
| static net::URLRequestContext* ConstructSystemRequestContext(
|
| - IOThread::Globals* globals,
|
| - net::NetLog* net_log);
|
| -
|
| - // TODO(willchan): Remove proxy script fetcher context since it's not
|
| - // necessary now that I got rid of refcounting URLRequestContexts.
|
| - // See IOThread::Globals for details.
|
| - static net::URLRequestContext* ConstructProxyScriptFetcherContext(
|
| - IOThread::Globals* globals,
|
| + Globals* globals,
|
| net::NetLog* net_log);
|
|
|
| - // The NetLog is owned by the browser process, to allow logging from other
|
| - // threads during shutdown, but is used most frequently on the IOThread.
|
| + // The NetLog is owned by the application context, to allow logging from other
|
| + // threads during shutdown, but is used most frequently on the IO thread.
|
| net_log::ChromeNetLog* net_log_;
|
|
|
| -#if defined(ENABLE_EXTENSIONS)
|
| - // The extensions::EventRouterForwarder allows for sending events to
|
| - // extensions from the IOThread.
|
| - extensions::EventRouterForwarder* extension_event_router_forwarder_;
|
| -#endif
|
| -
|
| // These member variables are basically global, but their lifetimes are tied
|
| - // to the IOThread. IOThread owns them all, despite not using scoped_ptr.
|
| - // This is because the destructor of IOThread runs on the wrong thread. All
|
| - // member variables should be deleted in CleanUp().
|
| + // to the IOSChromeIOThread. IOSChromeIOThread owns them all, despite not
|
| + // using scoped_ptr. This is because the destructor of IOSChromeIOThread runs
|
| + // on the wrong thread. All member variables should be deleted in CleanUp().
|
|
|
| // These member variables are initialized in Init() and do not change for the
|
| // lifetime of the IO thread.
|
| @@ -501,27 +374,12 @@ class IOThread : public content::BrowserThreadDelegate {
|
| class LoggingNetworkChangeObserver;
|
| scoped_ptr<LoggingNetworkChangeObserver> network_change_observer_;
|
|
|
| - BooleanPrefMember system_enable_referrers_;
|
| -
|
| - BooleanPrefMember dns_client_enabled_;
|
| -
|
| - BooleanPrefMember quick_check_enabled_;
|
| -
|
| - // Store HTTP Auth-related policies in this thread.
|
| - std::string auth_schemes_;
|
| - bool negotiate_disable_cname_lookup_;
|
| - bool negotiate_enable_port_;
|
| - std::string auth_server_whitelist_;
|
| - std::string auth_delegate_whitelist_;
|
| - std::string gssapi_library_name_;
|
| - std::string auth_android_negotiate_account_type_;
|
| -
|
| // This is an instance of the default SSLConfigServiceManager for the current
|
| // platform and it gets SSL preferences from local_state object.
|
| scoped_ptr<ssl_config::SSLConfigServiceManager> ssl_config_service_manager_;
|
|
|
| // These member variables are initialized by a task posted to the IO thread,
|
| - // which gets posted by calling certain member functions of IOThread.
|
| + // which gets posted by calling certain member functions of IOSChromeIOThread.
|
| scoped_ptr<net::ProxyConfigService> system_proxy_config_service_;
|
|
|
| scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
| @@ -529,17 +387,11 @@ class IOThread : public content::BrowserThreadDelegate {
|
| scoped_refptr<net::URLRequestContextGetter>
|
| system_url_request_context_getter_;
|
|
|
| - // True if SPDY is disabled by policy.
|
| - bool is_spdy_disabled_by_policy_;
|
| -
|
| - // True if QUIC is allowed by policy.
|
| - bool is_quic_allowed_by_policy_;
|
| -
|
| const base::TimeTicks creation_time_;
|
|
|
| - base::WeakPtrFactory<IOThread> weak_factory_;
|
| + base::WeakPtrFactory<IOSChromeIOThread> weak_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(IOThread);
|
| + DISALLOW_COPY_AND_ASSIGN(IOSChromeIOThread);
|
| };
|
|
|
| -#endif // CHROME_BROWSER_IO_THREAD_H_
|
| +#endif // IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
|
|
|