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 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( |