Chromium Code Reviews| Index: ppapi/proxy/file_io_resource.cc |
| diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc |
| index f4fa6a50f87434998befcc4fb6183c58db4f66df..a35c9ece3d7ebb11169a71e58ebea1bd2c070136 100644 |
| --- a/ppapi/proxy/file_io_resource.cc |
| +++ b/ppapi/proxy/file_io_resource.cc |
| @@ -57,8 +57,11 @@ FileIOResource::QueryOp::~QueryOp() { |
| } |
| int32_t FileIOResource::QueryOp::DoWork() { |
| - return base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info_) ? |
| - PP_OK : PP_ERROR_FAILED; |
| + // TODO(rvargas): Convert this code to use base::File. |
| + base::File file(file_handle_->raw_handle()); |
| + bool success = file.GetInfo(&file_info_); |
| + file.TakePlatformFile(); |
|
dmichael (off chromium)
2014/01/24 17:22:51
nit: This should probably have a comment about why
rvargas (doing something else)
2014/01/24 18:56:43
file_handle_ has to be changed to base::File. That
dmichael (off chromium)
2014/01/24 19:33:33
Okay, that's fine. You can make these TODO(dmichae
|
| + return success ? PP_OK : PP_ERROR_FAILED; |
| } |
| FileIOResource::ReadOp::ReadOp(scoped_refptr<FileHandleHolder> file_handle, |
| @@ -188,21 +191,25 @@ int32_t FileIOResource::Query(PP_FileInfo* info, |
| // If the callback is blocking, perform the task on the calling thread. |
| if (callback->is_blocking()) { |
| int32_t result = PP_ERROR_FAILED; |
| - base::PlatformFileInfo file_info; |
| + base::File::Info file_info; |
| // The plugin could release its reference to this instance when we release |
| // the proxy lock below. |
| scoped_refptr<FileIOResource> protect(this); |
| { |
| // Release the proxy lock while making a potentially slow file call. |
| ProxyAutoUnlock unlock; |
| - if (base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info)) |
| + // TODO(rvargas): Convert this code to base::File. |
| + base::File file(file_handle_->raw_handle()); |
| + bool success = file.GetInfo(&file_info); |
| + file.TakePlatformFile(); |
| + if (success) |
| result = PP_OK; |
| } |
| if (result == PP_OK) { |
| // This writes the file info into the plugin's PP_FileInfo struct. |
| - ppapi::PlatformFileInfoToPepperFileInfo(file_info, |
| - file_system_type_, |
| - info); |
| + ppapi::FileInfoToPepperFileInfo(file_info, |
| + file_system_type_, |
| + info); |
| } |
| state_manager_.SetOperationFinished(); |
| return result; |
| @@ -547,9 +554,9 @@ int32_t FileIOResource::OnQueryComplete(scoped_refptr<QueryOp> query_op, |
| if (result == PP_OK) { |
| // This writes the file info into the plugin's PP_FileInfo struct. |
| - ppapi::PlatformFileInfoToPepperFileInfo(query_op->file_info(), |
| - file_system_type_, |
| - info); |
| + ppapi::FileInfoToPepperFileInfo(query_op->file_info(), |
| + file_system_type_, |
| + info); |
| } |
| state_manager_.SetOperationFinished(); |
| return result; |