Commit fc7390b5 authored by achuith@chromium.org's avatar achuith@chromium.org

Replace NewRunnableMethod with Callback in DownloadResourceHandler.

BUG=chromium-os:22024
TEST=compiles, tests pass.
Review URL: http://codereview.chromium.org/8343042

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107788 0039d316-1c4b-4281-b951-d872f2087c98
parent 61a7acde
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <string> #include <string>
#include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/metrics/stats_counters.h" #include "base/metrics/stats_counters.h"
...@@ -15,7 +16,6 @@ ...@@ -15,7 +16,6 @@
#include "content/browser/download/download_file_manager.h" #include "content/browser/download/download_file_manager.h"
#include "content/browser/download/download_item.h" #include "content/browser/download/download_item.h"
#include "content/browser/download/download_request_handle.h" #include "content/browser/download/download_request_handle.h"
#include "content/browser/download/download_request_handle.h"
#include "content/browser/download/download_stats.h" #include "content/browser/download/download_stats.h"
#include "content/browser/download/interrupt_reasons.h" #include "content/browser/download/interrupt_reasons.h"
#include "content/browser/renderer_host/global_request_id.h" #include "content/browser/renderer_host/global_request_id.h"
...@@ -123,9 +123,8 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id, ...@@ -123,9 +123,8 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id,
info->save_info = save_info_; info->save_info = save_info_;
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
NewRunnableMethod( base::Bind(&DownloadFileManager::StartDownload,
download_file_manager_, &DownloadFileManager::StartDownload, download_file_manager_, info, request_handle));
info, request_handle));
// We can't start saving the data before we create the file on disk. // We can't start saving the data before we create the file on disk.
// The request will be un-paused in DownloadFileManager::CreateDownloadFile. // The request will be un-paused in DownloadFileManager::CreateDownloadFile.
...@@ -176,10 +175,8 @@ bool DownloadResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { ...@@ -176,10 +175,8 @@ bool DownloadResourceHandler::OnReadCompleted(int request_id, int* bytes_read) {
if (need_update) { if (need_update) {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE, BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(download_file_manager_, base::Bind(&DownloadFileManager::UpdateDownload,
&DownloadFileManager::UpdateDownload, download_file_manager_, download_id_, buffer_));
download_id_,
buffer_));
} }
// We schedule a pause outside of the read loop if there is too much file // We schedule a pause outside of the read loop if there is too much file
...@@ -224,11 +221,8 @@ bool DownloadResourceHandler::OnResponseCompleted( ...@@ -224,11 +221,8 @@ bool DownloadResourceHandler::OnResponseCompleted(
// before deletion. // before deletion.
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE, BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(download_file_manager_, base::Bind(&DownloadFileManager::OnResponseCompleted,
&DownloadFileManager::OnResponseCompleted, download_file_manager_, download_id_, reason, security_info));
download_id_,
reason,
security_info));
buffer_ = NULL; // The buffer is longer needed by |DownloadResourceHandler|. buffer_ = NULL; // The buffer is longer needed by |DownloadResourceHandler|.
read_buffer_ = NULL; read_buffer_ = NULL;
return true; return true;
......
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