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. |
167 if (config_->enable_quic) { | 168 if (config_->enable_quic) { |
| 169 context_->http_server_properties() |
| 170 ->SetAlternativeServiceProbabilityThreshold(0.0f); |
168 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) { | 171 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) { |
169 const URLRequestContextConfig::QuicHint& quic_hint = | 172 const URLRequestContextConfig::QuicHint& quic_hint = |
170 *config_->quic_hints[hint]; | 173 *config_->quic_hints[hint]; |
171 if (quic_hint.host.empty()) { | 174 if (quic_hint.host.empty()) { |
172 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; | 175 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; |
173 continue; | 176 continue; |
174 } | 177 } |
175 | 178 |
176 url::CanonHostInfo host_info; | 179 url::CanonHostInfo host_info; |
177 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); | 180 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); |
(...skipping 16 matching lines...) Expand all Loading... |
194 << quic_hint.alternate_port; | 197 << quic_hint.alternate_port; |
195 continue; | 198 continue; |
196 } | 199 } |
197 | 200 |
198 net::HostPortPair quic_hint_host_port_pair(canon_host, | 201 net::HostPortPair quic_hint_host_port_pair(canon_host, |
199 quic_hint.port); | 202 quic_hint.port); |
200 net::AlternativeService alternative_service( | 203 net::AlternativeService alternative_service( |
201 net::AlternateProtocol::QUIC, "", | 204 net::AlternateProtocol::QUIC, "", |
202 static_cast<uint16_t>(quic_hint.alternate_port)); | 205 static_cast<uint16_t>(quic_hint.alternate_port)); |
203 context_->http_server_properties()->SetAlternativeService( | 206 context_->http_server_properties()->SetAlternativeService( |
204 quic_hint_host_port_pair, alternative_service, base::Time::Max()); | 207 quic_hint_host_port_pair, alternative_service, 1.0f, |
| 208 base::Time::Max()); |
205 } | 209 } |
206 } | 210 } |
207 load_disable_cache_ = config_->load_disable_cache; | 211 load_disable_cache_ = config_->load_disable_cache; |
208 config_.reset(NULL); | 212 config_.reset(NULL); |
209 | 213 |
210 if (VLOG_IS_ON(2)) { | 214 if (VLOG_IS_ON(2)) { |
211 net_log_observer_.reset(new NetLogObserver()); | 215 net_log_observer_.reset(new NetLogObserver()); |
212 context_->net_log()->DeprecatedAddObserver( | 216 context_->net_log()->DeprecatedAddObserver( |
213 net_log_observer_.get(), | 217 net_log_observer_.get(), |
214 net::NetLogCaptureMode::IncludeCookiesAndCredentials()); | 218 net::NetLogCaptureMode::IncludeCookiesAndCredentials()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 write_to_file_observer_.reset(); | 317 write_to_file_observer_.reset(); |
314 } | 318 } |
315 } | 319 } |
316 | 320 |
317 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { | 321 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { |
318 VLOG(2) << "Net log entry: type=" << entry.type() | 322 VLOG(2) << "Net log entry: type=" << entry.type() |
319 << ", source=" << entry.source().type << ", phase=" << entry.phase(); | 323 << ", source=" << entry.source().type << ", phase=" << entry.phase(); |
320 } | 324 } |
321 | 325 |
322 } // namespace cronet | 326 } // namespace cronet |
OLD | NEW |