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

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

Issue 1054363002: Update DataReductionProxyNetworkDelegate/BypassStats to post tasks safely. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr CR comments Created 5 years, 8 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_service.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc
index b4ec8e351b339ef91d94478cdcafc1fc13c26dd6..326d92a5f3ca6eb9fcc9ce706ef662c9ea0ad8cb 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc
@@ -6,6 +6,7 @@
#include "base/sequenced_task_runner.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"
@@ -35,11 +36,30 @@ void DataReductionProxyService::EnableCompressionStatisticsLogging(
PrefService* prefs,
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
const base::TimeDelta& commit_delay) {
+ DCHECK(CalledOnValidThread());
DCHECK(!compression_stats_);
compression_stats_.reset(new DataReductionProxyCompressionStats(
prefs, ui_task_runner, commit_delay));
}
+void DataReductionProxyService::UpdateContentLengths(
+ int received_content_length,
+ int original_content_length,
+ bool data_reduction_proxy_enabled,
+ DataReductionProxyRequestType request_type) {
+ DCHECK(CalledOnValidThread());
+ if (compression_stats_) {
+ compression_stats_->UpdateContentLengths(
+ received_content_length, original_content_length,
+ data_reduction_proxy_enabled, request_type);
+ }
+}
+
+void DataReductionProxyService::SetUnreachable(bool unreachable) {
+ DCHECK(CalledOnValidThread());
+ settings_->SetUnreachable(unreachable);
+}
+
base::WeakPtr<DataReductionProxyService>
DataReductionProxyService::GetWeakPtr() {
DCHECK(CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698