Skip to content

Commit

Permalink
Revert "Reland "Persist broken and recently-broken alt-svcs to prefs …
Browse files Browse the repository at this point in the history
…in HttpServerPropertiesManager""

This reverts commit 9c08370.

Reason for revert: This seems to have broken tests, sorry: https://uberchromegw.corp.google.com/i/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%281%29/builds/41713

Original change's description:
> Reland "Persist broken and recently-broken alt-svcs to prefs in HttpServerPropertiesManager"
> 
> This is a reland of a66ebc8
> Original change's description:
> > Persist broken and recently-broken alt-svcs to prefs in HttpServerPropertiesManager
> > 
> > Modify TickClock dependency injection for BrokenAlternativeServices to use a setter instead of a constructor param.
> > Add TickClock dependency injection for HttpServerPropertiesImpl and HttpServerPropertiesManager for testing.
> > 
> > Add BrokenAlternativeService::Clear() and update HttpServerPropertiesImpl::Clear() to call that.
> > 
> > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_ubsan_rel_ng
> > 
> > BUG=705029
> > 
> > Change-Id: Idb411192e47d275cde3362b479a6b9e9fa773a17
> > Reviewed-on: https://chromium-review.googlesource.com/562604
> > Reviewed-by: Zhongyi Shi <zhongyi@chromium.org>
> > Reviewed-by: Steven Holte <holte@chromium.org>
> > Commit-Queue: Yixin Wang <wangyix@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#486519}
> 
> Bug: 705029
> Change-Id: I14f36cc6014f001d9aefa4678a7bfa8f621b2834
> Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_ubsan_rel_ng
> Reviewed-on: https://chromium-review.googlesource.com/571044
> Reviewed-by: Zhongyi Shi <zhongyi@chromium.org>
> Reviewed-by: Steven Holte <holte@chromium.org>
> Commit-Queue: Yixin Wang <wangyix@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#487342}

TBR=holte@chromium.org,zhongyi@chromium.org,wangyix@chromium.org

Change-Id: Ieee4be83dbc33044c1b36361aa9541240c32b95b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 705029
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_ubsan_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/575311
Reviewed-by: Alice Boxhall <aboxhall@chromium.org>
Commit-Queue: Alice Boxhall <aboxhall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487373}
  • Loading branch information
Alice Boxhall authored and Commit Bot committed Jul 18, 2017
1 parent 51c2bff commit 5b3826e
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 858 deletions.
35 changes: 17 additions & 18 deletions net/http/broken_alternative_services.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ 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,
Expand Down Expand Up @@ -167,14 +177,13 @@ void BrokenAlternativeServices::SetBrokenAndRecentlyBrokenAlternativeServices(
}
}

// 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(
// 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,
[](const std::pair<AlternativeService, base::TimeTicks>& lhs,
const std::pair<AlternativeService, base::TimeTicks>& rhs) -> bool {
return lhs.second < rhs.second;
Expand All @@ -189,16 +198,6 @@ 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,
Expand Down
4 changes: 0 additions & 4 deletions net/http/broken_alternative_services.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ class NET_EXPORT_PRIVATE BrokenAlternativeServices {
// expiration time.
// All AlternativeServices in |broken_alternative_service_list| must exist in
// |recently_broken_alternative_services|.
//
// 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.
void SetBrokenAndRecentlyBrokenAlternativeServices(
std::unique_ptr<BrokenAlternativeServiceList>
broken_alternative_service_list,
Expand Down
7 changes: 0 additions & 7 deletions net/http/http_server_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ struct NET_EXPORT AlternativeService {
std::tie(other.protocol, other.host, other.port);
}

// Output format: "protocol host:port", e.g. "h2 www.google.com:1234".
std::string ToString() const;

NextProto protocol;
Expand All @@ -116,12 +115,6 @@ NET_EXPORT_PRIVATE std::ostream& operator<<(
std::ostream& os,
const AlternativeService& alternative_service);

struct AlternativeServiceHash {
size_t operator()(const net::AlternativeService& entry) const {
return entry.protocol ^ std::hash<std::string>()(entry.host) ^ entry.port;
}
};

class NET_EXPORT_PRIVATE AlternativeServiceInfo {
public:
static AlternativeServiceInfo CreateHttp2AlternativeServiceInfo(
Expand Down
36 changes: 10 additions & 26 deletions net/http/http_server_properties_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@

namespace net {

HttpServerPropertiesImpl::HttpServerPropertiesImpl(base::TickClock* clock)
: spdy_servers_map_(SpdyServersMap::NO_AUTO_EVICT),
HttpServerPropertiesImpl::HttpServerPropertiesImpl()
: HttpServerPropertiesImpl(nullptr) {}

HttpServerPropertiesImpl::HttpServerPropertiesImpl(
base::TickClock* broken_alternative_services_clock)
: broken_alternative_services_(this,
broken_alternative_services_clock
? broken_alternative_services_clock
: &broken_alternative_services_clock_),
spdy_servers_map_(SpdyServersMap::NO_AUTO_EVICT),
alternative_service_map_(AlternativeServiceMap::NO_AUTO_EVICT),
broken_alternative_services_(this, clock ? clock : &default_clock_),
server_network_stats_map_(ServerNetworkStatsMap::NO_AUTO_EVICT),
quic_server_info_map_(QuicServerInfoMap::NO_AUTO_EVICT),
max_server_configs_stored_in_properties_(kMaxQuicServersToPersist) {
Expand All @@ -33,9 +40,6 @@ HttpServerPropertiesImpl::HttpServerPropertiesImpl(base::TickClock* clock)
canonical_suffixes_.push_back(".googleusercontent.com");
}

HttpServerPropertiesImpl::HttpServerPropertiesImpl()
: HttpServerPropertiesImpl(nullptr) {}

HttpServerPropertiesImpl::~HttpServerPropertiesImpl() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
Expand Down Expand Up @@ -161,26 +165,6 @@ void HttpServerPropertiesImpl::GetSpdyServerList(
}
}

void HttpServerPropertiesImpl::SetBrokenAndRecentlyBrokenAlternativeServices(
std::unique_ptr<BrokenAlternativeServiceList>
broken_alternative_service_list,
std::unique_ptr<RecentlyBrokenAlternativeServices>
recently_broken_alternative_services) {
broken_alternative_services_.SetBrokenAndRecentlyBrokenAlternativeServices(
std::move(broken_alternative_service_list),
std::move(recently_broken_alternative_services));
}

const BrokenAlternativeServiceList&
HttpServerPropertiesImpl::broken_alternative_service_list() const {
return broken_alternative_services_.broken_alternative_service_list();
}

const RecentlyBrokenAlternativeServices&
HttpServerPropertiesImpl::recently_broken_alternative_services() const {
return broken_alternative_services_.recently_broken_alternative_services();
}

void HttpServerPropertiesImpl::Clear() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
spdy_servers_map_.Clear();
Expand Down
29 changes: 4 additions & 25 deletions net/http/http_server_properties_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,16 @@
#include "net/http/broken_alternative_services.h"
#include "net/http/http_server_properties.h"

namespace base {
class TickClock;
}

namespace net {

// The implementation for setting/retrieving the HTTP server properties.
class NET_EXPORT HttpServerPropertiesImpl
: public HttpServerProperties,
public BrokenAlternativeServices::Delegate {
public:
// |clock| is used for setting expiration times and scheduling the
// expiration of broken alternative services. If null, default clock will be
// used.
explicit HttpServerPropertiesImpl(base::TickClock* clock);

// Default clock will be used.
HttpServerPropertiesImpl();

explicit HttpServerPropertiesImpl(
base::TickClock* broken_alternative_services_clock);
~HttpServerPropertiesImpl() override;

// Sets |spdy_servers_map_| with the servers (host/port) from
Expand All @@ -67,17 +58,6 @@ class NET_EXPORT HttpServerPropertiesImpl
void GetSpdyServerList(std::vector<std::string>* spdy_servers,
size_t max_size) const;

void SetBrokenAndRecentlyBrokenAlternativeServices(
std::unique_ptr<BrokenAlternativeServiceList>
broken_alternative_service_list,
std::unique_ptr<RecentlyBrokenAlternativeServices>
recently_broken_alternative_services);

const BrokenAlternativeServiceList& broken_alternative_service_list() const;

const RecentlyBrokenAlternativeServices&
recently_broken_alternative_services() const;

// Returns flattened string representation of the |host_port_pair|. Used by
// unittests.
static std::string GetFlattenedSpdyServer(const HostPortPair& host_port_pair);
Expand Down Expand Up @@ -166,15 +146,14 @@ class NET_EXPORT HttpServerPropertiesImpl
// Remove the cononical host for |server|.
void RemoveCanonicalHost(const url::SchemeHostPort& server);

base::DefaultTickClock default_clock_;
base::DefaultTickClock broken_alternative_services_clock_;
BrokenAlternativeServices broken_alternative_services_;

SpdyServersMap spdy_servers_map_;
Http11ServerHostPortSet http11_servers_;

AlternativeServiceMap alternative_service_map_;

BrokenAlternativeServices broken_alternative_services_;

IPAddress last_quic_address_;
ServerNetworkStatsMap server_network_stats_map_;
// Contains a map of servers which could share the same alternate protocol.
Expand Down
Loading

0 comments on commit 5b3826e

Please sign in to comment.