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

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

Issue 1143503005: Fix Data Saver test in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 50a303cf7849faa3f32a8787cafbe931c7e41573..c3794be724dd0e8bda54b071f7558626fe880a6c 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
@@ -166,6 +166,10 @@ void DataReductionProxyIOData::SetDataReductionProxyService(
// Using base::Unretained is safe here, unless the browser is being shut down
// before the Initialize task can be executed. The task is only created as
// part of class initialization.
+ if (io_task_runner_->BelongsToCurrentThread()) {
mmenke 2015/05/15 15:37:46 In the DRP's unit tests...Are the threads the same
bengr 2015/05/15 19:30:21 They're on the same thread. Agreed that we should
+ InitializeOnIOThread();
+ return;
+ }
io_task_runner_->PostTask(
FROM_HERE,
base::Bind(&DataReductionProxyIOData::InitializeOnIOThread,
@@ -177,6 +181,10 @@ void DataReductionProxyIOData::InitializeOnIOThread() {
config_->InitializeOnIOThread(basic_url_request_context_getter_.get());
if (config_client_.get())
config_client_->InitializeOnIOThread(url_request_context_getter_);
+ if (ui_task_runner_->BelongsToCurrentThread()) {
+ service_->SetIOData(weak_factory_.GetWeakPtr());
+ return;
+ }
ui_task_runner_->PostTask(
FROM_HERE,
base::Bind(&DataReductionProxyService::SetIOData,

Powered by Google App Engine
This is Rietveld 408576698