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

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: Removed BrokenAlternativeServices::Clear() so it can be added in a separate CL 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..db8ffd10e60f56ce06b7211d6789240139b100d6 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 {
@@ -92,10 +94,21 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
// cache update to the pref thread;
// |network_task_runner| should be bound with the network thread and is used
// to post pref update to the cache thread.
+ //
+ // |clock| is used for setting expiration times and scheduling the
+ // expiration of broken alternative services. It must not be null.
+ HttpServerPropertiesManager(
+ PrefDelegate* pref_delegate,
+ scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ base::TickClock* clock);
+
+ // Default clock will be used.
HttpServerPropertiesManager(
PrefDelegate* pref_delegate,
scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner);
+
~HttpServerPropertiesManager() override;
// Initialize on Network thread.
@@ -211,6 +224,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,
Zhongyi Shi 2017/06/16 04:17:09 Can we just use raw pointers here? Is there any st
wangyix1 2017/06/16 18:41:15 Acknowledged.
bool detected_corrupted_prefs);
// These are used to delay updating the preferences when cached data in
@@ -232,12 +249,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 +290,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(
Zhongyi Shi 2017/06/16 04:17:09 nit: %s/ExtractBrokenAlternativeServiceData/AddToB
wangyix1 2017/06/16 18:41:15 Acknowledged.
+ const base::DictionaryValue* broken_alternative_service_dict,
+ AlternativeService* alternative_service,
+ base::TimeTicks* expiration_time_ticks);
+ bool AddRecentlyBrokenAlternativeServiceData(
Zhongyi Shi 2017/06/16 04:17:09 nit: %s/AddRecentlyBrokenAlternativeServiceData/Ad
wangyix1 2017/06/16 18:41:15 Done.
+ const base::DictionaryValue* recently_broken_alternative_service_dict,
+ RecentlyBrokenAlternativeServices* recently_broken_alternative_services);
void SaveAlternativeServiceToServerPrefs(
const AlternativeServiceInfoVector* alternative_service_info_vector,
@@ -283,8 +310,17 @@ 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();
+ base::DefaultTickClock default_clock_;
+
// -----------
// Pref thread
// -----------
@@ -299,6 +335,8 @@ class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties {
std::unique_ptr<PrefDelegate> pref_delegate_;
bool setting_prefs_;
+ base::TickClock* clock_; // Unowned
+
// --------------
// Network thread
// --------------

Powered by Google App Engine
This is Rietveld 408576698