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

Unified Diff: webkit/fileapi/file_system_file_util_proxy.cc

Issue 8423041: Revert 108258 - broke Mac LayoutTests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.h ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_file_util_proxy.cc
===================================================================
--- webkit/fileapi/file_system_file_util_proxy.cc (revision 108273)
+++ webkit/fileapi/file_system_file_util_proxy.cc (working copy)
@@ -71,6 +71,51 @@
fileapi::FileSystemFileUtil* file_util_;
};
+class RelayCreateOrOpen : public MessageLoopRelay {
+ public:
+ RelayCreateOrOpen(
+ const fileapi::FileSystemOperationContext& context,
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
+ const FilePath& file_path,
+ int file_flags,
+ const fileapi::FileSystemFileUtilProxy::CreateOrOpenCallback& callback)
+ : MessageLoopRelay(context),
+ message_loop_proxy_(message_loop_proxy),
+ file_path_(file_path),
+ file_flags_(file_flags),
+ callback_(callback),
+ file_handle_(base::kInvalidPlatformFileValue),
+ created_(false) {
+ DCHECK_EQ(false, callback.is_null());
+ }
+
+ protected:
+ virtual ~RelayCreateOrOpen() {
+ if (file_handle_ != base::kInvalidPlatformFileValue)
+ fileapi::FileSystemFileUtilProxy::Close(
+ *context(), message_loop_proxy_, file_handle_,
+ fileapi::FileSystemFileUtilProxy::StatusCallback());
+ }
+
+ virtual void RunWork() {
+ set_error_code(file_util()->CreateOrOpen(
+ context(), file_path_, file_flags_, &file_handle_, &created_));
+ }
+
+ virtual void RunCallback() {
+ callback_.Run(error_code(), base::PassPlatformFile(&file_handle_),
+ created_);
+ }
+
+ private:
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+ FilePath file_path_;
+ int file_flags_;
+ fileapi::FileSystemFileUtilProxy::CreateOrOpenCallback callback_;
+ base::PlatformFile file_handle_;
+ bool created_;
+};
+
class RelayWithStatusCallback : public MessageLoopRelay {
public:
RelayWithStatusCallback(
@@ -92,6 +137,24 @@
fileapi::FileSystemFileUtilProxy::StatusCallback callback_;
};
+class RelayClose : public RelayWithStatusCallback {
+ public:
+ RelayClose(const fileapi::FileSystemOperationContext& context,
+ base::PlatformFile file_handle,
+ const fileapi::FileSystemFileUtilProxy::StatusCallback& callback)
+ : RelayWithStatusCallback(context, callback),
+ file_handle_(file_handle) {
+ }
+
+ protected:
+ virtual void RunWork() {
+ set_error_code(file_util()->Close(context(), file_handle_));
+ }
+
+ private:
+ base::PlatformFile file_handle_;
+};
+
class RelayEnsureFileExists : public MessageLoopRelay {
public:
RelayEnsureFileExists(
@@ -362,6 +425,26 @@
namespace fileapi {
// static
+bool FileSystemFileUtilProxy::CreateOrOpen(
+ const FileSystemOperationContext& context,
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ const FilePath& file_path, int file_flags,
+ const CreateOrOpenCallback& callback) {
+ return Start(FROM_HERE, message_loop_proxy, new RelayCreateOrOpen(context,
+ message_loop_proxy, file_path, file_flags, callback));
+}
+
+// static
+bool FileSystemFileUtilProxy::Close(
+ const FileSystemOperationContext& context,
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ base::PlatformFile file_handle,
+ const StatusCallback& callback) {
+ return Start(FROM_HERE, message_loop_proxy,
+ new RelayClose(context, file_handle, callback));
+}
+
+// static
bool FileSystemFileUtilProxy::EnsureFileExists(
const FileSystemOperationContext& context,
scoped_refptr<MessageLoopProxy> message_loop_proxy,
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.h ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698