| Index: base/file_util_proxy.cc
|
| diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
|
| index 25d1718d659c6828d0d8abc74895d29994b43854..62ac2e4290036936bcac5d67570bea939d59bfd8 100644
|
| --- a/base/file_util_proxy.cc
|
| +++ b/base/file_util_proxy.cc
|
| @@ -7,7 +7,7 @@
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| #include "base/file_util.h"
|
| -#include "base/message_loop_proxy.h"
|
| +#include "base/task_runner.h"
|
| #include "base/task_runner_util.h"
|
|
|
| namespace base {
|
| @@ -23,9 +23,9 @@ void CallWithTranslatedParameter(const FileUtilProxy::StatusCallback& callback,
|
| // Helper classes or routines for individual methods.
|
| class CreateOrOpenHelper {
|
| public:
|
| - CreateOrOpenHelper(MessageLoopProxy* message_loop_proxy,
|
| + CreateOrOpenHelper(TaskRunner* task_runner,
|
| const FileUtilProxy::CloseTask& close_task)
|
| - : message_loop_proxy_(message_loop_proxy),
|
| + : task_runner_(task_runner),
|
| close_task_(close_task),
|
| file_handle_(kInvalidPlatformFileValue),
|
| created_(false),
|
| @@ -33,7 +33,7 @@ class CreateOrOpenHelper {
|
|
|
| ~CreateOrOpenHelper() {
|
| if (file_handle_ != kInvalidPlatformFileValue) {
|
| - message_loop_proxy_->PostTask(
|
| + task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(base::IgnoreResult(close_task_), file_handle_));
|
| }
|
| @@ -49,7 +49,7 @@ class CreateOrOpenHelper {
|
| }
|
|
|
| private:
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy_;
|
| + scoped_refptr<TaskRunner> task_runner_;
|
| FileUtilProxy::CloseTask close_task_;
|
| PlatformFile file_handle_;
|
| bool created_;
|
| @@ -59,14 +59,14 @@ class CreateOrOpenHelper {
|
|
|
| class CreateTemporaryHelper {
|
| public:
|
| - CreateTemporaryHelper(MessageLoopProxy* message_loop_proxy)
|
| - : message_loop_proxy_(message_loop_proxy),
|
| + CreateTemporaryHelper(TaskRunner* task_runner)
|
| + : task_runner_(task_runner),
|
| file_handle_(kInvalidPlatformFileValue),
|
| error_(PLATFORM_FILE_OK) {}
|
|
|
| ~CreateTemporaryHelper() {
|
| if (file_handle_ != kInvalidPlatformFileValue) {
|
| - FileUtilProxy::Close(message_loop_proxy_, file_handle_,
|
| + FileUtilProxy::Close(task_runner_, file_handle_,
|
| FileUtilProxy::StatusCallback());
|
| }
|
| }
|
| @@ -92,7 +92,7 @@ class CreateTemporaryHelper {
|
| }
|
|
|
| private:
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy_;
|
| + scoped_refptr<TaskRunner> task_runner_;
|
| PlatformFile file_handle_;
|
| FilePath file_path_;
|
| PlatformFileError error_;
|
| @@ -224,11 +224,11 @@ PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) {
|
|
|
| // static
|
| bool FileUtilProxy::CreateOrOpen(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| const FilePath& file_path, int file_flags,
|
| const CreateOrOpenCallback& callback) {
|
| return RelayCreateOrOpen(
|
| - message_loop_proxy,
|
| + task_runner,
|
| base::Bind(&CreateOrOpenAdapter, file_path, file_flags),
|
| base::Bind(&CloseAdapter),
|
| callback);
|
| @@ -236,11 +236,11 @@ bool FileUtilProxy::CreateOrOpen(
|
|
|
| // static
|
| bool FileUtilProxy::CreateTemporary(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| int additional_file_flags,
|
| const CreateTemporaryCallback& callback) {
|
| - CreateTemporaryHelper* helper = new CreateTemporaryHelper(message_loop_proxy);
|
| - return message_loop_proxy->PostTaskAndReply(
|
| + CreateTemporaryHelper* helper = new CreateTemporaryHelper(task_runner);
|
| + return task_runner->PostTaskAndReply(
|
| FROM_HERE,
|
| Bind(&CreateTemporaryHelper::RunWork, Unretained(helper),
|
| additional_file_flags),
|
| @@ -249,11 +249,11 @@ bool FileUtilProxy::CreateTemporary(
|
|
|
| // static
|
| bool FileUtilProxy::Close(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| base::PlatformFile file_handle,
|
| const StatusCallback& callback) {
|
| return RelayClose(
|
| - message_loop_proxy,
|
| + task_runner,
|
| base::Bind(&CloseAdapter),
|
| file_handle, callback);
|
| }
|
| @@ -261,11 +261,11 @@ bool FileUtilProxy::Close(
|
| // Retrieves the information about a file. It is invalid to pass NULL for the
|
| // callback.
|
| bool FileUtilProxy::GetFileInfo(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| const FilePath& file_path,
|
| const GetFileInfoCallback& callback) {
|
| GetFileInfoHelper* helper = new GetFileInfoHelper;
|
| - return message_loop_proxy->PostTaskAndReply(
|
| + return task_runner->PostTaskAndReply(
|
| FROM_HERE,
|
| Bind(&GetFileInfoHelper::RunWorkForFilePath,
|
| Unretained(helper), file_path),
|
| @@ -274,11 +274,11 @@ bool FileUtilProxy::GetFileInfo(
|
|
|
| // static
|
| bool FileUtilProxy::GetFileInfoFromPlatformFile(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| PlatformFile file,
|
| const GetFileInfoCallback& callback) {
|
| GetFileInfoHelper* helper = new GetFileInfoHelper;
|
| - return message_loop_proxy->PostTaskAndReply(
|
| + return task_runner->PostTaskAndReply(
|
| FROM_HERE,
|
| Bind(&GetFileInfoHelper::RunWorkForPlatformFile,
|
| Unretained(helper), file),
|
| @@ -286,30 +286,30 @@ bool FileUtilProxy::GetFileInfoFromPlatformFile(
|
| }
|
|
|
| // static
|
| -bool FileUtilProxy::Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| +bool FileUtilProxy::Delete(TaskRunner* task_runner,
|
| const FilePath& file_path,
|
| bool recursive,
|
| const StatusCallback& callback) {
|
| return RelayFileTask(
|
| - message_loop_proxy, FROM_HERE,
|
| + task_runner, FROM_HERE,
|
| Bind(&DeleteAdapter, file_path, recursive),
|
| callback);
|
| }
|
|
|
| // static
|
| bool FileUtilProxy::RecursiveDelete(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| const FilePath& file_path,
|
| const StatusCallback& callback) {
|
| return RelayFileTask(
|
| - message_loop_proxy, FROM_HERE,
|
| + task_runner, FROM_HERE,
|
| Bind(&DeleteAdapter, file_path, true /* recursive */),
|
| callback);
|
| }
|
|
|
| // static
|
| bool FileUtilProxy::Read(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| PlatformFile file,
|
| int64 offset,
|
| int bytes_to_read,
|
| @@ -318,7 +318,7 @@ bool FileUtilProxy::Read(
|
| return false;
|
| }
|
| ReadHelper* helper = new ReadHelper(bytes_to_read);
|
| - return message_loop_proxy->PostTaskAndReply(
|
| + return task_runner->PostTaskAndReply(
|
| FROM_HERE,
|
| Bind(&ReadHelper::RunWork, Unretained(helper), file, offset),
|
| Bind(&ReadHelper::Reply, Owned(helper), callback));
|
| @@ -326,7 +326,7 @@ bool FileUtilProxy::Read(
|
|
|
| // static
|
| bool FileUtilProxy::Write(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| PlatformFile file,
|
| int64 offset,
|
| const char* buffer,
|
| @@ -336,7 +336,7 @@ bool FileUtilProxy::Write(
|
| return false;
|
| }
|
| WriteHelper* helper = new WriteHelper(buffer, bytes_to_write);
|
| - return message_loop_proxy->PostTaskAndReply(
|
| + return task_runner->PostTaskAndReply(
|
| FROM_HERE,
|
| Bind(&WriteHelper::RunWork, Unretained(helper), file, offset),
|
| Bind(&WriteHelper::Reply, Owned(helper), callback));
|
| @@ -344,13 +344,13 @@ bool FileUtilProxy::Write(
|
|
|
| // static
|
| bool FileUtilProxy::Touch(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| PlatformFile file,
|
| const Time& last_access_time,
|
| const Time& last_modified_time,
|
| const StatusCallback& callback) {
|
| return base::PostTaskAndReplyWithResult(
|
| - message_loop_proxy,
|
| + task_runner,
|
| FROM_HERE,
|
| Bind(&TouchPlatformFile, file,
|
| last_access_time, last_modified_time),
|
| @@ -359,13 +359,13 @@ bool FileUtilProxy::Touch(
|
|
|
| // static
|
| bool FileUtilProxy::Touch(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| const FilePath& file_path,
|
| const Time& last_access_time,
|
| const Time& last_modified_time,
|
| const StatusCallback& callback) {
|
| return base::PostTaskAndReplyWithResult(
|
| - message_loop_proxy,
|
| + task_runner,
|
| FROM_HERE,
|
| Bind(&file_util::TouchFile, file_path,
|
| last_access_time, last_modified_time),
|
| @@ -374,12 +374,12 @@ bool FileUtilProxy::Touch(
|
|
|
| // static
|
| bool FileUtilProxy::Truncate(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| PlatformFile file,
|
| int64 length,
|
| const StatusCallback& callback) {
|
| return base::PostTaskAndReplyWithResult(
|
| - message_loop_proxy,
|
| + task_runner,
|
| FROM_HERE,
|
| Bind(&TruncatePlatformFile, file, length),
|
| Bind(&CallWithTranslatedParameter, callback));
|
| @@ -387,11 +387,11 @@ bool FileUtilProxy::Truncate(
|
|
|
| // static
|
| bool FileUtilProxy::Flush(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| PlatformFile file,
|
| const StatusCallback& callback) {
|
| return base::PostTaskAndReplyWithResult(
|
| - message_loop_proxy,
|
| + task_runner,
|
| FROM_HERE,
|
| Bind(&FlushPlatformFile, file),
|
| Bind(&CallWithTranslatedParameter, callback));
|
| @@ -399,23 +399,23 @@ bool FileUtilProxy::Flush(
|
|
|
| // static
|
| bool FileUtilProxy::RelayFileTask(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| const tracked_objects::Location& from_here,
|
| const FileTask& file_task,
|
| const StatusCallback& callback) {
|
| return base::PostTaskAndReplyWithResult(
|
| - message_loop_proxy, from_here, file_task, callback);
|
| + task_runner, from_here, file_task, callback);
|
| }
|
|
|
| // static
|
| bool FileUtilProxy::RelayCreateOrOpen(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| const CreateOrOpenTask& open_task,
|
| const CloseTask& close_task,
|
| const CreateOrOpenCallback& callback) {
|
| CreateOrOpenHelper* helper = new CreateOrOpenHelper(
|
| - message_loop_proxy, close_task);
|
| - return message_loop_proxy->PostTaskAndReply(
|
| + task_runner, close_task);
|
| + return task_runner->PostTaskAndReply(
|
| FROM_HERE,
|
| Bind(&CreateOrOpenHelper::RunWork, Unretained(helper), open_task),
|
| Bind(&CreateOrOpenHelper::Reply, Owned(helper), callback));
|
| @@ -423,12 +423,12 @@ bool FileUtilProxy::RelayCreateOrOpen(
|
|
|
| // static
|
| bool FileUtilProxy::RelayClose(
|
| - scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| + TaskRunner* task_runner,
|
| const CloseTask& close_task,
|
| PlatformFile file_handle,
|
| const StatusCallback& callback) {
|
| return base::PostTaskAndReplyWithResult(
|
| - message_loop_proxy, FROM_HERE, Bind(close_task, file_handle), callback);
|
| + task_runner, FROM_HERE, Bind(close_task, file_handle), callback);
|
| }
|
|
|
| } // namespace base
|
|
|