| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 BrokenAlternateProtocolEntry entry; | 334 BrokenAlternateProtocolEntry entry; |
| 335 entry.server = server; | 335 entry.server = server; |
| 336 entry.when = base::TimeTicks::Now() + delay * (1 << (count - 1)); | 336 entry.when = base::TimeTicks::Now() + delay * (1 << (count - 1)); |
| 337 broken_alternate_protocol_list_.push_back(entry); | 337 broken_alternate_protocol_list_.push_back(entry); |
| 338 | 338 |
| 339 // Do not leave this host as canonical so that we don't infer the other | 339 // Do not leave this host as canonical so that we don't infer the other |
| 340 // hosts are also broken without testing them first. | 340 // hosts are also broken without testing them first. |
| 341 RemoveCanonicalHost(server); | 341 RemoveCanonicalHost(server); |
| 342 | 342 |
| 343 // If this is the only entry in the list, schedule an expiration task. | 343 // If this is the only entry in the list, schedule an expiration task. |
| 344 // Otherwse it will be rescheduled automatically when the pending | 344 // Otherwise it will be rescheduled automatically when the pending task runs. |
| 345 // task runs. | |
| 346 if (broken_alternate_protocol_list_.size() == 1) { | 345 if (broken_alternate_protocol_list_.size() == 1) { |
| 347 ScheduleBrokenAlternateProtocolMappingsExpiration(); | 346 ScheduleBrokenAlternateProtocolMappingsExpiration(); |
| 348 } | 347 } |
| 349 } | 348 } |
| 350 | 349 |
| 351 bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken( | 350 bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken( |
| 352 const HostPortPair& server) { | 351 const HostPortPair& server) { |
| 353 return ContainsKey(broken_alternate_protocol_map_, server); | 352 return ContainsKey(broken_alternate_protocol_map_, server); |
| 354 } | 353 } |
| 355 | 354 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 530 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 532 base::MessageLoop::current()->PostDelayedTask( | 531 base::MessageLoop::current()->PostDelayedTask( |
| 533 FROM_HERE, | 532 FROM_HERE, |
| 534 base::Bind( | 533 base::Bind( |
| 535 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 534 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 536 weak_ptr_factory_.GetWeakPtr()), | 535 weak_ptr_factory_.GetWeakPtr()), |
| 537 delay); | 536 delay); |
| 538 } | 537 } |
| 539 | 538 |
| 540 } // namespace net | 539 } // namespace net |
| OLD | NEW |