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

Unified Diff: net/http/http_server_properties_manager.cc

Issue 1158823005: HttpServerProperties - Don't persist if SetServerNetworkStats is called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_http_props
Patch Set: Rebase and fix valgrind error Created 5 years, 6 months 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 | « net/http/http_server_properties.h ('k') | net/http/http_server_properties_manager_unittest.cc » ('j') | 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 1a1ab79c48648509c3619fdd757476d62cb5a86c..9d3a0f7b4c1a5b746490c813804cc8b6594a2127 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -338,8 +338,16 @@ void HttpServerPropertiesManager::SetServerNetworkStats(
const HostPortPair& host_port_pair,
ServerNetworkStats stats) {
DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
+ ServerNetworkStats old_stats;
+ const ServerNetworkStats* old_stats_ptr =
+ http_server_properties_impl_->GetServerNetworkStats(host_port_pair);
+ if (http_server_properties_impl_->GetServerNetworkStats(host_port_pair))
+ old_stats = *old_stats_ptr;
http_server_properties_impl_->SetServerNetworkStats(host_port_pair, stats);
- ScheduleUpdatePrefsOnNetworkThread(SET_SERVER_NETWORK_STATS);
+ ServerNetworkStats new_stats =
+ *(http_server_properties_impl_->GetServerNetworkStats(host_port_pair));
+ if (old_stats != new_stats)
+ ScheduleUpdatePrefsOnNetworkThread(SET_SERVER_NETWORK_STATS);
}
const ServerNetworkStats* HttpServerPropertiesManager::GetServerNetworkStats(
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/http/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698