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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // hosts are also broken without testing them first. | 336 // hosts are also broken without testing them first. |
337 RemoveCanonicalHost(server); | 337 RemoveCanonicalHost(server); |
338 | 338 |
339 // If this is the only entry in the list, schedule an expiration task. | 339 // If this is the only entry in the list, schedule an expiration task. |
340 // Otherwise it will be rescheduled automatically when the pending task runs. | 340 // Otherwise it will be rescheduled automatically when the pending task runs. |
341 if (broken_alternative_services_.size() == 1) { | 341 if (broken_alternative_services_.size() == 1) { |
342 ScheduleBrokenAlternateProtocolMappingsExpiration(); | 342 ScheduleBrokenAlternateProtocolMappingsExpiration(); |
343 } | 343 } |
344 } | 344 } |
345 | 345 |
346 void HttpServerPropertiesImpl::MarkAlternativeServiceRecentlyBroken( | |
347 const AlternativeService& alternative_service) { | |
348 if (!ContainsKey(recently_broken_alternative_services_, alternative_service)) | |
349 recently_broken_alternative_services_[alternative_service] = 1; | |
350 } | |
351 | |
352 bool HttpServerPropertiesImpl::IsAlternativeServiceBroken( | 346 bool HttpServerPropertiesImpl::IsAlternativeServiceBroken( |
353 const AlternativeService& alternative_service) { | 347 const AlternativeService& alternative_service) { |
354 return ContainsKey(broken_alternative_services_, alternative_service); | 348 return ContainsKey(broken_alternative_services_, alternative_service); |
355 } | 349 } |
356 | 350 |
357 bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken( | 351 bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken( |
358 const HostPortPair& server) { | 352 const HostPortPair& server) { |
359 const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server); | 353 const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server); |
360 if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) | 354 if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) |
361 return false; | 355 return false; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 556 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
563 base::MessageLoop::current()->PostDelayedTask( | 557 base::MessageLoop::current()->PostDelayedTask( |
564 FROM_HERE, | 558 FROM_HERE, |
565 base::Bind( | 559 base::Bind( |
566 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 560 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
567 weak_ptr_factory_.GetWeakPtr()), | 561 weak_ptr_factory_.GetWeakPtr()), |
568 delay); | 562 delay); |
569 } | 563 } |
570 | 564 |
571 } // namespace net | 565 } // namespace net |
OLD | NEW |