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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.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_usage_stats.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
index 84b14dbc45465ad8a688705754f15ec91765a9fc..6395b8a68dbda37d4076accae4ea6833fd1c920d 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
@@ -11,8 +11,6 @@
#include "base/prefs/pref_member.h"
#include "base/single_thread_task_runner.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.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_tamper_detection.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
@@ -106,10 +104,10 @@ void DataReductionProxyUsageStats::DetectAndRecordMissingViaHeaderResponseCode(
DataReductionProxyUsageStats::DataReductionProxyUsageStats(
DataReductionProxyConfig* config,
- base::WeakPtr<DataReductionProxyService> service,
+ UnreachableCallback unreachable_callback,
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner)
: data_reduction_proxy_config_(config),
- service_(service),
+ unreachable_callback_(unreachable_callback),
last_bypass_type_(BYPASS_EVENT_TYPE_MAX),
triggering_request_(true),
ui_task_runner_(ui_task_runner),
@@ -387,8 +385,7 @@ void DataReductionProxyUsageStats::NotifyUnavailabilityIfChanged() {
void DataReductionProxyUsageStats::NotifyUnavailabilityOnUIThread(
bool unavailable) {
DCHECK(ui_task_runner_->BelongsToCurrentThread());
- if (service_)
- service_->settings()->SetUnreachable(unavailable);
+ unreachable_callback_.Run(unavailable);
}
void DataReductionProxyUsageStats::RecordBypassedBytes(

Powered by Google App Engine
This is Rietveld 408576698