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

Unified Diff: net/http/broken_alternative_services.h

Issue 2917913002: Add getters and setters for BrokenAlternativeService's list of broken and recently-broken alt svcs (Closed)
Patch Set: Fixed entry override logic in SetBrokenAndRecentlyBrokenAlternativeServices() Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/broken_alternative_services.cc » ('j') | net/http/broken_alternative_services.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/broken_alternative_services.h
diff --git a/net/http/broken_alternative_services.h b/net/http/broken_alternative_services.h
index 6a51222ee3fba09bd3b6bdfa3a889f79251d2b62..cd1ab903c3f650c93a38ec5489f50923028c8361 100644
--- a/net/http/broken_alternative_services.h
+++ b/net/http/broken_alternative_services.h
@@ -18,12 +18,6 @@ class TickClock;
namespace net {
-struct AlternativeServiceHash {
- size_t operator()(const net::AlternativeService& entry) const {
- return entry.protocol ^ std::hash<std::string>()(entry.host) ^ entry.port;
- }
-};
-
// This class tracks HTTP alternative services that have been marked as broken.
// The brokenness of an alt-svc will expire after some time according to an
// exponential back-off formula: each time an alt-svc is marked broken, the
@@ -85,24 +79,33 @@ class NET_EXPORT_PRIVATE BrokenAlternativeServices {
// Marks |alternative_service| as not broken and not recently broken.
void ConfirmAlternativeService(const AlternativeService& alternative_service);
+ // Sets broken and recently broken alternative services.
+ // |broken_alternative_service_list| must be sorted from earliest to latest
+ // expiration time.
+ // All AlternativeServices in |broken_alternative_service_list| must exist in
+ // |recently_broken_alternative_services|.
+ void SetBrokenAndRecentlyBrokenAlternativeServices(
+ std::unique_ptr<BrokenAlternativeServiceList>
+ broken_alternative_service_list,
+ std::unique_ptr<RecentlyBrokenAlternativeServices>
+ recently_broken_alternative_services);
+
+ const BrokenAlternativeServiceList& broken_alternative_service_list() const;
+
+ const RecentlyBrokenAlternativeServices&
+ recently_broken_alternative_services() const;
+
private:
// TODO (wangyix): modify HttpServerPropertiesImpl unit tests so this
// friendness is no longer required.
friend class HttpServerPropertiesImplPeer;
- // A pair containing a broken AlternativeService and the expiration time of
- // its brokenness.
- struct BrokenAltSvcExpireInfo {
- BrokenAltSvcExpireInfo(const AlternativeService& alt_svc,
- base::TimeTicks expire)
- : alternative_service(alt_svc), expiration(expire) {}
-
- AlternativeService alternative_service;
- base::TimeTicks expiration;
+ struct AlternativeServiceHash {
+ size_t operator()(const net::AlternativeService& entry) const {
+ return entry.protocol ^ std::hash<std::string>()(entry.host) ^ entry.port;
+ }
};
- typedef std::list<BrokenAltSvcExpireInfo> BrokenAlternativeServiceList;
-
typedef std::unordered_map<AlternativeService,
BrokenAlternativeServiceList::iterator,
AlternativeServiceHash>
« no previous file with comments | « no previous file | net/http/broken_alternative_services.cc » ('j') | net/http/broken_alternative_services.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698