Index: webkit/plugins/ppapi/ppb_file_io_impl.cc |
diff --git a/webkit/plugins/ppapi/ppb_file_io_impl.cc b/webkit/plugins/ppapi/ppb_file_io_impl.cc |
index 351d232718d9d92c5b2b9f60e57e62009e6938dc..c24c774ec55917c911441495a9e775153b8c5506 100644 |
--- a/webkit/plugins/ppapi/ppb_file_io_impl.cc |
+++ b/webkit/plugins/ppapi/ppb_file_io_impl.cc |
@@ -16,11 +16,11 @@ |
#include "ppapi/c/trusted/ppb_file_io_trusted.h" |
#include "ppapi/c/pp_completion_callback.h" |
#include "ppapi/c/pp_errors.h" |
+#include "ppapi/shared_impl/file_type_conversion.h" |
#include "ppapi/shared_impl/time_conversion.h" |
#include "ppapi/thunk/enter.h" |
#include "ppapi/thunk/ppb_file_ref_api.h" |
#include "webkit/plugins/ppapi/common.h" |
-#include "webkit/plugins/ppapi/file_type_conversions.h" |
#include "webkit/plugins/ppapi/plugin_module.h" |
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
#include "webkit/plugins/ppapi/ppb_file_ref_impl.h" |
@@ -29,31 +29,14 @@ |
using ppapi::PPTimeToTime; |
using ppapi::TimeToPPTime; |
-using ppapi::thunk::EnterResourceNoLock; |
-using ppapi::thunk::PPB_FileIO_API; |
using ppapi::thunk::PPB_FileRef_API; |
namespace webkit { |
namespace ppapi { |
-PPB_FileIO_Impl::CallbackEntry::CallbackEntry() |
- : read_buffer(NULL) { |
-} |
- |
-PPB_FileIO_Impl::CallbackEntry::CallbackEntry(const CallbackEntry& entry) |
- : callback(entry.callback), |
- read_buffer(entry.read_buffer) { |
-} |
- |
-PPB_FileIO_Impl::CallbackEntry::~CallbackEntry() { |
-} |
- |
PPB_FileIO_Impl::PPB_FileIO_Impl(PP_Instance instance) |
- : Resource(instance), |
+ : ::ppapi::FileIOImpl(instance), |
file_(base::kInvalidPlatformFileValue), |
- file_system_type_(PP_FILESYSTEMTYPE_INVALID), |
- pending_op_(OPERATION_NONE), |
- info_(NULL), |
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
} |
@@ -61,41 +44,25 @@ PPB_FileIO_Impl::~PPB_FileIO_Impl() { |
Close(); |
} |
-PPB_FileIO_API* PPB_FileIO_Impl::AsPPB_FileIO_API() { |
- return this; |
-} |
- |
-int32_t PPB_FileIO_Impl::Open(PP_Resource pp_file_ref, |
- int32_t open_flags, |
- PP_CompletionCallback callback) { |
- EnterResourceNoLock<PPB_FileRef_API> enter(pp_file_ref, true); |
- if (enter.failed()) |
- return PP_ERROR_BADRESOURCE; |
- PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(enter.object()); |
- |
- int32_t rv = CommonCallValidation(false, OPERATION_EXCLUSIVE, callback); |
- if (rv != PP_OK) |
- return rv; |
+int32_t PPB_FileIO_Impl::OpenValidated(PP_Resource file_ref_resource, |
+ PPB_FileRef_API* file_ref_api, |
+ int32_t open_flags, |
+ PP_CompletionCallback callback) { |
+ PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(file_ref_api); |
int flags = 0; |
- if (!PepperFileOpenFlagsToPlatformFileFlags(open_flags, &flags)) |
+ if (!::ppapi::PepperFileOpenFlagsToPlatformFileFlags(open_flags, &flags)) |
return PP_ERROR_BADARGUMENT; |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (!plugin_delegate) |
- return false; |
- |
- file_system_type_ = file_ref->GetFileSystemType(); |
- if (file_system_type_ != PP_FILESYSTEMTYPE_LOCALPERSISTENT && |
- file_system_type_ != PP_FILESYSTEMTYPE_LOCALTEMPORARY && |
- file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) |
- return PP_ERROR_FAILED; |
+ return PP_ERROR_BADARGUMENT; |
if (file_ref->HasValidFileSystem()) { |
file_system_url_ = file_ref->GetFileSystemURL(); |
if (!plugin_delegate->AsyncOpenFileSystemURL( |
file_system_url_, flags, |
- base::Bind(&PPB_FileIO_Impl::AsyncOpenFileCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformOpenFileCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
} else { |
@@ -103,49 +70,35 @@ int32_t PPB_FileIO_Impl::Open(PP_Resource pp_file_ref, |
return PP_ERROR_FAILED; |
if (!plugin_delegate->AsyncOpenFile( |
file_ref->GetSystemPath(), flags, |
- base::Bind(&PPB_FileIO_Impl::AsyncOpenFileCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformOpenFileCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
} |
- RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); |
+ RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
-int32_t PPB_FileIO_Impl::Query(PP_FileInfo* info, |
- PP_CompletionCallback callback) { |
- int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); |
- if (rv != PP_OK) |
- return rv; |
- |
- if (!info) |
- return PP_ERROR_BADARGUMENT; |
- |
- DCHECK(!info_); // If |info_|, a callback should be pending (caught above). |
- info_ = info; |
- |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+int32_t PPB_FileIO_Impl::QueryValidated(PP_FileInfo* info, |
+ PP_CompletionCallback callback) { |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (!plugin_delegate) |
return PP_ERROR_FAILED; |
if (!base::FileUtilProxy::GetFileInfoFromPlatformFile( |
plugin_delegate->GetFileThreadMessageLoopProxy(), file_, |
- base::Bind(&PPB_FileIO_Impl::QueryInfoCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformQueryCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
- RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); |
+ RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, info); |
return PP_OK_COMPLETIONPENDING; |
} |
-int32_t PPB_FileIO_Impl::Touch(PP_Time last_access_time, |
- PP_Time last_modified_time, |
- PP_CompletionCallback callback) { |
- int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); |
- if (rv != PP_OK) |
- return rv; |
- |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+int32_t PPB_FileIO_Impl::TouchValidated(PP_Time last_access_time, |
+ PP_Time last_modified_time, |
+ PP_CompletionCallback callback) { |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (!plugin_delegate) |
return PP_ERROR_FAILED; |
@@ -153,117 +106,101 @@ int32_t PPB_FileIO_Impl::Touch(PP_Time last_access_time, |
plugin_delegate->GetFileThreadMessageLoopProxy(), |
file_, PPTimeToTime(last_access_time), |
PPTimeToTime(last_modified_time), |
- base::Bind(&PPB_FileIO_Impl::StatusCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformGeneralCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
- RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); |
+ RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
-int32_t PPB_FileIO_Impl::Read(int64_t offset, |
- char* buffer, |
- int32_t bytes_to_read, |
- PP_CompletionCallback callback) { |
- int32_t rv = CommonCallValidation(true, OPERATION_READ, callback); |
- if (rv != PP_OK) |
- return rv; |
- |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+int32_t PPB_FileIO_Impl::ReadValidated(int64_t offset, |
+ char* buffer, |
+ int32_t bytes_to_read, |
+ PP_CompletionCallback callback) { |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (!plugin_delegate) |
return PP_ERROR_FAILED; |
if (!base::FileUtilProxy::Read( |
plugin_delegate->GetFileThreadMessageLoopProxy(), file_, offset, |
bytes_to_read, |
- base::Bind(&PPB_FileIO_Impl::ReadCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformReadCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
- RegisterCallback(OPERATION_READ, callback, buffer); |
+ RegisterCallback(OPERATION_READ, callback, buffer, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
-int32_t PPB_FileIO_Impl::Write(int64_t offset, |
- const char* buffer, |
- int32_t bytes_to_write, |
- PP_CompletionCallback callback) { |
- int32_t rv = CommonCallValidation(true, OPERATION_WRITE, callback); |
- if (rv != PP_OK) |
- return rv; |
- |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+int32_t PPB_FileIO_Impl::WriteValidated(int64_t offset, |
+ const char* buffer, |
+ int32_t bytes_to_write, |
+ PP_CompletionCallback callback) { |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (!plugin_delegate) |
return PP_ERROR_FAILED; |
if (quota_file_io_.get()) { |
if (!quota_file_io_->Write( |
offset, buffer, bytes_to_write, |
- base::Bind(&PPB_FileIO_Impl::WriteCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformWriteCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
} else { |
if (!base::FileUtilProxy::Write( |
plugin_delegate->GetFileThreadMessageLoopProxy(), file_, offset, |
buffer, bytes_to_write, |
- base::Bind(&PPB_FileIO_Impl::WriteCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformWriteCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
} |
- RegisterCallback(OPERATION_WRITE, callback, NULL); |
+ RegisterCallback(OPERATION_WRITE, callback, NULL, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
-int32_t PPB_FileIO_Impl::SetLength(int64_t length, |
- PP_CompletionCallback callback) { |
- int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); |
- if (rv != PP_OK) |
- return rv; |
- |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+int32_t PPB_FileIO_Impl::SetLengthValidated(int64_t length, |
+ PP_CompletionCallback callback) { |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (!plugin_delegate) |
return PP_ERROR_FAILED; |
if (quota_file_io_.get()) { |
if (!quota_file_io_->SetLength( |
length, |
- base::Bind(&PPB_FileIO_Impl::StatusCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformGeneralCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
} else { |
if (!base::FileUtilProxy::Truncate( |
plugin_delegate->GetFileThreadMessageLoopProxy(), file_, length, |
- base::Bind(&PPB_FileIO_Impl::StatusCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformGeneralCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
} |
- RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); |
+ RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
-int32_t PPB_FileIO_Impl::Flush(PP_CompletionCallback callback) { |
- int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); |
- if (rv != PP_OK) |
- return rv; |
- |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+int32_t PPB_FileIO_Impl::FlushValidated(PP_CompletionCallback callback) { |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (!plugin_delegate) |
return PP_ERROR_FAILED; |
if (!base::FileUtilProxy::Flush( |
plugin_delegate->GetFileThreadMessageLoopProxy(), file_, |
- base::Bind(&PPB_FileIO_Impl::StatusCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformGeneralCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
- RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); |
+ RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
void PPB_FileIO_Impl::Close() { |
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); |
+ PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (file_ != base::kInvalidPlatformFileValue && plugin_delegate) { |
base::FileUtilProxy::Close( |
plugin_delegate->GetFileThreadMessageLoopProxy(), file_, |
@@ -295,11 +232,11 @@ int32_t PPB_FileIO_Impl::WillWrite(int64_t offset, |
if (!quota_file_io_->WillWrite( |
offset, bytes_to_write, |
- base::Bind(&PPB_FileIO_Impl::WillWriteCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformWillWriteCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
- RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); |
+ RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
@@ -314,85 +251,26 @@ int32_t PPB_FileIO_Impl::WillSetLength(int64_t length, |
if (!quota_file_io_->WillSetLength( |
length, |
- base::Bind(&PPB_FileIO_Impl::StatusCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecutePlatformGeneralCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
- RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); |
+ RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
return PP_OK_COMPLETIONPENDING; |
} |
-int32_t PPB_FileIO_Impl::CommonCallValidation(bool should_be_open, |
- OperationType new_op, |
- PP_CompletionCallback callback) { |
- // Only asynchronous operation is supported. |
- if (!callback.func) |
- return PP_ERROR_BLOCKS_MAIN_THREAD; |
- |
- if (should_be_open) { |
- if (file_ == base::kInvalidPlatformFileValue) |
- return PP_ERROR_FAILED; |
- } else { |
- if (file_ != base::kInvalidPlatformFileValue) |
- return PP_ERROR_FAILED; |
- } |
- |
- if (pending_op_ != OPERATION_NONE && |
- (pending_op_ != new_op || pending_op_ == OPERATION_EXCLUSIVE)) { |
- return PP_ERROR_INPROGRESS; |
- } |
- |
- return PP_OK; |
-} |
- |
-void PPB_FileIO_Impl::RegisterCallback(OperationType op, |
- PP_CompletionCallback callback, |
- char* read_buffer) { |
- DCHECK(callback.func); |
- DCHECK(pending_op_ == OPERATION_NONE || |
- (pending_op_ != OPERATION_EXCLUSIVE && pending_op_ == op)); |
- |
- PluginModule* plugin_module = ResourceHelper::GetPluginModule(this); |
- if (!plugin_module) |
- return; |
- |
- CallbackEntry entry; |
- entry.callback = new TrackedCompletionCallback( |
- plugin_module->GetCallbackTracker(), pp_resource(), callback); |
- entry.read_buffer = read_buffer; |
- |
- callbacks_.push(entry); |
- pending_op_ = op; |
-} |
- |
-void PPB_FileIO_Impl::RunAndRemoveFirstPendingCallback(int32_t result) { |
- DCHECK(!callbacks_.empty()); |
- |
- CallbackEntry front = callbacks_.front(); |
- callbacks_.pop(); |
- if (callbacks_.empty()) |
- pending_op_ = OPERATION_NONE; |
- |
- front.callback->Run(result); // Will complete abortively if necessary. |
+PluginDelegate* PPB_FileIO_Impl::GetPluginDelegate() { |
+ return ResourceHelper::GetPluginDelegate(this); |
} |
-void PPB_FileIO_Impl::StatusCallback(base::PlatformFileError error_code) { |
- if (pending_op_ != OPERATION_EXCLUSIVE || callbacks_.empty()) { |
- NOTREACHED(); |
- return; |
- } |
- |
- RunAndRemoveFirstPendingCallback(PlatformFileErrorToPepperError(error_code)); |
+void PPB_FileIO_Impl::ExecutePlatformGeneralCallback( |
+ base::PlatformFileError error_code) { |
+ ExecuteGeneralCallback(::ppapi::PlatformFileErrorToPepperError(error_code)); |
} |
-void PPB_FileIO_Impl::AsyncOpenFileCallback( |
+void PPB_FileIO_Impl::ExecutePlatformOpenFileCallback( |
base::PlatformFileError error_code, |
base::PassPlatformFile file) { |
- if (pending_op_ != OPERATION_EXCLUSIVE || callbacks_.empty()) { |
- NOTREACHED(); |
- return; |
- } |
- |
DCHECK(file_ == base::kInvalidPlatformFileValue); |
file_ = file.ReleaseValue(); |
@@ -404,73 +282,46 @@ void PPB_FileIO_Impl::AsyncOpenFileCallback( |
pp_instance(), file_, file_system_url_, file_system_type_)); |
} |
- RunAndRemoveFirstPendingCallback(PlatformFileErrorToPepperError(error_code)); |
+ ExecuteOpenFileCallback(::ppapi::PlatformFileErrorToPepperError(error_code)); |
} |
-void PPB_FileIO_Impl::QueryInfoCallback( |
+void PPB_FileIO_Impl::ExecutePlatformQueryCallback( |
base::PlatformFileError error_code, |
const base::PlatformFileInfo& file_info) { |
- if (pending_op_ != OPERATION_EXCLUSIVE || callbacks_.empty()) { |
- NOTREACHED(); |
- return; |
- } |
- |
- DCHECK(info_); |
- if (error_code == base::PLATFORM_FILE_OK) { |
- info_->size = file_info.size; |
- info_->creation_time = TimeToPPTime(file_info.creation_time); |
- info_->last_access_time = TimeToPPTime(file_info.last_accessed); |
- info_->last_modified_time = TimeToPPTime(file_info.last_modified); |
- info_->system_type = file_system_type_; |
- if (file_info.is_directory) |
- info_->type = PP_FILETYPE_DIRECTORY; |
- else |
- info_->type = PP_FILETYPE_REGULAR; |
- } |
- info_ = NULL; |
- RunAndRemoveFirstPendingCallback(PlatformFileErrorToPepperError(error_code)); |
+ PP_FileInfo pp_info; |
+ pp_info.size = file_info.size; |
+ pp_info.creation_time = TimeToPPTime(file_info.creation_time); |
+ pp_info.last_access_time = TimeToPPTime(file_info.last_accessed); |
+ pp_info.last_modified_time = TimeToPPTime(file_info.last_modified); |
+ pp_info.system_type = file_system_type_; |
+ if (file_info.is_directory) |
+ pp_info.type = PP_FILETYPE_DIRECTORY; |
+ else |
+ pp_info.type = PP_FILETYPE_REGULAR; |
+ |
+ ExecuteQueryCallback(::ppapi::PlatformFileErrorToPepperError(error_code), |
+ pp_info); |
} |
-void PPB_FileIO_Impl::ReadCallback(base::PlatformFileError error_code, |
- const char* data, int bytes_read) { |
- if (pending_op_ != OPERATION_READ || callbacks_.empty()) { |
- NOTREACHED(); |
- return; |
- } |
- |
- char* read_buffer = callbacks_.front().read_buffer; |
- DCHECK(data); |
- DCHECK(read_buffer); |
- |
- int rv; |
- if (error_code == base::PLATFORM_FILE_OK) { |
- rv = bytes_read; |
- if (file_ != base::kInvalidPlatformFileValue) |
- memcpy(read_buffer, data, bytes_read); |
- } else { |
- rv = PlatformFileErrorToPepperError(error_code); |
- } |
- |
- RunAndRemoveFirstPendingCallback(rv); |
+void PPB_FileIO_Impl::ExecutePlatformReadCallback( |
+ base::PlatformFileError error_code, |
+ const char* data, int bytes_read) { |
+ // Map the error code, OK getting mapped to the # of bytes read. |
+ int32_t pp_result = ::ppapi::PlatformFileErrorToPepperError(error_code); |
+ pp_result = pp_result == PP_OK ? bytes_read : pp_result; |
+ ExecuteReadCallback(pp_result, data); |
} |
-void PPB_FileIO_Impl::WriteCallback(base::PlatformFileError error_code, |
- int bytes_written) { |
- if (pending_op_ != OPERATION_WRITE || callbacks_.empty()) { |
- NOTREACHED(); |
- return; |
- } |
- |
- if (error_code != base::PLATFORM_FILE_OK) { |
- RunAndRemoveFirstPendingCallback( |
- PlatformFileErrorToPepperError(error_code)); |
- } else { |
- RunAndRemoveFirstPendingCallback(bytes_written); |
- } |
+void PPB_FileIO_Impl::ExecutePlatformWriteCallback( |
+ base::PlatformFileError error_code, |
+ int bytes_written) { |
+ int32_t pp_result = ::ppapi::PlatformFileErrorToPepperError(error_code); |
+ ExecuteGeneralCallback(pp_result == PP_OK ? bytes_written : pp_result); |
} |
-void PPB_FileIO_Impl::WillWriteCallback(base::PlatformFileError error_code, |
- int bytes_written) { |
+void PPB_FileIO_Impl::ExecutePlatformWillWriteCallback( |
+ base::PlatformFileError error_code, |
+ int bytes_written) { |
if (pending_op_ != OPERATION_EXCLUSIVE || callbacks_.empty()) { |
NOTREACHED(); |
return; |
@@ -478,7 +329,7 @@ void PPB_FileIO_Impl::WillWriteCallback(base::PlatformFileError error_code, |
if (error_code != base::PLATFORM_FILE_OK) { |
RunAndRemoveFirstPendingCallback( |
- PlatformFileErrorToPepperError(error_code)); |
+ ::ppapi::PlatformFileErrorToPepperError(error_code)); |
} else { |
RunAndRemoveFirstPendingCallback(bytes_written); |
} |