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

Unified Diff: net/http/broken_alternative_services.h

Issue 2932953002: Persist broken and recently-broken alt-svcs to prefs in HttpServerPropertiesManager (Closed)
Patch Set: Added a DCHECK 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 da9681089fae165dcfe3b0be1701d8ae14ba5c84..1fcb5a80941f681a7c1ea7a24b29d135413daf93 100644
--- a/net/http/broken_alternative_services.h
+++ b/net/http/broken_alternative_services.h
@@ -9,13 +9,10 @@
#include <unordered_map>
#include "base/memory/weak_ptr.h"
+#include "base/time/default_tick_clock.h"
#include "base/timer/timer.h"
#include "net/http/http_server_properties.h"
-namespace base {
-class TickClock;
-}
-
namespace net {
// This class tracks HTTP alternative services that have been marked as broken.
@@ -41,13 +38,15 @@ class NET_EXPORT_PRIVATE BrokenAlternativeServices {
// |clock| is used for setting expiration times and scheduling the
// expiration of broken alternative services. It must not be null.
// |delegate| and |clock| are both unowned and must outlive this.
- BrokenAlternativeServices(Delegate* delegate, base::TickClock* clock);
+ BrokenAlternativeServices(Delegate* delegate);
BrokenAlternativeServices(const BrokenAlternativeServices&) = delete;
void operator=(const BrokenAlternativeServices&) = delete;
~BrokenAlternativeServices();
+ void Clear();
Ryan Hamilton 2017/06/12 18:57:32 nit: Comment (though it's probably fairly obvious)
wangyix1 2017/06/14 00:01:25 Done.
+
// Marks |alternative_service| as broken until after some expiration delay
// (determined by how many times it's been marked broken before). Being broken
// will cause IsAlternativeServiceBroken(alternative_service) to return true
@@ -84,8 +83,14 @@ class NET_EXPORT_PRIVATE BrokenAlternativeServices {
// expiration time.
// All AlternativeServices in |broken_alternative_service_list| must exist in
// |recently_broken_alternative_services|.
- // Returns whether or not any alternative services were actually added.
- bool AddBrokenAndRecentlyBrokenAlternativeServices(
+ //
+ // If a broken/recently-broken alt svc that's being added is already stored,
+ // the stored expiration/broken-count for that alt svc will be overwritten
+ // with the new value.
+ // However, |recently_broken_alternative_services_| will still have the
+ // already-stored alt svcs at the front of the recency list, followed by the
+ // newly added ones.
+ void AddBrokenAndRecentlyBrokenAlternativeServices(
std::unique_ptr<BrokenAlternativeServiceList>
broken_alternative_service_list,
std::unique_ptr<RecentlyBrokenAlternativeServices>
@@ -96,6 +101,9 @@ class NET_EXPORT_PRIVATE BrokenAlternativeServices {
const RecentlyBrokenAlternativeServices&
recently_broken_alternative_services() const;
+ // |clock| is unowned.
Ryan Hamilton 2017/06/12 18:57:32 I think you mean to say that |clock| must outlive
wangyix1 2017/06/14 00:01:25 Function has been removed
+ void SetTickClockForTesting(base::TickClock* clock);
+
private:
// TODO (wangyix): modify HttpServerPropertiesImpl unit tests so this
// friendness is no longer required.
@@ -122,10 +130,12 @@ class NET_EXPORT_PRIVATE BrokenAlternativeServices {
BrokenAlternativeServiceList::iterator* it);
void ExpireBrokenAlternateProtocolMappings();
- void ScheduleBrokenAlternateProtocolMappingsExpiration();
+ void ScheduleBrokenAlternateProtocolMappingsExpiration(base::TimeTicks when);
Delegate* delegate_; // Unowned
- base::TickClock* clock_; // Unowned
+ base::TickClock* clock_; // Unowned if not pointing to |default_clock_|.
Ryan Hamilton 2017/06/12 18:57:32 I'd just say "Unowned". Because you'll never say "
wangyix1 2017/06/14 00:01:25 Done.
+
+ base::DefaultTickClock default_clock_;
// List of <broken alt svc, expiration time> pairs sorted by expiration time.
BrokenAlternativeServiceList broken_alternative_service_list_;
« 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