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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc

Issue 1012923003: Fix race in DataReductionProxyService read/write. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr CR comment Created 5 years, 9 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
index 0d9c3288674ccc1a2bbee7abc4058b31aca25bf4..77161cfc7035494c11f574d05dfee79769c29d42 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
@@ -14,6 +14,8 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h"
@@ -104,11 +106,18 @@ DataReductionProxyIOData::CreateNetworkDelegate(
request_options_.get(), configurator_.get()));
if (track_proxy_bypass_statistics && !usage_stats_) {
usage_stats_.reset(new DataReductionProxyUsageStats(
- config_.get(), service_, ui_task_runner_));
+ config_.get(), base::Bind(&DataReductionProxyIOData::SetUnreachable,
+ base::Unretained(this)), ui_task_runner_));
network_delegate->InitIODataAndUMA(ui_task_runner_, this, &enabled_,
usage_stats_.get());
}
return network_delegate.Pass();
}
+void DataReductionProxyIOData::SetUnreachable(bool unreachable) {
+ DCHECK(ui_task_runner_->BelongsToCurrentThread());
+ if (service_)
+ service_->settings()->SetUnreachable(unreachable);
+}
+
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698