Chromium Code Reviews| 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 // Currently (circa M39) enabling QUIC requires setting probability threshold. |
|
mef
2016/03/04 18:40:40
I guess this comment is now outdated.
Ryan Hamilton
2016/03/04 19:17:56
Done.
| |
| 168 if (config_->enable_quic) { | 168 if (config_->enable_quic) { |
|
mef
2016/03/04 18:40:40
This is legacy api, you also need to update curren
Ryan Hamilton
2016/03/04 19:17:56
Heh, yeah, I just noticed that :> Done.
| |
| 169 context_->http_server_properties() | |
| 170 ->SetAlternativeServiceProbabilityThreshold(0.0f); | |
| 171 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) { | 169 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) { |
| 172 const URLRequestContextConfig::QuicHint& quic_hint = | 170 const URLRequestContextConfig::QuicHint& quic_hint = |
| 173 *config_->quic_hints[hint]; | 171 *config_->quic_hints[hint]; |
| 174 if (quic_hint.host.empty()) { | 172 if (quic_hint.host.empty()) { |
| 175 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; | 173 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; |
| 176 continue; | 174 continue; |
| 177 } | 175 } |
| 178 | 176 |
| 179 url::CanonHostInfo host_info; | 177 url::CanonHostInfo host_info; |
| 180 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); | 178 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 197 << quic_hint.alternate_port; | 195 << quic_hint.alternate_port; |
| 198 continue; | 196 continue; |
| 199 } | 197 } |
| 200 | 198 |
| 201 net::HostPortPair quic_hint_host_port_pair(canon_host, | 199 net::HostPortPair quic_hint_host_port_pair(canon_host, |
| 202 quic_hint.port); | 200 quic_hint.port); |
| 203 net::AlternativeService alternative_service( | 201 net::AlternativeService alternative_service( |
| 204 net::AlternateProtocol::QUIC, "", | 202 net::AlternateProtocol::QUIC, "", |
| 205 static_cast<uint16_t>(quic_hint.alternate_port)); | 203 static_cast<uint16_t>(quic_hint.alternate_port)); |
| 206 context_->http_server_properties()->SetAlternativeService( | 204 context_->http_server_properties()->SetAlternativeService( |
| 207 quic_hint_host_port_pair, alternative_service, 1.0f, | 205 quic_hint_host_port_pair, alternative_service, |
| 208 base::Time::Max()); | 206 base::Time::Max()); |
| 209 } | 207 } |
| 210 } | 208 } |
| 211 load_disable_cache_ = config_->load_disable_cache; | 209 load_disable_cache_ = config_->load_disable_cache; |
| 212 config_.reset(NULL); | 210 config_.reset(NULL); |
| 213 | 211 |
| 214 if (VLOG_IS_ON(2)) { | 212 if (VLOG_IS_ON(2)) { |
| 215 net_log_observer_.reset(new NetLogObserver()); | 213 net_log_observer_.reset(new NetLogObserver()); |
| 216 context_->net_log()->DeprecatedAddObserver( | 214 context_->net_log()->DeprecatedAddObserver( |
| 217 net_log_observer_.get(), | 215 net_log_observer_.get(), |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 write_to_file_observer_.reset(); | 315 write_to_file_observer_.reset(); |
| 318 } | 316 } |
| 319 } | 317 } |
| 320 | 318 |
| 321 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { | 319 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { |
| 322 VLOG(2) << "Net log entry: type=" << entry.type() | 320 VLOG(2) << "Net log entry: type=" << entry.type() |
| 323 << ", source=" << entry.source().type << ", phase=" << entry.phase(); | 321 << ", source=" << entry.source().type << ", phase=" << entry.phase(); |
| 324 } | 322 } |
| 325 | 323 |
| 326 } // namespace cronet | 324 } // namespace cronet |
| OLD | NEW |