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_; |