| Index: chrome/browser/net/http_server_properties_manager.cc
|
| diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc
|
| index 02a173fab5ab6869ec21a7ab2285af792beaa6aa..461a1d9e4a03ff183b20b5e513654b8f22051e47 100644
|
| --- a/chrome/browser/net/http_server_properties_manager.cc
|
| +++ b/chrome/browser/net/http_server_properties_manager.cc
|
| @@ -91,11 +91,16 @@ void HttpServerPropertiesManager::RegisterPrefs(PrefService* prefs) {
|
| PrefService::UNSYNCABLE_PREF);
|
| }
|
|
|
| +// This is required for conformance with the HttpServerProperties interface.
|
| void HttpServerPropertiesManager::Clear() {
|
| + Clear(base::Closure());
|
| +}
|
| +
|
| +void HttpServerPropertiesManager::Clear(const base::Closure& completion) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
|
|
| http_server_properties_impl_->Clear();
|
| - ScheduleUpdatePrefsOnIO();
|
| + UpdatePrefsFromCacheOnIO(completion);
|
| }
|
|
|
| bool HttpServerPropertiesManager::SupportsSpdy(
|
| @@ -441,7 +446,13 @@ void HttpServerPropertiesManager::StartPrefsUpdateTimerOnIO(
|
| &HttpServerPropertiesManager::UpdatePrefsFromCacheOnIO);
|
| }
|
|
|
| +// This is required so we can set this as the callback for a timer.
|
| void HttpServerPropertiesManager::UpdatePrefsFromCacheOnIO() {
|
| + UpdatePrefsFromCacheOnIO(base::Closure());
|
| +}
|
| +
|
| +void HttpServerPropertiesManager::UpdatePrefsFromCacheOnIO(
|
| + const base::Closure& completion) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
|
|
| base::ListValue* spdy_server_list = new base::ListValue;
|
| @@ -469,7 +480,8 @@ void HttpServerPropertiesManager::UpdatePrefsFromCacheOnIO() {
|
| base::Owned(spdy_server_list),
|
| base::Owned(spdy_settings_map),
|
| base::Owned(alternate_protocol_map),
|
| - base::Owned(pipeline_capability_map)));
|
| + base::Owned(pipeline_capability_map),
|
| + completion));
|
| }
|
|
|
| // A local or temporary data structure to hold |supports_spdy|, SpdySettings,
|
| @@ -500,7 +512,8 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI(
|
| base::ListValue* spdy_server_list,
|
| net::SpdySettingsMap* spdy_settings_map,
|
| net::AlternateProtocolMap* alternate_protocol_map,
|
| - net::PipelineCapabilityMap* pipeline_capability_map) {
|
| + net::PipelineCapabilityMap* pipeline_capability_map,
|
| + const base::Closure& completion) {
|
|
|
| typedef std::map<net::HostPortPair, ServerPref> ServerPrefMap;
|
| ServerPrefMap server_pref_map;
|
| @@ -634,6 +647,13 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI(
|
| pref_service_->Set(prefs::kHttpServerProperties,
|
| http_server_properties_dict);
|
| setting_prefs_ = false;
|
| +
|
| + // Note that |completion| will be fired after we have written everything to
|
| + // the Preferences, but likely before these changes are serialized to disk.
|
| + // This is not a problem though, as JSONPrefStore guarantees that this will
|
| + // happen, pretty soon, and even in the case we shut down immediately.
|
| + if (!completion.is_null())
|
| + completion.Run();
|
| }
|
|
|
| void HttpServerPropertiesManager::OnPreferenceChanged(
|
|
|