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

Unified Diff: chrome/browser/component_updater/url_fetcher_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/url_fetcher_downloader.cc
diff --git a/chrome/browser/component_updater/url_fetcher_downloader.cc b/chrome/browser/component_updater/url_fetcher_downloader.cc
index ed00523f8376a65d61227a6e654e4dff133f64ec..94fa4f2f2ccd1b8b9c36feb188ab3e2a7c3515d7 100644
--- a/chrome/browser/component_updater/url_fetcher_downloader.cc
+++ b/chrome/browser/component_updater/url_fetcher_downloader.cc
@@ -5,14 +5,12 @@
#include "chrome/browser/component_updater/url_fetcher_downloader.h"
#include "base/logging.h"
+#include "base/sequenced_task_runner.h"
#include "chrome/browser/component_updater/component_updater_utils.h"
-#include "content/public/browser/browser_thread.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_fetcher.h"
#include "url/gurl.h"
-using content::BrowserThread;
-
namespace component_updater {
UrlFetcherDownloader::UrlFetcherDownloader(
@@ -24,14 +22,14 @@ UrlFetcherDownloader::UrlFetcherDownloader(
task_runner_(task_runner),
downloaded_bytes_(-1),
total_bytes_(-1) {
Sorin Jianu 2014/07/21 21:42:14 Maybe keep the assert?
tommycli 2014/07/21 22:00:08 Would always pass.
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
UrlFetcherDownloader::~UrlFetcherDownloader() {
+ DCHECK(thread_checker_.CalledOnValidThread());
}
void UrlFetcherDownloader::DoStartDownload(const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(thread_checker_.CalledOnValidThread());
url_fetcher_.reset(
net::URLFetcher::Create(0, url, net::URLFetcher::GET, this));
@@ -52,7 +50,7 @@ void UrlFetcherDownloader::DoStartDownload(const GURL& url) {
}
void UrlFetcherDownloader::OnURLFetchComplete(const net::URLFetcher* source) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(thread_checker_.CalledOnValidThread());
const base::Time download_end_time(base::Time::Now());
const base::TimeDelta download_time =
@@ -94,7 +92,7 @@ void UrlFetcherDownloader::OnURLFetchDownloadProgress(
const net::URLFetcher* source,
int64 current,
int64 total) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(thread_checker_.CalledOnValidThread());
downloaded_bytes_ = current;
total_bytes_ = total;

Powered by Google App Engine
This is Rietveld 408576698