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

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

Issue 1156513004: HttpServerProperties - Don't persist if ClearAlternativeService is (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void HttpServerPropertiesManager::ConfirmAlternativeService( 237 void HttpServerPropertiesManager::ConfirmAlternativeService(
238 const AlternativeService& alternative_service) { 238 const AlternativeService& alternative_service) {
239 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 239 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
240 http_server_properties_impl_->ConfirmAlternativeService(alternative_service); 240 http_server_properties_impl_->ConfirmAlternativeService(alternative_service);
241 ScheduleUpdatePrefsOnNetworkThread(CONFIRM_ALTERNATIVE_SERVICE); 241 ScheduleUpdatePrefsOnNetworkThread(CONFIRM_ALTERNATIVE_SERVICE);
242 } 242 }
243 243
244 void HttpServerPropertiesManager::ClearAlternativeService( 244 void HttpServerPropertiesManager::ClearAlternativeService(
245 const HostPortPair& origin) { 245 const HostPortPair& origin) {
246 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 246 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
247 const AlternativeServiceMap& map =
248 http_server_properties_impl_->alternative_service_map();
249 size_t old_size = map.size();
247 http_server_properties_impl_->ClearAlternativeService(origin); 250 http_server_properties_impl_->ClearAlternativeService(origin);
248 ScheduleUpdatePrefsOnNetworkThread(CLEAR_ALTERNATIVE_SERVICE); 251 size_t new_size = map.size();
252 // Persist only if we have deleted an entry.
253 if (old_size != new_size)
254 ScheduleUpdatePrefsOnNetworkThread(CLEAR_ALTERNATIVE_SERVICE);
249 } 255 }
250 256
251 const AlternativeServiceMap& 257 const AlternativeServiceMap&
252 HttpServerPropertiesManager::alternative_service_map() const { 258 HttpServerPropertiesManager::alternative_service_map() const {
253 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 259 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
254 return http_server_properties_impl_->alternative_service_map(); 260 return http_server_properties_impl_->alternative_service_map();
255 } 261 }
256 262
257 base::Value* HttpServerPropertiesManager::GetAlternativeServiceInfoAsValue() 263 base::Value* HttpServerPropertiesManager::GetAlternativeServiceInfoAsValue()
258 const { 264 const {
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 server_network_stats_dict); 962 server_network_stats_dict);
957 } 963 }
958 964
959 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { 965 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {
960 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); 966 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread());
961 if (!setting_prefs_) 967 if (!setting_prefs_)
962 ScheduleUpdateCacheOnPrefThread(); 968 ScheduleUpdateCacheOnPrefThread();
963 } 969 }
964 970
965 } // namespace net 971 } // 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