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

Unified Diff: chrome/browser/component_updater/crx_downloader.cc

Issue 385013002: Componentize component_updater: Replace content::BrowserThread usage with task runners (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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: chrome/browser/component_updater/crx_downloader.cc
diff --git a/chrome/browser/component_updater/crx_downloader.cc b/chrome/browser/component_updater/crx_downloader.cc
index a70211ae35551a8ea2c32bbcd1c624103cdd3b39..1411f3d3533be6fbbd6c335f0a7f40bf3b3b41ac 100644
--- a/chrome/browser/component_updater/crx_downloader.cc
+++ b/chrome/browser/component_updater/crx_downloader.cc
@@ -2,16 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/sequenced_task_runner.h"
+#include "base/single_thread_task_runner.h"
#include "chrome/browser/component_updater/crx_downloader.h"
Sorin Jianu 2014/07/21 21:42:14 crx_downloader.h must be the first header to inclu
tommycli 2014/07/21 22:00:07 Done.
#include "chrome/browser/component_updater/url_fetcher_downloader.h"
-#include "content/public/browser/browser_thread.h"
#if defined(OS_WIN)
#include "chrome/browser/component_updater/background_downloader_win.h"
#endif
-using content::BrowserThread;
-
namespace component_updater {
CrxDownloader::Result::Result()
@@ -31,16 +30,17 @@ CrxDownloader::DownloadMetrics::DownloadMetrics()
CrxDownloader* CrxDownloader::Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
- scoped_refptr<base::SequencedTaskRunner> task_runner) {
+ scoped_refptr<base::SequencedTaskRunner> url_fetcher_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> background_task_runner) {
scoped_ptr<CrxDownloader> url_fetcher_downloader(
new UrlFetcherDownloader(scoped_ptr<CrxDownloader>().Pass(),
context_getter,
- task_runner));
+ url_fetcher_task_runner));
#if defined(OS_WIN)
if (is_background_download) {
return new BackgroundDownloader(url_fetcher_downloader.Pass(),
context_getter,
- task_runner);
+ background_task_runner);
}
#endif
@@ -49,7 +49,6 @@ CrxDownloader* CrxDownloader::Create(
CrxDownloader::CrxDownloader(scoped_ptr<CrxDownloader> successor)
: successor_(successor.Pass()) {
Sorin Jianu 2014/07/21 21:42:13 Maybe keep the thread checker assert.
tommycli 2014/07/21 22:00:07 Would always pass.
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
CrxDownloader::~CrxDownloader() {
@@ -85,7 +84,7 @@ void CrxDownloader::StartDownloadFromUrl(
void CrxDownloader::StartDownload(const std::vector<GURL>& urls,
const DownloadCallback& download_callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(thread_checker_.CalledOnValidThread());
if (urls.empty()) {
// Make a result and complete the download with a generic error for now.
@@ -110,7 +109,7 @@ void CrxDownloader::OnDownloadComplete(
bool is_handled,
const Result& result,
const DownloadMetrics& download_metrics) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(thread_checker_.CalledOnValidThread());
download_metrics_.push_back(download_metrics);
@@ -147,7 +146,7 @@ void CrxDownloader::OnDownloadComplete(
}
void CrxDownloader::OnDownloadProgress(const Result& result) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(thread_checker_.CalledOnValidThread());
if (progress_callback_.is_null())
return;

Powered by Google App Engine
This is Rietveld 408576698