Index: webkit/plugins/ppapi/quota_file_io.cc |
diff --git a/webkit/plugins/ppapi/quota_file_io.cc b/webkit/plugins/ppapi/quota_file_io.cc |
index 84c44e3e833bdea0e8b55073ed7b1288e54d38ca..dc768fae25d217bcdfee22e6d364bfb222e9eee0 100644 |
--- a/webkit/plugins/ppapi/quota_file_io.cc |
+++ b/webkit/plugins/ppapi/quota_file_io.cc |
@@ -11,6 +11,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop_proxy.h" |
#include "base/stl_util.h" |
+#include "base/task_runner_util.h" |
#include "webkit/plugins/ppapi/host_globals.h" |
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
#include "webkit/plugins/ppapi/resource_helper.h" |
@@ -100,10 +101,13 @@ class QuotaFileIO::WriteOperation : public PendingOperationBase { |
return; |
} |
- if (!base::FileUtilProxy::Write( |
- plugin_delegate->GetFileThreadMessageLoopProxy(), |
- quota_io_->file_, offset_, buffer_.get(), bytes_to_write_, |
- base::Bind(&WriteOperation::DidFinish, |
+ if (!base::PostTaskAndReplyWithResult( |
+ plugin_delegate->GetFileThreadMessageLoopProxy(), FROM_HERE, |
+ base::Bind(&base::WritePlatformFile, |
+ quota_io_->file_, offset_, |
+ base::Owned(buffer_.release()), |
+ bytes_to_write_), |
+ base::Bind(&WriteOperation::DidWrite, |
weak_factory_.GetWeakPtr()))) { |
DidFail(base::PLATFORM_FILE_ERROR_FAILED); |
return; |
@@ -123,6 +127,12 @@ class QuotaFileIO::WriteOperation : public PendingOperationBase { |
} |
private: |
+ void DidWrite(int bytes_written) { |
+ base::PlatformFileError error = bytes_written >= 0 ? |
brettw
2013/01/09 20:17:10
What happens if you write 0 bytes? It looks like b
tzik
2013/01/10 04:02:36
Right, this changes its behavior for 0-byte write.
|
+ base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_FAILED; |
+ DidFinish(error, bytes_written); |
+ } |
+ |
void DidFinish(PlatformFileError status, int bytes_written) { |
finished_ = true; |
status_ = status; |