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> |
| 8 #include <stdint.h> |
| 9 |
7 #include <limits> | 10 #include <limits> |
8 | 11 |
9 #include "base/bind.h" | 12 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
11 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
| 15 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
13 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
14 #include "base/time/time.h" | 18 #include "base/time/time.h" |
15 #include "components/cronet/url_request_context_config.h" | 19 #include "components/cronet/url_request_context_config.h" |
16 #include "net/android/network_change_notifier_factory_android.h" | 20 #include "net/android/network_change_notifier_factory_android.h" |
17 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
18 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
19 #include "net/base/network_change_notifier.h" | 23 #include "net/base/network_change_notifier.h" |
20 #include "net/base/network_delegate_impl.h" | 24 #include "net/base/network_delegate_impl.h" |
21 #include "net/cert/cert_verifier.h" | 25 #include "net/cert/cert_verifier.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 177 } |
174 | 178 |
175 url::CanonHostInfo host_info; | 179 url::CanonHostInfo host_info; |
176 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); | 180 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); |
177 if (!host_info.IsIPAddress() && | 181 if (!host_info.IsIPAddress() && |
178 !net::IsCanonicalizedHostCompliant(canon_host)) { | 182 !net::IsCanonicalizedHostCompliant(canon_host)) { |
179 LOG(ERROR) << "Invalid QUIC hint host: " << quic_hint.host; | 183 LOG(ERROR) << "Invalid QUIC hint host: " << quic_hint.host; |
180 continue; | 184 continue; |
181 } | 185 } |
182 | 186 |
183 if (quic_hint.port <= std::numeric_limits<uint16>::min() || | 187 if (quic_hint.port <= std::numeric_limits<uint16_t>::min() || |
184 quic_hint.port > std::numeric_limits<uint16>::max()) { | 188 quic_hint.port > std::numeric_limits<uint16_t>::max()) { |
185 LOG(ERROR) << "Invalid QUIC hint port: " | 189 LOG(ERROR) << "Invalid QUIC hint port: " |
186 << quic_hint.port; | 190 << quic_hint.port; |
187 continue; | 191 continue; |
188 } | 192 } |
189 | 193 |
190 if (quic_hint.alternate_port <= std::numeric_limits<uint16>::min() || | 194 if (quic_hint.alternate_port <= std::numeric_limits<uint16_t>::min() || |
191 quic_hint.alternate_port > std::numeric_limits<uint16>::max()) { | 195 quic_hint.alternate_port > std::numeric_limits<uint16_t>::max()) { |
192 LOG(ERROR) << "Invalid QUIC hint alternate port: " | 196 LOG(ERROR) << "Invalid QUIC hint alternate port: " |
193 << quic_hint.alternate_port; | 197 << quic_hint.alternate_port; |
194 continue; | 198 continue; |
195 } | 199 } |
196 | 200 |
197 net::HostPortPair quic_hint_host_port_pair(canon_host, | 201 net::HostPortPair quic_hint_host_port_pair(canon_host, |
198 quic_hint.port); | 202 quic_hint.port); |
199 net::AlternativeService alternative_service( | 203 net::AlternativeService alternative_service( |
200 net::AlternateProtocol::QUIC, "", | 204 net::AlternateProtocol::QUIC, "", |
201 static_cast<uint16>(quic_hint.alternate_port)); | 205 static_cast<uint16_t>(quic_hint.alternate_port)); |
202 context_->http_server_properties()->SetAlternativeService( | 206 context_->http_server_properties()->SetAlternativeService( |
203 quic_hint_host_port_pair, alternative_service, 1.0f, | 207 quic_hint_host_port_pair, alternative_service, 1.0f, |
204 base::Time::Max()); | 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()); |
(...skipping 101 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 |