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

Unified Diff: webkit/fileapi/file_writer_delegate.cc

Issue 10197007: Change webkit/{fileapi,quota} code to use TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 8 years, 8 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: webkit/fileapi/file_writer_delegate.cc
diff --git a/webkit/fileapi/file_writer_delegate.cc b/webkit/fileapi/file_writer_delegate.cc
index a5da1c641e20d8a589f040062dcc9c2c030a3d1d..81a5cf615dee631d2f9de09428f11e9ea4ec5941 100644
--- a/webkit/fileapi/file_writer_delegate.cc
+++ b/webkit/fileapi/file_writer_delegate.cc
@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/file_util_proxy.h"
-#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
#include "base/threading/thread_restrictions.h"
#include "net/base/net_errors.h"
#include "webkit/fileapi/file_system_context.h"
@@ -33,8 +33,7 @@ class InitializeTask : public base::RefCountedThreadSafe<InitializeTask> {
const FileSystemPath& path,
FileSystemOperationContext* context,
const InitializeTaskCallback& callback)
- : origin_message_loop_proxy_(
- base::MessageLoopProxy::current()),
+ : origin_task_runner_(base::MessageLoopProxy::current()),
error_code_(base::PLATFORM_FILE_OK),
file_(file),
path_(path),
@@ -43,9 +42,9 @@ class InitializeTask : public base::RefCountedThreadSafe<InitializeTask> {
DCHECK_EQ(false, callback.is_null());
}
- bool Start(scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
+ bool Start(base::TaskRunner* task_runner,
const tracked_objects::Location& from_here) {
- return message_loop_proxy->PostTask(
+ return task_runner->PostTask(
from_here,
base::Bind(&InitializeTask::ProcessOnTargetThread, this));
}
@@ -67,12 +66,12 @@ class InitializeTask : public base::RefCountedThreadSafe<InitializeTask> {
}
if (!base::GetPlatformFileInfo(file_, &file_info_))
error_code_ = base::PLATFORM_FILE_ERROR_FAILED;
- origin_message_loop_proxy_->PostTask(
+ origin_task_runner_->PostTask(
FROM_HERE,
base::Bind(&InitializeTask::RunCallback, this));
}
- scoped_refptr<base::MessageLoopProxy> origin_message_loop_proxy_;
+ scoped_refptr<base::TaskRunner> origin_task_runner_;
michaeln 2012/04/27 01:04:03 My vote would be to keep this as a MLP for clarity
kinuko 2012/04/27 10:10:29 Yup, I reverted this change.
base::PlatformFileError error_code_;
base::PlatformFile file_;
@@ -89,12 +88,12 @@ FileWriterDelegate::FileWriterDelegate(
FileSystemOperation* file_system_operation,
const FileSystemPath& path,
int64 offset,
- scoped_refptr<base::MessageLoopProxy> proxy)
+ base::TaskRunner* task_runner)
: file_system_operation_(file_system_operation),
file_(base::kInvalidPlatformFileValue),
path_(path),
offset_(offset),
- proxy_(proxy),
+ task_runner_(task_runner),
bytes_written_backlog_(0),
bytes_written_(0),
bytes_read_(0),
@@ -141,7 +140,7 @@ void FileWriterDelegate::Start(base::PlatformFile file,
file_system_operation_context(),
base::Bind(&FileWriterDelegate::OnGetFileInfoAndCallStartUpdate,
weak_factory_.GetWeakPtr()));
- relay->Start(proxy_, FROM_HERE);
+ relay->Start(task_runner_, FROM_HERE);
}
void FileWriterDelegate::OnReceivedRedirect(net::URLRequest* request,
@@ -203,7 +202,7 @@ void FileWriterDelegate::Read() {
bytes_read_ = 0;
if (request_->Read(io_buffer_.get(), io_buffer_->size(),
&bytes_read_)) {
- MessageLoop::current()->PostTask(
+ base::MessageLoopProxy::current()->PostTask(
michaeln 2012/04/27 01:04:03 nit: change not really needed (afaict)
kinuko 2012/04/27 10:10:29 This was another not-indended-fix... reverted.
FROM_HERE,
base::Bind(&FileWriterDelegate::OnDataReceived,
weak_factory_.GetWeakPtr(), bytes_read_));
@@ -247,7 +246,7 @@ void FileWriterDelegate::Write() {
base::Bind(&FileWriterDelegate::OnDataWritten,
weak_factory_.GetWeakPtr()));
if (write_response > 0)
- MessageLoop::current()->PostTask(
+ base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(&FileWriterDelegate::OnDataWritten,
weak_factory_.GetWeakPtr(), write_response));

Powered by Google App Engine
This is Rietveld 408576698