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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 2932503005: Change AlternativeServiceInfo to a class (Closed)
Patch Set: 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
« no previous file with comments | « net/http/http_server_properties.cc ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_impl.cc
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index a02cf7869cddd51ffb5310f1d485abae00ecdcfc..010da33db75700aeebb3ae70047b6c545898857a 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -219,7 +219,7 @@ bool HttpServerPropertiesImpl::SupportsRequestPriority(
GetAlternativeServiceInfos(server);
for (const AlternativeServiceInfo& alternative_service_info :
alternative_service_info_vector) {
- if (alternative_service_info.alternative_service.protocol == kProtoQUIC) {
+ if (alternative_service_info.alternative_service().protocol == kProtoQUIC) {
return true;
}
}
@@ -304,11 +304,11 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos(
HostPortPair host_port_pair(origin.host(), origin.port());
for (AlternativeServiceInfoVector::iterator it = map_it->second.begin();
it != map_it->second.end();) {
- if (it->expiration < now) {
+ if (it->expiration() < now) {
it = map_it->second.erase(it);
continue;
}
- AlternativeService alternative_service(it->alternative_service);
+ AlternativeService alternative_service(it->alternative_service());
if (alternative_service.host.empty()) {
alternative_service.host = origin.host();
}
@@ -320,7 +320,7 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos(
continue;
}
valid_alternative_service_infos.push_back(
- AlternativeServiceInfo(alternative_service, it->expiration));
+ AlternativeServiceInfo(alternative_service, it->expiration()));
++it;
}
if (map_it->second.empty()) {
@@ -339,11 +339,11 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos(
}
for (AlternativeServiceInfoVector::iterator it = map_it->second.begin();
it != map_it->second.end();) {
- if (it->expiration < now) {
+ if (it->expiration() < now) {
it = map_it->second.erase(it);
continue;
}
- AlternativeService alternative_service(it->alternative_service);
+ AlternativeService alternative_service(it->alternative_service());
if (alternative_service.host.empty()) {
alternative_service.host = canonical->second.host();
if (IsAlternativeServiceBroken(alternative_service)) {
@@ -356,7 +356,7 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos(
continue;
}
valid_alternative_service_infos.push_back(
- AlternativeServiceInfo(alternative_service, it->expiration));
+ AlternativeServiceInfo(alternative_service, it->expiration()));
++it;
}
if (map_it->second.empty()) {
@@ -399,14 +399,14 @@ bool HttpServerPropertiesImpl::SetAlternativeServices(
for (const auto& old : it->second) {
// Persist to disk immediately if new entry has different scheme, host,
// or port.
- if (old.alternative_service != new_it->alternative_service) {
+ if (old.alternative_service() != new_it->alternative_service()) {
changed = true;
break;
}
// Also persist to disk if new expiration it more that twice as far or
// less than half as far in the future.
- base::Time old_time = old.expiration;
- base::Time new_time = new_it->expiration;
+ base::Time old_time = old.expiration();
+ base::Time new_time = new_it->expiration();
if (new_time - now > 2 * (old_time - now) ||
2 * (new_time - now) < (old_time - now)) {
changed = true;
@@ -491,7 +491,7 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() const {
std::string alternative_service_string(
alternative_service_info.ToString());
AlternativeService alternative_service(
- alternative_service_info.alternative_service);
+ alternative_service_info.alternative_service());
if (alternative_service.host.empty()) {
alternative_service.host = server.host();
}
@@ -627,7 +627,7 @@ HttpServerPropertiesImpl::GetAlternateProtocolIterator(
for (const AlternativeServiceInfo& alternative_service_info : it->second) {
AlternativeService alternative_service(
- alternative_service_info.alternative_service);
+ alternative_service_info.alternative_service());
if (alternative_service.host.empty()) {
alternative_service.host = canonical_server.host();
}
@@ -674,7 +674,7 @@ void HttpServerPropertiesImpl::OnExpireBrokenAlternativeService(
map_it != alternative_service_map_.end();) {
for (AlternativeServiceInfoVector::iterator it = map_it->second.begin();
it != map_it->second.end();) {
- AlternativeService alternative_service(it->alternative_service);
+ AlternativeService alternative_service(it->alternative_service());
// Empty hostname in map means hostname of key: substitute before
// comparing to |expired_alternative_service|.
if (alternative_service.host.empty()) {
« no previous file with comments | « net/http/http_server_properties.cc ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698