Commit 871b0dbb authored by Min Qin's avatar Min Qin Committed by Commit Bot

Don't remove ref-count on download IO TaskRunner

There is no need to remove the IO TaskRunner reference.
The global io thread task_runner is never deleted.
If io TaskRunner is set, just ignore future calls.

BUG=842245

Change-Id: Ifefad6442d8efde238379218e9f11a9f3d99a75a
Reviewed-on: https://chromium-review.googlesource.com/1134197Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574402}
parent 351a925f
......@@ -45,20 +45,13 @@ scoped_refptr<base::SequencedTaskRunner> GetDownloadTaskRunner() {
void SetIOTaskRunner(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
DCHECK(task_runner);
base::AutoLock auto_lock(GetIOTaskRunnerLock());
static int count = 0;
if (task_runner) {
DCHECK(!g_io_task_runner.Get() ||
task_runner.get() == g_io_task_runner.Get().get());
count++;
g_io_task_runner.Get() = task_runner;
if (g_io_task_runner.Get())
return;
}
count--;
DCHECK_GE(count, 0);
if (count == 0)
g_io_task_runner.Get() = nullptr;
g_io_task_runner.Get() = task_runner;
}
scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() {
......
......@@ -312,7 +312,6 @@ DownloadManagerImpl::DownloadManagerImpl(BrowserContext* browser_context)
DownloadManagerImpl::~DownloadManagerImpl() {
DCHECK(!shutdown_needed_);
download::SetIOTaskRunner(nullptr);
}
download::DownloadItemImpl* DownloadManagerImpl::CreateActiveItem(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment