OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_CRNET_CRNET_ENVIRONMENT_H_ | 5 #ifndef IOS_CRNET_CRNET_ENVIRONMENT_H_ |
6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ | 6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Setters and getters for |spdy_enabled_|, |quic_enabled_|, and | 86 // Setters and getters for |spdy_enabled_|, |quic_enabled_|, and |
87 // |forced_quic_origin_|. These only have any effect before Install() is | 87 // |forced_quic_origin_|. These only have any effect before Install() is |
88 // called. | 88 // called. |
89 void set_spdy_enabled(bool enabled) { spdy_enabled_ = enabled; } | 89 void set_spdy_enabled(bool enabled) { spdy_enabled_ = enabled; } |
90 void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; } | 90 void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; } |
91 void set_sdch_enabled(bool enabled) { sdch_enabled_ = enabled; } | 91 void set_sdch_enabled(bool enabled) { sdch_enabled_ = enabled; } |
92 void set_sdch_pref_store_filename(const std::string& pref_store) { | 92 void set_sdch_pref_store_filename(const std::string& pref_store) { |
93 sdch_pref_store_filename_ = pref_store; | 93 sdch_pref_store_filename_ = pref_store; |
94 } | 94 } |
| 95 void set_alternate_protocol_threshold(double threshold) { |
| 96 alternate_protocol_threshold_ = threshold; |
| 97 } |
95 | 98 |
96 bool spdy_enabled() const { return spdy_enabled_; } | 99 bool spdy_enabled() const { return spdy_enabled_; } |
97 bool quic_enabled() const { return quic_enabled_; } | 100 bool quic_enabled() const { return quic_enabled_; } |
98 bool sdch_enabled() const { return sdch_enabled_; } | 101 bool sdch_enabled() const { return sdch_enabled_; } |
| 102 double alternate_protocol_threshold() const { |
| 103 return alternate_protocol_threshold_; |
| 104 } |
99 | 105 |
100 // Clears the network stack's disk cache. | 106 // Clears the network stack's disk cache. |
101 void ClearCache(ClearCacheCallback callback); | 107 void ClearCache(ClearCacheCallback callback); |
102 | 108 |
103 private: | 109 private: |
104 // Runs a closure on the network thread. | 110 // Runs a closure on the network thread. |
105 void PostToNetworkThread(const tracked_objects::Location& from_here, | 111 void PostToNetworkThread(const tracked_objects::Location& from_here, |
106 const base::Closure& task); | 112 const base::Closure& task); |
107 | 113 |
108 // Configures SDCH on the network thread. If SDCH is enabled, sets up | 114 // Configures SDCH on the network thread. If SDCH is enabled, sets up |
(...skipping 19 matching lines...) Expand all Loading... |
128 net::URLRequestContext* context); | 134 net::URLRequestContext* context); |
129 | 135 |
130 // Helper method that closes all current SPDY sessions on the network IO | 136 // Helper method that closes all current SPDY sessions on the network IO |
131 // thread. | 137 // thread. |
132 void CloseAllSpdySessionsInternal(); | 138 void CloseAllSpdySessionsInternal(); |
133 | 139 |
134 bool spdy_enabled_; | 140 bool spdy_enabled_; |
135 bool quic_enabled_; | 141 bool quic_enabled_; |
136 bool sdch_enabled_; | 142 bool sdch_enabled_; |
137 std::string sdch_pref_store_filename_; | 143 std::string sdch_pref_store_filename_; |
| 144 double alternate_protocol_threshold_; |
138 | 145 |
139 static CrNetEnvironment* chrome_net_; | 146 static CrNetEnvironment* chrome_net_; |
140 scoped_ptr<base::Thread> network_io_thread_; | 147 scoped_ptr<base::Thread> network_io_thread_; |
141 scoped_ptr<base::Thread> network_cache_thread_; | 148 scoped_ptr<base::Thread> network_cache_thread_; |
142 scoped_ptr<base::Thread> file_thread_; | 149 scoped_ptr<base::Thread> file_thread_; |
143 scoped_ptr<base::Thread> file_user_blocking_thread_; | 150 scoped_ptr<base::Thread> file_user_blocking_thread_; |
144 scoped_ptr<net::SdchManager> sdch_manager_; | 151 scoped_ptr<net::SdchManager> sdch_manager_; |
145 scoped_ptr<net::SdchOwner> sdch_owner_; | 152 scoped_ptr<net::SdchOwner> sdch_owner_; |
146 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; | 153 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; |
147 scoped_refptr<JsonPrefStore> net_pref_store_; | 154 scoped_refptr<JsonPrefStore> net_pref_store_; |
148 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 155 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
149 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 156 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
150 scoped_ptr<net::HttpServerProperties> http_server_properties_; | 157 scoped_ptr<net::HttpServerProperties> http_server_properties_; |
151 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; | 158 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; |
152 scoped_ptr<net::URLRequestContext> main_context_; | 159 scoped_ptr<net::URLRequestContext> main_context_; |
153 scoped_ptr<CrNetHttpProtocolHandlerDelegate> http_protocol_handler_delegate_; | 160 scoped_ptr<CrNetHttpProtocolHandlerDelegate> http_protocol_handler_delegate_; |
154 std::string user_agent_product_name_; | 161 std::string user_agent_product_name_; |
155 scoped_ptr<net::NetLog> net_log_; | 162 scoped_ptr<net::NetLog> net_log_; |
156 scoped_ptr<net::WriteToFileNetLogObserver> net_log_observer_; | 163 scoped_ptr<net::WriteToFileNetLogObserver> net_log_observer_; |
157 | 164 |
158 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); | 165 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); |
159 }; | 166 }; |
160 | 167 |
161 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ | 168 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ |
OLD | NEW |