OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/http/http_server_properties_impl.h" | 5 #include "net/http/http_server_properties_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 << server.ToString() | 276 << server.ToString() |
277 << " from [Port: " << existing_alternate.port | 277 << " from [Port: " << existing_alternate.port |
278 << ", Protocol: " << existing_alternate.protocol | 278 << ", Protocol: " << existing_alternate.protocol |
279 << ", Probability: " << existing_alternate.probability | 279 << ", Probability: " << existing_alternate.probability |
280 << "] to [Port: " << alternate_port | 280 << "] to [Port: " << alternate_port |
281 << ", Protocol: " << alternate_protocol | 281 << ", Protocol: " << alternate_protocol |
282 << ", Probability: " << alternate_probability | 282 << ", Probability: " << alternate_probability |
283 << "]."; | 283 << "]."; |
284 } | 284 } |
285 } else { | 285 } else { |
286 // TODO(rch): Consider the case where multiple requests are started | 286 if (alternate_probability >= alternate_protocol_probability_threshold_) { |
287 // before the first completes. In this case, only one of the jobs | 287 // TODO(rch): Consider the case where multiple requests are started |
288 // would reach this code, whereas all of them should should have. | 288 // before the first completes. In this case, only one of the jobs |
289 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING, | 289 // would reach this code, whereas all of them should should have. |
290 alternate_protocol_experiment_); | 290 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING, |
| 291 alternate_protocol_experiment_); |
| 292 } |
291 } | 293 } |
292 | 294 |
293 alternate_protocol_map_.Put(server, alternate); | 295 alternate_protocol_map_.Put(server, alternate); |
294 | 296 |
295 // If this host ends with a canonical suffix, then set it as the | 297 // If this host ends with a canonical suffix, then set it as the |
296 // canonical host. | 298 // canonical host. |
297 for (size_t i = 0; i < canoncial_suffixes_.size(); ++i) { | 299 for (size_t i = 0; i < canoncial_suffixes_.size(); ++i) { |
298 std::string canonical_suffix = canoncial_suffixes_[i]; | 300 std::string canonical_suffix = canoncial_suffixes_[i]; |
299 if (EndsWith(server.host(), canoncial_suffixes_[i], false)) { | 301 if (EndsWith(server.host(), canoncial_suffixes_[i], false)) { |
300 HostPortPair canonical_host(canonical_suffix, server.port()); | 302 HostPortPair canonical_host(canonical_suffix, server.port()); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 513 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
512 base::MessageLoop::current()->PostDelayedTask( | 514 base::MessageLoop::current()->PostDelayedTask( |
513 FROM_HERE, | 515 FROM_HERE, |
514 base::Bind( | 516 base::Bind( |
515 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 517 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
516 weak_ptr_factory_.GetWeakPtr()), | 518 weak_ptr_factory_.GetWeakPtr()), |
517 delay); | 519 delay); |
518 } | 520 } |
519 | 521 |
520 } // namespace net | 522 } // namespace net |
OLD | NEW |