| Index: base/file_util_proxy.cc
|
| ===================================================================
|
| --- base/file_util_proxy.cc (revision 72915)
|
| +++ base/file_util_proxy.cc (working copy)
|
| @@ -120,7 +120,7 @@
|
| scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| int file_flags,
|
| - base::FileUtilProxy::CreateOrOpenCallback* callback)
|
| + base::FileUtilProxyBase::CreateOrOpenCallback* callback)
|
| : message_loop_proxy_(message_loop_proxy),
|
| file_path_(file_path),
|
| file_flags_(file_flags),
|
| @@ -133,7 +133,8 @@
|
| protected:
|
| virtual ~RelayCreateOrOpen() {
|
| if (file_handle_ != base::kInvalidPlatformFileValue)
|
| - base::FileUtilProxy::Close(message_loop_proxy_, file_handle_, NULL);
|
| + base::FileUtilProxy::GetInstance()->Close(
|
| + message_loop_proxy_, file_handle_, NULL);
|
| }
|
|
|
| virtual void RunWork() {
|
| @@ -158,7 +159,7 @@
|
| scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
|
| FilePath file_path_;
|
| int file_flags_;
|
| - base::FileUtilProxy::CreateOrOpenCallback* callback_;
|
| + base::FileUtilProxyBase::CreateOrOpenCallback* callback_;
|
| base::PlatformFile file_handle_;
|
| bool created_;
|
| };
|
| @@ -167,7 +168,7 @@
|
| public:
|
| RelayCreateTemporary(
|
| scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
|
| - base::FileUtilProxy::CreateTemporaryCallback* callback)
|
| + base::FileUtilProxyBase::CreateTemporaryCallback* callback)
|
| : message_loop_proxy_(message_loop_proxy),
|
| callback_(callback),
|
| file_handle_(base::kInvalidPlatformFileValue) {
|
| @@ -177,7 +178,8 @@
|
| protected:
|
| virtual ~RelayCreateTemporary() {
|
| if (file_handle_ != base::kInvalidPlatformFileValue)
|
| - base::FileUtilProxy::Close(message_loop_proxy_, file_handle_, NULL);
|
| + base::FileUtilProxy::GetInstance()->Close(
|
| + message_loop_proxy_, file_handle_, NULL);
|
| }
|
|
|
| virtual void RunWork() {
|
| @@ -206,7 +208,7 @@
|
|
|
| private:
|
| scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
|
| - base::FileUtilProxy::CreateTemporaryCallback* callback_;
|
| + base::FileUtilProxyBase::CreateTemporaryCallback* callback_;
|
| base::PlatformFile file_handle_;
|
| FilePath file_path_;
|
| };
|
| @@ -214,7 +216,7 @@
|
| class RelayWithStatusCallback : public MessageLoopRelay {
|
| public:
|
| explicit RelayWithStatusCallback(
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : callback_(callback) {
|
| // It is OK for callback to be NULL.
|
| }
|
| @@ -229,13 +231,13 @@
|
| }
|
|
|
| private:
|
| - base::FileUtilProxy::StatusCallback* callback_;
|
| + base::FileUtilProxyBase::StatusCallback* callback_;
|
| };
|
|
|
| class RelayClose : public RelayWithStatusCallback {
|
| public:
|
| RelayClose(base::PlatformFile file_handle,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| file_handle_(file_handle) {
|
| }
|
| @@ -255,7 +257,7 @@
|
| RelayEnsureFileExists(
|
| scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| - base::FileUtilProxy::EnsureFileExistsCallback* callback)
|
| + base::FileUtilProxyBase::EnsureFileExistsCallback* callback)
|
| : message_loop_proxy_(message_loop_proxy),
|
| file_path_(file_path),
|
| callback_(callback),
|
| @@ -295,7 +297,7 @@
|
| private:
|
| scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
|
| FilePath file_path_;
|
| - base::FileUtilProxy::EnsureFileExistsCallback* callback_;
|
| + base::FileUtilProxyBase::EnsureFileExistsCallback* callback_;
|
| bool created_;
|
| };
|
|
|
| @@ -303,7 +305,7 @@
|
| public:
|
| RelayDelete(const FilePath& file_path,
|
| bool recursive,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| file_path_(file_path),
|
| recursive_(recursive) {
|
| @@ -333,7 +335,7 @@
|
| public:
|
| RelayCopy(const FilePath& src_file_path,
|
| const FilePath& dest_file_path,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| src_file_path_(src_file_path),
|
| dest_file_path_(dest_file_path) {
|
| @@ -359,7 +361,7 @@
|
| public:
|
| RelayMove(const FilePath& src_file_path,
|
| const FilePath& dest_file_path,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| src_file_path_(src_file_path),
|
| dest_file_path_(dest_file_path) {
|
| @@ -386,7 +388,7 @@
|
| const FilePath& file_path,
|
| bool exclusive,
|
| bool recursive,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| file_path_(file_path),
|
| exclusive_(exclusive),
|
| @@ -423,7 +425,7 @@
|
| class RelayReadDirectory : public MessageLoopRelay {
|
| public:
|
| RelayReadDirectory(const FilePath& file_path,
|
| - base::FileUtilProxy::ReadDirectoryCallback* callback)
|
| + base::FileUtilProxyBase::ReadDirectoryCallback* callback)
|
| : callback_(callback), file_path_(file_path) {
|
| DCHECK(callback);
|
| }
|
| @@ -442,7 +444,7 @@
|
| file_util::FileEnumerator::DIRECTORIES));
|
| FilePath current;
|
| while (!(current = file_enum.Next()).empty()) {
|
| - base::FileUtilProxy::Entry entry;
|
| + base::FileUtilProxyBase::Entry entry;
|
| file_util::FileEnumerator::FindInfo info;
|
| file_enum.GetFindInfo(&info);
|
| entry.is_directory = file_enum.IsDirectory(info);
|
| @@ -459,15 +461,15 @@
|
| }
|
|
|
| private:
|
| - base::FileUtilProxy::ReadDirectoryCallback* callback_;
|
| + base::FileUtilProxyBase::ReadDirectoryCallback* callback_;
|
| FilePath file_path_;
|
| - std::vector<base::FileUtilProxy::Entry> entries_;
|
| + std::vector<base::FileUtilProxyBase::Entry> entries_;
|
| };
|
|
|
| class RelayGetFileInfo : public MessageLoopRelay {
|
| public:
|
| RelayGetFileInfo(const FilePath& file_path,
|
| - base::FileUtilProxy::GetFileInfoCallback* callback)
|
| + base::FileUtilProxyBase::GetFileInfoCallback* callback)
|
| : callback_(callback),
|
| file_path_(file_path) {
|
| DCHECK(callback);
|
| @@ -489,7 +491,7 @@
|
| }
|
|
|
| private:
|
| - base::FileUtilProxy::GetFileInfoCallback* callback_;
|
| + base::FileUtilProxyBase::GetFileInfoCallback* callback_;
|
| FilePath file_path_;
|
| base::PlatformFileInfo file_info_;
|
| };
|
| @@ -498,7 +500,7 @@
|
| public:
|
| RelayGetFileInfoFromPlatformFile(
|
| base::PlatformFile file,
|
| - base::FileUtilProxy::GetFileInfoCallback* callback)
|
| + base::FileUtilProxyBase::GetFileInfoCallback* callback)
|
| : callback_(callback),
|
| file_(file) {
|
| DCHECK(callback);
|
| @@ -516,7 +518,7 @@
|
| }
|
|
|
| private:
|
| - base::FileUtilProxy::GetFileInfoCallback* callback_;
|
| + base::FileUtilProxyBase::GetFileInfoCallback* callback_;
|
| base::PlatformFile file_;
|
| base::PlatformFileInfo file_info_;
|
| };
|
| @@ -527,7 +529,7 @@
|
| int64 offset,
|
| char* buffer,
|
| int bytes_to_read,
|
| - base::FileUtilProxy::ReadWriteCallback* callback)
|
| + base::FileUtilProxyBase::ReadWriteCallback* callback)
|
| : file_(file),
|
| offset_(offset),
|
| buffer_(buffer),
|
| @@ -556,7 +558,7 @@
|
| int64 offset_;
|
| char* buffer_;
|
| int bytes_to_read_;
|
| - base::FileUtilProxy::ReadWriteCallback* callback_;
|
| + base::FileUtilProxyBase::ReadWriteCallback* callback_;
|
| int bytes_read_;
|
| };
|
|
|
| @@ -566,7 +568,7 @@
|
| int64 offset,
|
| const char* buffer,
|
| int bytes_to_write,
|
| - base::FileUtilProxy::ReadWriteCallback* callback)
|
| + base::FileUtilProxyBase::ReadWriteCallback* callback)
|
| : file_(file),
|
| offset_(offset),
|
| buffer_(buffer),
|
| @@ -594,7 +596,7 @@
|
| int64 offset_;
|
| const char* buffer_;
|
| int bytes_to_write_;
|
| - base::FileUtilProxy::ReadWriteCallback* callback_;
|
| + base::FileUtilProxyBase::ReadWriteCallback* callback_;
|
| int bytes_written_;
|
| };
|
|
|
| @@ -603,7 +605,7 @@
|
| RelayTouch(base::PlatformFile file,
|
| const base::Time& last_access_time,
|
| const base::Time& last_modified_time,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| file_(file),
|
| last_access_time_(last_access_time),
|
| @@ -627,7 +629,7 @@
|
| RelayTouchFilePath(const FilePath& file_path,
|
| const base::Time& last_access_time,
|
| const base::Time& last_modified_time,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| file_path_(file_path),
|
| last_access_time_(last_access_time),
|
| @@ -651,7 +653,7 @@
|
| public:
|
| RelayTruncatePlatformFile(base::PlatformFile file,
|
| int64 length,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| file_(file),
|
| length_(length) {
|
| @@ -672,7 +674,7 @@
|
| public:
|
| RelayTruncate(const FilePath& path,
|
| int64 length,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| path_(path),
|
| length_(length) {
|
| @@ -704,7 +706,7 @@
|
| class RelayFlush : public RelayWithStatusCallback {
|
| public:
|
| RelayFlush(base::PlatformFile file,
|
| - base::FileUtilProxy::StatusCallback* callback)
|
| + base::FileUtilProxyBase::StatusCallback* callback)
|
| : RelayWithStatusCallback(callback),
|
| file_(file) {
|
| }
|
| @@ -729,7 +731,10 @@
|
|
|
| namespace base {
|
|
|
| -// static
|
| +FileUtilProxy* FileUtilProxy::GetInstance() {
|
| + return Singleton<FileUtilProxy>::get();
|
| +}
|
| +
|
| bool FileUtilProxy::CreateOrOpen(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path, int file_flags,
|
| @@ -738,7 +743,6 @@
|
| message_loop_proxy, file_path, file_flags, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::CreateTemporary(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| CreateTemporaryCallback* callback) {
|
| @@ -746,7 +750,6 @@
|
| new RelayCreateTemporary(message_loop_proxy, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Close(scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| base::PlatformFile file_handle,
|
| StatusCallback* callback) {
|
| @@ -754,7 +757,6 @@
|
| new RelayClose(file_handle, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::EnsureFileExists(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| @@ -773,7 +775,6 @@
|
| file_path, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::GetFileInfoFromPlatformFile(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| PlatformFile file,
|
| @@ -782,7 +783,6 @@
|
| new RelayGetFileInfoFromPlatformFile(file, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::ReadDirectory(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| @@ -791,7 +791,6 @@
|
| file_path, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::CreateDirectory(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| @@ -802,7 +801,6 @@
|
| file_path, exclusive, recursive, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Copy(scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& src_file_path,
|
| const FilePath& dest_file_path,
|
| @@ -811,7 +809,6 @@
|
| new RelayCopy(src_file_path, dest_file_path, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Move(scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& src_file_path,
|
| const FilePath& dest_file_path,
|
| @@ -820,7 +817,6 @@
|
| new RelayMove(src_file_path, dest_file_path, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| bool recursive,
|
| @@ -829,7 +825,6 @@
|
| new RelayDelete(file_path, recursive, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::RecursiveDelete(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| @@ -838,7 +833,6 @@
|
| new RelayDelete(file_path, true, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Read(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| PlatformFile file,
|
| @@ -850,7 +844,6 @@
|
| new RelayRead(file, offset, buffer, bytes_to_read, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Write(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| PlatformFile file,
|
| @@ -862,7 +855,6 @@
|
| new RelayWrite(file, offset, buffer, bytes_to_write, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Touch(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| PlatformFile file,
|
| @@ -874,7 +866,6 @@
|
| callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Touch(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& file_path,
|
| @@ -886,7 +877,6 @@
|
| last_modified_time, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Truncate(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| PlatformFile file,
|
| @@ -896,7 +886,6 @@
|
| new RelayTruncatePlatformFile(file, length, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Truncate(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| const FilePath& path,
|
| @@ -906,7 +895,6 @@
|
| new RelayTruncate(path, length, callback));
|
| }
|
|
|
| -// static
|
| bool FileUtilProxy::Flush(
|
| scoped_refptr<MessageLoopProxy> message_loop_proxy,
|
| PlatformFile file,
|
|
|