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

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

Issue 1203233002: DCHECK that hostname is not empty in MarkAlternativeServiceBroken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 if (base::EndsWith(origin.host(), canonical_suffixes_[i], false)) { 308 if (base::EndsWith(origin.host(), canonical_suffixes_[i], false)) {
309 HostPortPair canonical_host(canonical_suffix, origin.port()); 309 HostPortPair canonical_host(canonical_suffix, origin.port());
310 canonical_host_to_origin_map_[canonical_host] = origin; 310 canonical_host_to_origin_map_[canonical_host] = origin;
311 break; 311 break;
312 } 312 }
313 } 313 }
314 } 314 }
315 315
316 void HttpServerPropertiesImpl::MarkAlternativeServiceBroken( 316 void HttpServerPropertiesImpl::MarkAlternativeServiceBroken(
317 const AlternativeService& alternative_service) { 317 const AlternativeService& alternative_service) {
318 // Empty host means use host of origin, callers are supposed to substitute.
319 DCHECK(!alternative_service.host.empty());
318 if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) { 320 if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) {
319 LOG(DFATAL) << "Trying to mark unknown alternate protocol broken."; 321 LOG(DFATAL) << "Trying to mark unknown alternate protocol broken.";
320 return; 322 return;
321 } 323 }
322 int count = ++recently_broken_alternative_services_[alternative_service]; 324 int count = ++recently_broken_alternative_services_[alternative_service];
323 base::TimeDelta delay = 325 base::TimeDelta delay =
324 base::TimeDelta::FromSeconds(kBrokenAlternativeProtocolDelaySecs); 326 base::TimeDelta::FromSeconds(kBrokenAlternativeProtocolDelaySecs);
325 base::TimeTicks when = base::TimeTicks::Now() + delay * (1 << (count - 1)); 327 base::TimeTicks when = base::TimeTicks::Now() + delay * (1 << (count - 1));
326 auto result = broken_alternative_services_.insert( 328 auto result = broken_alternative_services_.insert(
327 std::make_pair(alternative_service, when)); 329 std::make_pair(alternative_service, when));
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 584 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
583 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 585 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
584 FROM_HERE, 586 FROM_HERE,
585 base::Bind( 587 base::Bind(
586 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 588 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
587 weak_ptr_factory_.GetWeakPtr()), 589 weak_ptr_factory_.GetWeakPtr()),
588 delay); 590 delay);
589 } 591 }
590 592
591 } // namespace net 593 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698