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

Unified Diff: net/http/http_server_properties_manager.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
Index: net/http/http_server_properties_manager.h
diff --git a/net/http/http_server_properties_manager.h b/net/http/http_server_properties_manager.h
index 0b7dc11045eeef114ea5395029c30561b8bc64ea..549a85f5c8556892136f10817075a9fbb763fd47 100644
--- a/net/http/http_server_properties_manager.h
+++ b/net/http/http_server_properties_manager.h
@@ -15,6 +15,7 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/time/default_tick_clock.h"
#include "base/timer/timer.h"
#include "base/values.h"
#include "net/base/host_port_pair.h"
@@ -24,6 +25,7 @@
namespace base {
class SingleThreadTaskRunner;
+class TickClock;
}
namespace net {
@@ -96,6 +98,7 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
PrefDelegate* pref_delegate,
scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner);
+
~HttpServerPropertiesManager() override;
// Initialize on Network thread.
@@ -166,6 +169,9 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
static base::TimeDelta GetUpdateCacheDelayForTesting();
static base::TimeDelta GetUpdatePrefsDelayForTesting();
+ // |clock| is unowned.
+ void SetTickClockForTesting(base::TickClock* clock);
+
protected:
// The location where ScheduleUpdatePrefsOnNetworkSequence was called.
// Must be kept up to date with HttpServerPropertiesUpdatePrefsLocation in
@@ -211,6 +217,10 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
IPAddress* last_quic_address,
ServerNetworkStatsMap* server_network_stats_map,
QuicServerInfoMap* quic_server_info_map,
+ std::unique_ptr<BrokenAlternativeServiceList>
+ broken_alternative_service_list,
+ std::unique_ptr<RecentlyBrokenAlternativeServices>
+ recently_broken_alternative_services,
bool detected_corrupted_prefs);
// These are used to delay updating the preferences when cached data in
@@ -232,12 +242,15 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
// Update prefs::kHttpServerProperties preferences on pref thread. Executes an
// optional |completion| callback when finished. Protected for testing.
- void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list,
- AlternativeServiceMap* alternative_service_map,
- IPAddress* last_quic_address,
- ServerNetworkStatsMap* server_network_stats_map,
- QuicServerInfoMap* quic_server_info_map,
- const base::Closure& completion);
+ void UpdatePrefsOnPrefThread(
+ base::ListValue* spdy_server_list,
+ AlternativeServiceMap* alternative_service_map,
+ IPAddress* last_quic_address,
+ ServerNetworkStatsMap* server_network_stats_map,
+ QuicServerInfoMap* quic_server_info_map,
+ BrokenAlternativeServiceList* broken_alternative_service_list,
+ RecentlyBrokenAlternativeServices* recently_broken_alternative_services,
+ const base::Closure& completion);
private:
typedef std::vector<std::string> ServerList;
@@ -270,6 +283,13 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
ServerNetworkStatsMap* network_stats_map);
bool AddToQuicServerInfoMap(const base::DictionaryValue& server_dict,
QuicServerInfoMap* quic_server_info_map);
+ bool ExtractBrokenAlternativeServiceData(
+ const base::DictionaryValue* broken_alternative_service_dict,
+ AlternativeService* alternative_service,
+ base::TimeTicks* expiration_time_ticks);
+ bool AddRecentlyBrokenAlternativeServiceData(
+ const base::DictionaryValue* recently_broken_alternative_service_dict,
+ RecentlyBrokenAlternativeServices* recently_broken_alternative_services);
void SaveAlternativeServiceToServerPrefs(
const AlternativeServiceInfoVector* alternative_service_info_vector,
@@ -283,6 +303,13 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
void SaveQuicServerInfoMapToServerPrefs(
QuicServerInfoMap* quic_server_info_map,
base::DictionaryValue* http_server_properties_dict);
+ void SaveBrokenAlternativeServiceListToPrefs(
+ const BrokenAlternativeServiceList* broken_alternative_service_list,
+ base::DictionaryValue* http_server_properties_dict);
+ void SaveRecentlyBrokenAlternativeServicesToPrefs(
+ const RecentlyBrokenAlternativeServices*
+ recently_broken_alternative_services,
+ base::DictionaryValue* http_server_properties_dict);
void SetInitialized();
// -----------
@@ -299,6 +326,9 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
std::unique_ptr<PrefDelegate> pref_delegate_;
bool setting_prefs_;
+ base::TickClock* clock_; // Unowned if not pointing to |default_clock_|.
+ base::DefaultTickClock default_clock_;
+
// --------------
// Network thread
// --------------

Powered by Google App Engine
This is Rietveld 408576698