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

Side by Side Diff: net/http/http_server_properties_manager.cc

Issue 2901093004: Add and persist a new field in AlternativeServiceInfo to list QUIC verisons advertised (Closed)
Patch Set: self review Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_server_properties_manager.h" 5 #include "net/http/http_server_properties_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 AlternativeServiceInfoVector 194 AlternativeServiceInfoVector
195 HttpServerPropertiesManager::GetAlternativeServiceInfos( 195 HttpServerPropertiesManager::GetAlternativeServiceInfos(
196 const url::SchemeHostPort& origin) { 196 const url::SchemeHostPort& origin) {
197 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 197 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
198 return http_server_properties_impl_->GetAlternativeServiceInfos(origin); 198 return http_server_properties_impl_->GetAlternativeServiceInfos(origin);
199 } 199 }
200 200
201 bool HttpServerPropertiesManager::SetAlternativeService( 201 bool HttpServerPropertiesManager::SetAlternativeService(
202 const url::SchemeHostPort& origin, 202 const url::SchemeHostPort& origin,
203 const AlternativeService& alternative_service, 203 const AlternativeService& alternative_service,
204 base::Time expiration) { 204 base::Time expiration,
205 const QuicVersionVector& advertised_versions) {
205 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 206 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
206 const bool changed = http_server_properties_impl_->SetAlternativeService( 207 const bool changed = http_server_properties_impl_->SetAlternativeService(
207 origin, alternative_service, expiration); 208 origin, alternative_service, expiration, advertised_versions);
208 if (changed) { 209 if (changed) {
209 ScheduleUpdatePrefsOnNetworkThread(SET_ALTERNATIVE_SERVICES); 210 ScheduleUpdatePrefsOnNetworkThread(SET_ALTERNATIVE_SERVICES);
210 } 211 }
211 return changed; 212 return changed;
212 } 213 }
213 214
214 bool HttpServerPropertiesManager::SetAlternativeServices( 215 bool HttpServerPropertiesManager::SetAlternativeServices(
215 const url::SchemeHostPort& origin, 216 const url::SchemeHostPort& origin,
216 const AlternativeServiceInfoVector& alternative_service_info_vector) { 217 const AlternativeServiceInfoVector& alternative_service_info_vector) {
217 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 218 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 if (!base::StringToInt64(expiration_string, &expiration_int64)) { 623 if (!base::StringToInt64(expiration_string, &expiration_int64)) {
623 DVLOG(1) << "Malformed alternative service expiration for server: " 624 DVLOG(1) << "Malformed alternative service expiration for server: "
624 << server_str; 625 << server_str;
625 return false; 626 return false;
626 } 627 }
627 alternative_service_info->expiration = 628 alternative_service_info->expiration =
628 base::Time::FromInternalValue(expiration_int64); 629 base::Time::FromInternalValue(expiration_int64);
629 return true; 630 return true;
630 } 631 }
631 632
633 // TODO(zhongyi): add support for reading advertised versions to
634 // AlternativeServiceInfo.
635
632 DVLOG(1) << "Malformed alternative service expiration for server: " 636 DVLOG(1) << "Malformed alternative service expiration for server: "
633 << server_str; 637 << server_str;
634 return false; 638 return false;
635 } 639 }
636 640
637 bool HttpServerPropertiesManager::AddToAlternativeServiceMap( 641 bool HttpServerPropertiesManager::AddToAlternativeServiceMap(
638 const url::SchemeHostPort& server, 642 const url::SchemeHostPort& server,
639 const base::DictionaryValue& server_pref_dict, 643 const base::DictionaryValue& server_pref_dict,
640 AlternativeServiceMap* alternative_service_map) { 644 AlternativeServiceMap* alternative_service_map) {
641 DCHECK(alternative_service_map->Peek(server) == 645 DCHECK(alternative_service_map->Peek(server) ==
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 if (!setting_prefs_) 1151 if (!setting_prefs_)
1148 ScheduleUpdateCacheOnPrefThread(); 1152 ScheduleUpdateCacheOnPrefThread();
1149 } 1153 }
1150 1154
1151 void HttpServerPropertiesManager::SetInitialized() { 1155 void HttpServerPropertiesManager::SetInitialized() {
1152 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 1156 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
1153 is_initialized_ = true; 1157 is_initialized_ = true;
1154 } 1158 }
1155 1159
1156 } // namespace net 1160 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698