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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_manager.cc
diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc
index 4d364b6699a72a3a548a27c8b19a8a8f81370654..9a94d69bb043295a072d38690ed77bf67e2f1b9c 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -779,8 +779,10 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread(
void HttpServerPropertiesManager::ScheduleUpdatePrefsOnNetworkThread(
Location location) {
DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
- // Cancel pending updates, if any.
- network_prefs_update_timer_->Stop();
+ // Cancel the new update if there's one scheduled already.
Ryan Hamilton 2016/12/06 22:24:15 This comment might be clearer if it were: // Do n
+ if (network_prefs_update_timer_->IsRunning())
+ return;
+
StartPrefsUpdateTimerOnNetworkThread(
base::TimeDelta::FromMilliseconds(kUpdatePrefsDelayMs));
// TODO(rtenneti): Delete the following histogram after collecting some data.
@@ -1029,6 +1031,10 @@ void HttpServerPropertiesManager::UpdatePrefsOnPrefThread(
// happen, pretty soon, and even in the case we shut down immediately.
if (!completion.is_null())
completion.Run();
+
+ // Reset the update timer if it's still running.
+ if (network_prefs_update_timer_->IsRunning())
+ network_prefs_update_timer_->Stop();
Ryan Hamilton 2016/12/06 22:24:15 I don't' think this is thread safe since this time
}
void HttpServerPropertiesManager::SaveAlternativeServiceToServerPrefs(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698