Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: net/http/http_server_properties_impl.cc

Issue 989273005: Add MarkAlternativeServiceRecentlyBroken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 (recently_broken_alternative_services_[alternative_service] == 0)
Ryan Hamilton 2015/03/11 20:28:02 If it were me, I'd replace this if: if (!Contains
Bence 2015/03/12 01:12:53 Done.
349 recently_broken_alternative_services_[alternative_service] = 1;
350 }
351
346 bool HttpServerPropertiesImpl::IsAlternativeServiceBroken( 352 bool HttpServerPropertiesImpl::IsAlternativeServiceBroken(
347 const AlternativeService& alternative_service) { 353 const AlternativeService& alternative_service) {
348 return ContainsKey(broken_alternative_services_, alternative_service); 354 return ContainsKey(broken_alternative_services_, alternative_service);
349 } 355 }
350 356
351 bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken( 357 bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken(
352 const HostPortPair& server) { 358 const HostPortPair& server) {
353 const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server); 359 const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server);
354 if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) 360 if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
355 return false; 361 return false;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 562 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
557 base::MessageLoop::current()->PostDelayedTask( 563 base::MessageLoop::current()->PostDelayedTask(
558 FROM_HERE, 564 FROM_HERE,
559 base::Bind( 565 base::Bind(
560 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 566 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
561 weak_ptr_factory_.GetWeakPtr()), 567 weak_ptr_factory_.GetWeakPtr()),
562 delay); 568 delay);
563 } 569 }
564 570
565 } // namespace net 571 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698