Make HttpServerProperties queue a write on pref load if needed.
After some of my refactors, if properties were learned before prefs
had been loaded, they would only be saved in response to other property
changes or on shutdown, which could hteoretically lead to never saving
them on Android, where we never shutdown cleanly.
Bug: 984996
Change-Id: Ica0ebaced0edcb8c2f83429a02000579317c2537
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726761
Commit-Queue: Matt Menke <[email protected]>
Reviewed-by: Zhongyi Shi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#683743}
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h
index 43005e7..29dfa03d 100644
--- a/net/http/http_server_properties.h
+++ b/net/http/http_server_properties.h
@@ -460,6 +460,11 @@
// |properties_manager_|. Always true if |properties_manager_| is nullptr.
bool is_initialized_;
+ // Queue a write when resources finish loading. Set to true when
+ // MaybeQueueWriteProperties() is invoked while still waiting on
+ // initialization to complete.
+ bool queue_write_on_load_;
+
// Used to load/save properties from/to preferences. May be nullptr.
std::unique_ptr<HttpServerPropertiesManager> properties_manager_;