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

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

Issue 2554723003: Always persist data to disk after 60s from the receiving update request. (Closed)
Patch Set: rebase with upstream committed Created 4 years 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 <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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (detected_corrupted_prefs) 774 if (detected_corrupted_prefs)
775 ScheduleUpdatePrefsOnNetworkThread(DETECTED_CORRUPTED_PREFS); 775 ScheduleUpdatePrefsOnNetworkThread(DETECTED_CORRUPTED_PREFS);
776 } 776 }
777 777
778 // 778 //
779 // Update Preferences with data from the cached data. 779 // Update Preferences with data from the cached data.
780 // 780 //
781 void HttpServerPropertiesManager::ScheduleUpdatePrefsOnNetworkThread( 781 void HttpServerPropertiesManager::ScheduleUpdatePrefsOnNetworkThread(
782 Location location) { 782 Location location) {
783 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 783 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
784 // Cancel pending updates, if any. 784 // Do not schedule a new update if there is already one scheduled.
785 network_prefs_update_timer_->Stop(); 785 if (network_prefs_update_timer_->IsRunning())
786 return;
787
786 StartPrefsUpdateTimerOnNetworkThread( 788 StartPrefsUpdateTimerOnNetworkThread(
787 base::TimeDelta::FromMilliseconds(kUpdatePrefsDelayMs)); 789 base::TimeDelta::FromMilliseconds(kUpdatePrefsDelayMs));
788 // TODO(rtenneti): Delete the following histogram after collecting some data. 790 // TODO(rtenneti): Delete the following histogram after collecting some data.
789 UMA_HISTOGRAM_ENUMERATION("Net.HttpServerProperties.UpdatePrefs", location, 791 UMA_HISTOGRAM_ENUMERATION("Net.HttpServerProperties.UpdatePrefs", location,
790 HttpServerPropertiesManager::NUM_LOCATIONS); 792 HttpServerPropertiesManager::NUM_LOCATIONS);
791 } 793 }
792 794
793 void HttpServerPropertiesManager::StartPrefsUpdateTimerOnNetworkThread( 795 void HttpServerPropertiesManager::StartPrefsUpdateTimerOnNetworkThread(
794 base::TimeDelta delay) { 796 base::TimeDelta delay) {
795 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); 797 DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 quic_servers_dict); 1119 quic_servers_dict);
1118 } 1120 }
1119 1121
1120 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { 1122 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {
1121 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); 1123 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread());
1122 if (!setting_prefs_) 1124 if (!setting_prefs_)
1123 ScheduleUpdateCacheOnPrefThread(); 1125 ScheduleUpdateCacheOnPrefThread();
1124 } 1126 }
1125 1127
1126 } // namespace net 1128 } // 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