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 #include "components/cronet/android/url_request_context_adapter.h" | 5 #include "components/cronet/android/url_request_context_adapter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <limits> | 9 #include <limits> |
10 #include <utility> | 10 #include <utility> |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 config_->ConfigureURLRequestContextBuilder(&context_builder, nullptr); | 157 config_->ConfigureURLRequestContextBuilder(&context_builder, nullptr); |
158 | 158 |
159 context_ = context_builder.Build(); | 159 context_ = context_builder.Build(); |
160 | 160 |
161 if (config_->enable_sdch) { | 161 if (config_->enable_sdch) { |
162 DCHECK(context_->sdch_manager()); | 162 DCHECK(context_->sdch_manager()); |
163 sdch_owner_.reset( | 163 sdch_owner_.reset( |
164 new net::SdchOwner(context_->sdch_manager(), context_.get())); | 164 new net::SdchOwner(context_->sdch_manager(), context_.get())); |
165 } | 165 } |
166 | 166 |
167 // Currently (circa M39) enabling QUIC requires setting probability threshold. | |
168 if (config_->enable_quic) { | 167 if (config_->enable_quic) { |
169 context_->http_server_properties() | |
170 ->SetAlternativeServiceProbabilityThreshold(0.0f); | |
171 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) { | 168 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) { |
172 const URLRequestContextConfig::QuicHint& quic_hint = | 169 const URLRequestContextConfig::QuicHint& quic_hint = |
173 *config_->quic_hints[hint]; | 170 *config_->quic_hints[hint]; |
174 if (quic_hint.host.empty()) { | 171 if (quic_hint.host.empty()) { |
175 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; | 172 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; |
176 continue; | 173 continue; |
177 } | 174 } |
178 | 175 |
179 url::CanonHostInfo host_info; | 176 url::CanonHostInfo host_info; |
180 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); | 177 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); |
(...skipping 16 matching lines...) Expand all Loading... |
197 << quic_hint.alternate_port; | 194 << quic_hint.alternate_port; |
198 continue; | 195 continue; |
199 } | 196 } |
200 | 197 |
201 net::HostPortPair quic_hint_host_port_pair(canon_host, | 198 net::HostPortPair quic_hint_host_port_pair(canon_host, |
202 quic_hint.port); | 199 quic_hint.port); |
203 net::AlternativeService alternative_service( | 200 net::AlternativeService alternative_service( |
204 net::AlternateProtocol::QUIC, "", | 201 net::AlternateProtocol::QUIC, "", |
205 static_cast<uint16_t>(quic_hint.alternate_port)); | 202 static_cast<uint16_t>(quic_hint.alternate_port)); |
206 context_->http_server_properties()->SetAlternativeService( | 203 context_->http_server_properties()->SetAlternativeService( |
207 quic_hint_host_port_pair, alternative_service, 1.0f, | 204 quic_hint_host_port_pair, alternative_service, base::Time::Max()); |
208 base::Time::Max()); | |
209 } | 205 } |
210 } | 206 } |
211 load_disable_cache_ = config_->load_disable_cache; | 207 load_disable_cache_ = config_->load_disable_cache; |
212 config_.reset(NULL); | 208 config_.reset(NULL); |
213 | 209 |
214 if (VLOG_IS_ON(2)) { | 210 if (VLOG_IS_ON(2)) { |
215 net_log_observer_.reset(new NetLogObserver()); | 211 net_log_observer_.reset(new NetLogObserver()); |
216 context_->net_log()->DeprecatedAddObserver( | 212 context_->net_log()->DeprecatedAddObserver( |
217 net_log_observer_.get(), | 213 net_log_observer_.get(), |
218 net::NetLogCaptureMode::IncludeCookiesAndCredentials()); | 214 net::NetLogCaptureMode::IncludeCookiesAndCredentials()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 write_to_file_observer_.reset(); | 313 write_to_file_observer_.reset(); |
318 } | 314 } |
319 } | 315 } |
320 | 316 |
321 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { | 317 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { |
322 VLOG(2) << "Net log entry: type=" << entry.type() | 318 VLOG(2) << "Net log entry: type=" << entry.type() |
323 << ", source=" << entry.source().type << ", phase=" << entry.phase(); | 319 << ", source=" << entry.source().type << ", phase=" << entry.phase(); |
324 } | 320 } |
325 | 321 |
326 } // namespace cronet | 322 } // namespace cronet |
OLD | NEW |