Index: chrome/browser/io_thread.h |
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h |
index 2daf2befde615742932a93a2ca2d2f0a521cf217..47a01b9d2b65c7382ff2f23416ab1d41b3d32c45 100644 |
--- a/chrome/browser/io_thread.h |
+++ b/chrome/browser/io_thread.h |
@@ -69,6 +69,10 @@ namespace policy { |
class PolicyService; |
} // namespace policy |
+namespace test { |
+class IOThreadPeer; |
+} // namespace test |
+ |
// Contains state associated with, initialized and cleaned up on, and |
// primarily used on, the IO thread. |
// |
@@ -87,7 +91,7 @@ class IOThread : public content::BrowserThreadDelegate { |
set_ = true; |
value_ = value; |
} |
- void CopyToIfSet(T* value) { |
+ void CopyToIfSet(T* value) const { |
if (set_) { |
*value = value_; |
} |
@@ -172,9 +176,9 @@ class IOThread : public content::BrowserThreadDelegate { |
Optional<bool> enable_quic; |
Optional<bool> enable_quic_pacing; |
Optional<bool> enable_quic_time_based_loss_detection; |
- Optional<bool> enable_quic_persist_server_info; |
Optional<bool> enable_quic_port_selection; |
Optional<size_t> quic_max_packet_length; |
+ 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; |
@@ -223,10 +227,15 @@ class IOThread : public content::BrowserThreadDelegate { |
base::TimeTicks creation_time() const; |
private: |
+ // Map from name to value for all parameters associate with a field trial. |
+ typedef std::map<std::string, std::string> VariationParameters; |
+ |
// Provide SystemURLRequestContextGetter with access to |
// InitSystemRequestContext(). |
friend class SystemURLRequestContextGetter; |
+ friend class test::IOThreadPeer; |
+ |
// BrowserThreadDelegate implementation, runs on the IO thread. |
// This handles initialization and destruction of state that must |
// live on the IO thread. |
@@ -234,6 +243,11 @@ class IOThread : public content::BrowserThreadDelegate { |
virtual void InitAsync() OVERRIDE; |
virtual void CleanUp() OVERRIDE; |
+ // Initializes |params| based on the settings in |globals|. |
+ static void InitializeNetworkSessionParamsFromGlobals( |
+ const Globals& globals, |
+ net::HttpNetworkSession::Params* params); |
+ |
void InitializeNetworkOptions(const base::CommandLine& parsed_command_line); |
// Enable SPDY with the given mode, which may contain the following: |
@@ -277,40 +291,69 @@ class IOThread : public content::BrowserThreadDelegate { |
// well as the QUIC field trial group. |
void ConfigureQuic(const base::CommandLine& command_line); |
+ // Configures QUIC options in |globals| based on the flags in |command_line| |
+ // as well as the QUIC field trial group and parameters. |
+ static void ConfigureQuicGlobals( |
+ const base::CommandLine& command_line, |
+ base::StringPiece quic_trial_group, |
+ const VariationParameters& quic_trial_params, |
+ Globals* globals); |
+ |
// Returns true if QUIC should be enabled, either as a result |
// of a field trial or a command line flag. |
- bool ShouldEnableQuic(const base::CommandLine& command_line, |
- base::StringPiece quic_trial_group); |
+ static bool ShouldEnableQuic( |
+ const base::CommandLine& command_line, |
+ base::StringPiece quic_trial_group); |
// 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. |
- bool ShouldEnableQuicPortSelection(const base::CommandLine& command_line); |
+ static bool ShouldEnableQuicPortSelection( |
+ const base::CommandLine& command_line); |
// Returns true if QUIC packet pacing should be negotiated during the |
// QUIC handshake. |
- bool ShouldEnableQuicPacing(const base::CommandLine& command_line, |
- base::StringPiece quic_trial_group); |
+ static bool ShouldEnableQuicPacing( |
+ const base::CommandLine& command_line, |
+ base::StringPiece quic_trial_group, |
+ const VariationParameters& quic_trial_params); |
// Returns true if QUIC time-base loss detection should be negotiated during |
// the QUIC handshake. |
- bool ShouldEnableQuicTimeBasedLossDetection( |
+ static bool ShouldEnableQuicTimeBasedLossDetection( |
const base::CommandLine& command_line, |
- base::StringPiece quic_trial_group); |
- |
- // Returns true if Chromium should persist QUIC server config information to |
- // disk cache. |
- bool ShouldEnableQuicPersistServerInfo(const base::CommandLine& command_line); |
+ base::StringPiece quic_trial_group, |
+ 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. |
- size_t GetQuicMaxPacketLength(const base::CommandLine& command_line, |
- base::StringPiece quic_trial_group); |
+ static size_t GetQuicMaxPacketLength( |
+ const base::CommandLine& command_line, |
+ base::StringPiece quic_trial_group, |
+ const VariationParameters& quic_trial_params); |
+ |
+ // Returns the QUIC versions specified by any flags in |command_line| |
+ // or |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 |
+ // QUIC_VERSION_UNSUPPORTED if |quic_version| is invalid. |
+ 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|. |
+ static net::QuicTagVector GetQuicConnectionOptions( |
+ const base::CommandLine& command_line, |
+ const VariationParameters& quic_trial_params); |
- // Returns the quic versions specified by any flags in |command_line|. |
- net::QuicVersion GetQuicVersion(const base::CommandLine& command_line); |
+ // Returns the list of QUIC tags represented by the comma separated |
+ // string in |connection_options|. |
+ static net::QuicTagVector ParseQuicConnectionOptions( |
+ const std::string& connection_options); |
// The NetLog is owned by the browser process, to allow logging from other |
// threads during shutdown, but is used most frequently on the IOThread. |