Lines Matching defs:base
5 #include "base/file_util_proxy.h"
7 #include "base/message_loop_proxy.h"
9 // TODO(jianli): Move the code from anonymous namespace to base namespace so
10 // that all of the base:: prefixes would be unnecessary.
19 static base::PlatformFileError PerformCommonCheckAndPreparationForMoveAndCopy(
24 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
28 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
32 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
36 return base::PLATFORM_FILE_OK;
43 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
48 return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
52 return base::PLATFORM_FILE_ERROR_EXISTS;
62 return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
63 return base::PLATFORM_FILE_ERROR_FAILED;
66 return base::PLATFORM_FILE_OK;
72 : public base::RefCountedThreadSafe<MessageLoopRelay> {
76 base::MessageLoopProxy::CreateForCurrentThread()),
77 error_code_(base::PLATFORM_FILE_OK) {
80 bool Start(scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
88 friend class base::RefCountedThreadSafe<MessageLoopRelay>;
97 void set_error_code(base::PlatformFileError error_code) {
101 base::PlatformFileError error_code() const {
113 scoped_refptr<base::MessageLoopProxy> origin_message_loop_proxy_;
114 base::PlatformFileError error_code_;
120 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
123 base::FileUtilProxy::CreateOrOpenCallback* callback)
128 file_handle_(base::kInvalidPlatformFileValue),
135 if (file_handle_ != base::kInvalidPlatformFileValue)
136 base::FileUtilProxy::Close(message_loop_proxy_, file_handle_, NULL);
142 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
145 base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
146 file_handle_ = base::CreatePlatformFile(file_path_, file_flags_,
152 callback_->Run(error_code(), base::PassPlatformFile(&file_handle_),
158 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
161 base::FileUtilProxy::CreateOrOpenCallback* callback_;
162 base::PlatformFile file_handle_;
169 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
170 base::FileUtilProxy::CreateTemporaryCallback* callback)
173 file_handle_(base::kInvalidPlatformFileValue) {
179 if (file_handle_ != base::kInvalidPlatformFileValue)
180 base::FileUtilProxy::Close(message_loop_proxy_, file_handle_, NULL);
191 base::PLATFORM_FILE_CREATE_ALWAYS |
192 base::PLATFORM_FILE_WRITE |
193 base::PLATFORM_FILE_ASYNC |
194 base::PLATFORM_FILE_TEMPORARY;
195 base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
196 file_handle_ = base::CreatePlatformFile(file_path_, file_flags,
202 callback_->Run(error_code(), base::PassPlatformFile(&file_handle_),
208 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
209 base::FileUtilProxy::CreateTemporaryCallback* callback_;
210 base::PlatformFile file_handle_;
217 base::FileUtilProxy::StatusCallback* callback)
232 base::FileUtilProxy::StatusCallback* callback_;
237 RelayClose(base::PlatformFile file_handle,
238 base::FileUtilProxy::StatusCallback* callback)
245 if (!base::ClosePlatformFile(file_handle_))
246 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
250 base::PlatformFile file_handle_;
256 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
258 base::FileUtilProxy::EnsureFileExistsCallback* callback)
270 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
273 base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
276 base::PlatformFile handle = base::CreatePlatformFile(
278 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_READ,
280 if (error_code == base::PLATFORM_FILE_ERROR_EXISTS) {
283 error_code = base::PLATFORM_FILE_OK;
285 if (handle != base::kInvalidPlatformFileValue)
286 base::ClosePlatformFile(handle);
296 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
298 base::FileUtilProxy::EnsureFileExistsCallback* callback_;
306 base::FileUtilProxy::StatusCallback* callback)
315 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
320 set_error_code(base::PLATFORM_FILE_ERROR_NOT_EMPTY);
323 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
336 base::FileUtilProxy::StatusCallback* callback)
346 if (error_code() != base::PLATFORM_FILE_OK)
350 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
362 base::FileUtilProxy::StatusCallback* callback)
372 if (error_code() != base::PLATFORM_FILE_OK)
375 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
389 base::FileUtilProxy::StatusCallback* callback)
401 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
405 set_error_code(base::PLATFORM_FILE_ERROR_EXISTS);
410 set_error_code(base::PLATFORM_FILE_ERROR_EXISTS);
414 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
426 base::FileUtilProxy::ReadDirectoryCallback* callback)
435 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
445 base::FileUtilProxy::Entry entry;
462 base::FileUtilProxy::ReadDirectoryCallback* callback_;
464 std::vector<base::FileUtilProxy::Entry> entries_;
470 base::FileUtilProxy::GetFileInfoCallback* callback)
479 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
483 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
492 base::FileUtilProxy::GetFileInfoCallback* callback_;
494 base::PlatformFileInfo file_info_;
500 base::PlatformFile file,
501 base::FileUtilProxy::GetFileInfoCallback* callback)
509 if (!base::GetPlatformFileInfo(file_, &file_info_))
510 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
519 base::FileUtilProxy::GetFileInfoCallback* callback_;
520 base::PlatformFile file_;
521 base::PlatformFileInfo file_info_;
526 RelayRead(base::PlatformFile file,
529 base::FileUtilProxy::ReadCallback* callback)
540 bytes_read_ = base::ReadPlatformFile(file_, offset_, buffer_.get(),
543 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
554 base::PlatformFile file_;
558 base::FileUtilProxy::ReadCallback* callback_;
564 RelayWrite(base::PlatformFile file,
568 base::FileUtilProxy::WriteCallback* callback)
580 bytes_written_ = base::WritePlatformFile(file_, offset_, buffer_.get(),
583 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
594 base::PlatformFile file_;
598 base::FileUtilProxy::WriteCallback* callback_;
604 RelayTouch(base::PlatformFile file,
605 const base::Time& last_access_time,
606 const base::Time& last_modified_time,
607 base::FileUtilProxy::StatusCallback* callback)
616 if (!base::TouchPlatformFile(file_, last_access_time_, last_modified_time_))
617 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
621 base::PlatformFile file_;
622 base::Time last_access_time_;
623 base::Time last_modified_time_;
629 const base::Time& last_access_time,
630 const base::Time& last_modified_time,
631 base::FileUtilProxy::StatusCallback* callback)
642 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
647 base::Time last_access_time_;
648 base::Time last_modified_time_;
653 RelayTruncatePlatformFile(base::PlatformFile file,
655 base::FileUtilProxy::StatusCallback* callback)
663 if (!base::TruncatePlatformFile(file_, length_))
664 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
668 base::PlatformFile file_;
676 base::FileUtilProxy::StatusCallback* callback)
684 base::PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED);
685 base::PlatformFile file =
686 base::CreatePlatformFile(
688 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
691 if (error_code != base::PLATFORM_FILE_OK) {
695 if (!base::TruncatePlatformFile(file, length_))
696 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
697 base::ClosePlatformFile(file);
707 RelayFlush(base::PlatformFile file,
708 base::FileUtilProxy::StatusCallback* callback)
715 if (!base::FlushPlatformFile(file_))
716 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
720 base::PlatformFile file_;
724 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
731 namespace base {
752 base::PlatformFile file_handle,
869 const base::Time& last_access_time,
870 const base::Time& last_modified_time,
881 const base::Time& last_access_time,
882 const base::Time& last_modified_time,
917 } // namespace base