Chromium Code Reviews| 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 e8fac4a0438f38609738b2bfbff39aafa051e638..dfcd04e6c7b3b1d0180a5063a62e9e608a8ef13b 100644 |
| --- a/net/http/http_server_properties_manager.cc |
| +++ b/net/http/http_server_properties_manager.cc |
| @@ -23,13 +23,13 @@ namespace net { |
| namespace { |
| // Time to wait before starting an update the http_server_properties_impl_ cache |
| -// from preferences. Scheduling another update during this period will reset the |
| -// timer. |
| +// from preferences. Scheduling another update during this period will be a |
| +// no-op. |
| const int64_t kUpdateCacheDelayMs = 1000; |
|
xunjieli
2016/12/20 14:00:27
nit: The delay is 1s. Could you edit the CL descri
Zhongyi Shi
2016/12/20 20:03:38
Done.
Ryan Hamilton
2016/12/20 20:38:38
Confirming: we update net from prefs once a second
|
| // Time to wait before starting an update the preferences from the |
| // http_server_properties_impl_ cache. Scheduling another update during this |
| -// period will reset the timer. |
| +// period will be a no-op. |
| const int64_t kUpdatePrefsDelayMs = 60000; |
| // "version" 0 indicates, http_server_properties doesn't have "version" |
| @@ -357,8 +357,10 @@ void HttpServerPropertiesManager::SetMaxServerConfigsStoredInProperties( |
| // |
| void HttpServerPropertiesManager::ScheduleUpdateCacheOnPrefThread() { |
| DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| - // Cancel pending updates, if any. |
| - pref_cache_update_timer_->Stop(); |
| + // Do not schedule a new update if there is already one scheduled. |
| + if (pref_cache_update_timer_->IsRunning()) |
| + return; |
| + |
| StartCacheUpdateTimerOnPrefThread( |
| base::TimeDelta::FromMilliseconds(kUpdateCacheDelayMs)); |
| } |