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

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

Issue 1142413004: HttpServerProperties - Don't persist if ConfirmAlternativeService is (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/http/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 bool HttpServerPropertiesManager::WasAlternativeServiceRecentlyBroken( 238 bool HttpServerPropertiesManager::WasAlternativeServiceRecentlyBroken(
239 const AlternativeService& alternative_service) { 239 const AlternativeService& alternative_service) {
240 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 240 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
241 return http_server_properties_impl_->WasAlternativeServiceRecentlyBroken( 241 return http_server_properties_impl_->WasAlternativeServiceRecentlyBroken(
242 alternative_service); 242 alternative_service);
243 } 243 }
244 244
245 void HttpServerPropertiesManager::ConfirmAlternativeService( 245 void HttpServerPropertiesManager::ConfirmAlternativeService(
246 const AlternativeService& alternative_service) { 246 const AlternativeService& alternative_service) {
247 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 247 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
248 bool old_value = http_server_properties_impl_->IsAlternativeServiceBroken(
249 alternative_service);
248 http_server_properties_impl_->ConfirmAlternativeService(alternative_service); 250 http_server_properties_impl_->ConfirmAlternativeService(alternative_service);
249 ScheduleUpdatePrefsOnNetworkThread(CONFIRM_ALTERNATIVE_SERVICE); 251 bool new_value = http_server_properties_impl_->IsAlternativeServiceBroken(
252 alternative_service);
253 // For persisting, we only care about the value returned by
254 // IsAlternativeServiceBroken. If that value changes, then call persist.
255 if (old_value != new_value)
256 ScheduleUpdatePrefsOnNetworkThread(CONFIRM_ALTERNATIVE_SERVICE);
250 } 257 }
251 258
252 void HttpServerPropertiesManager::ClearAlternativeService( 259 void HttpServerPropertiesManager::ClearAlternativeService(
253 const HostPortPair& origin) { 260 const HostPortPair& origin) {
254 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 261 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
255 const AlternativeServiceMap& map = 262 const AlternativeServiceMap& map =
256 http_server_properties_impl_->alternative_service_map(); 263 http_server_properties_impl_->alternative_service_map();
257 size_t old_size = map.size(); 264 size_t old_size = map.size();
258 http_server_properties_impl_->ClearAlternativeService(origin); 265 http_server_properties_impl_->ClearAlternativeService(origin);
259 size_t new_size = map.size(); 266 size_t new_size = map.size();
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 server_network_stats_dict); 978 server_network_stats_dict);
972 } 979 }
973 980
974 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { 981 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {
975 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); 982 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread());
976 if (!setting_prefs_) 983 if (!setting_prefs_)
977 ScheduleUpdateCacheOnPrefThread(); 984 ScheduleUpdateCacheOnPrefThread();
978 } 985 }
979 986
980 } // namespace net 987 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698