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

Unified Diff: net/http/broken_alternative_services.cc

Issue 2932953002: Persist broken and recently-broken alt-svcs to prefs in HttpServerPropertiesManager (Closed)
Patch Set: Fixed rch's comments from PS14 Created 3 years, 5 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/broken_alternative_services.cc
diff --git a/net/http/broken_alternative_services.cc b/net/http/broken_alternative_services.cc
index 5e2d88d387193362f3bcb9c82fed3b8e3ced1061..5b32252896729f49a525a2a46f93293cbecb52dc 100644
--- a/net/http/broken_alternative_services.cc
+++ b/net/http/broken_alternative_services.cc
@@ -114,16 +114,6 @@ void BrokenAlternativeServices::ConfirmAlternativeService(
}
}
-const BrokenAlternativeServiceList&
-BrokenAlternativeServices::broken_alternative_service_list() const {
- return broken_alternative_service_list_;
-}
-
-const RecentlyBrokenAlternativeServices&
-BrokenAlternativeServices::recently_broken_alternative_services() const {
- return recently_broken_alternative_services_;
-}
-
void BrokenAlternativeServices::SetBrokenAndRecentlyBrokenAlternativeServices(
std::unique_ptr<BrokenAlternativeServiceList>
broken_alternative_service_list,
@@ -177,13 +167,14 @@ void BrokenAlternativeServices::SetBrokenAndRecentlyBrokenAlternativeServices(
}
}
- // Merge |broken_alternative_service_list| with
- // |broken_alternative_service_list_|. Both should already be sorted by
- // expiration time. std::list::merge() will not invalidate any iterators
- // of either list, so all iterators in |broken_alternative_service_map_|
- // remain valid.
- broken_alternative_service_list_.merge(
- *broken_alternative_service_list,
+ // Append |broken_alternative_service_list| to
+ // |broken_alternative_service_list_|, then sort the resulting list.
+ // Neither operations will invalidate any iterators of either list,
+ // so all iterators in |broken_alternative_service_map_| remain valid.
+ broken_alternative_service_list_.splice(
+ broken_alternative_service_list_.end(), *broken_alternative_service_list);
+
+ broken_alternative_service_list_.sort(
[](const std::pair<AlternativeService, base::TimeTicks>& lhs,
const std::pair<AlternativeService, base::TimeTicks>& rhs) -> bool {
return lhs.second < rhs.second;
@@ -198,6 +189,16 @@ void BrokenAlternativeServices::SetBrokenAndRecentlyBrokenAlternativeServices(
ScheduleBrokenAlternateProtocolMappingsExpiration();
}
+const BrokenAlternativeServiceList&
+BrokenAlternativeServices::broken_alternative_service_list() const {
+ return broken_alternative_service_list_;
+}
+
+const RecentlyBrokenAlternativeServices&
+BrokenAlternativeServices::recently_broken_alternative_services() const {
+ return recently_broken_alternative_services_;
+}
+
bool BrokenAlternativeServices::AddToBrokenAlternativeServiceListAndMap(
const AlternativeService& alternative_service,
base::TimeTicks expiration,

Powered by Google App Engine
This is Rietveld 408576698