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

Unified Diff: content/browser/download/save_file_resource_handler.cc

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Add scoped COM initialization to quench a couple of assertion failures. Created 3 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: content/browser/download/save_file_resource_handler.cc
diff --git a/content/browser/download/save_file_resource_handler.cc b/content/browser/download/save_file_resource_handler.cc
index 98b332de01c3998bdf7fa2aa7a9db292cdcc87b7..31ab9787f4e4ac40775cad5331e501b1675ac8f2 100644
--- a/content/browser/download/save_file_resource_handler.cc
+++ b/content/browser/download/save_file_resource_handler.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
+#include "content/browser/download/download_task_runner.h"
#include "content/browser/download/save_file_manager.h"
#include "content/browser/loader/resource_controller.h"
#include "content/public/browser/browser_thread.h"
@@ -54,9 +55,8 @@ void SaveFileResourceHandler::OnResponseStarted(
url_, final_url_, save_item_id_, save_package_id_, render_process_id_,
render_frame_routing_id_, GetRequestID(), content_disposition_,
content_length_);
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&SaveFileManager::StartSave, save_manager_, info));
+ GetDownloadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&SaveFileManager::StartSave, save_manager_, info));
controller->Resume();
}
@@ -92,8 +92,8 @@ void SaveFileResourceHandler::OnReadCompleted(
// We are passing ownership of this buffer to the save file manager.
scoped_refptr<net::IOBuffer> buffer;
read_buffer_.swap(buffer);
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
+ GetDownloadTaskRunner()->PostTask(
+ FROM_HERE,
base::Bind(&SaveFileManager::UpdateSaveProgress, save_manager_,
save_item_id_, base::RetainedRef(buffer), bytes_read));
controller->Resume();
@@ -105,11 +105,10 @@ void SaveFileResourceHandler::OnResponseCompleted(
if (authorization_state_ != AuthorizationState::AUTHORIZED)
DCHECK(!status.is_success());
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&SaveFileManager::SaveFinished, save_manager_, save_item_id_,
- save_package_id_,
- status.is_success() && !status.is_io_pending()));
+ GetDownloadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&SaveFileManager::SaveFinished, save_manager_,
+ save_item_id_, save_package_id_,
+ status.is_success() && !status.is_io_pending()));
read_buffer_ = nullptr;
controller->Resume();
}

Powered by Google App Engine
This is Rietveld 408576698