summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 21:36:00 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 21:36:00 +0000
commit141bcc5b660175f90a351d0b1fc412eecbeb70e6 (patch)
tree8e168b52c493c7de6b18f7d06efeffa2971e5b03 /ppapi
parent1f0a90767aadea0859d037be675106941338c5e5 (diff)
downloadchromium_src-141bcc5b660175f90a351d0b1fc412eecbeb70e6.zip
chromium_src-141bcc5b660175f90a351d0b1fc412eecbeb70e6.tar.gz
chromium_src-141bcc5b660175f90a351d0b1fc412eecbeb70e6.tar.bz2
Convert Media Galleries to use base::File
Unfortunately, this brings in changes to webkit/browser/fileapi, and once that changes, a lot of files have to be updated. The bright side is that most of the collateral changes are just trivial renaming of PlatformFileError -> File::Error and PlatformFileInfo -> File::Info BUG=322664 Review URL: https://codereview.chromium.org/145303002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/file_io_resource.cc27
-rw-r--r--ppapi/proxy/file_io_resource.h5
-rw-r--r--ppapi/proxy/flash_file_resource.cc2
-rw-r--r--ppapi/proxy/ppapi_messages.h2
-rw-r--r--ppapi/shared_impl/file_type_conversion.cc27
-rw-r--r--ppapi/shared_impl/file_type_conversion.h9
6 files changed, 40 insertions, 32 deletions
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
index f4fa6a5..a35c9ec 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();
+ 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;
diff --git a/ppapi/proxy/file_io_resource.h b/ppapi/proxy/file_io_resource.h
index 38ac683..d6465fd 100644
--- a/ppapi/proxy/file_io_resource.h
+++ b/ppapi/proxy/file_io_resource.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "ppapi/c/private/pp_file_handle.h"
@@ -111,14 +112,14 @@ class PPAPI_PROXY_EXPORT FileIOResource
// thread (blocking). This should not be called when we hold the proxy lock.
int32_t DoWork();
- const base::PlatformFileInfo& file_info() const { return file_info_; }
+ const base::File::Info& file_info() const { return file_info_; }
private:
friend class base::RefCountedThreadSafe<QueryOp>;
~QueryOp();
scoped_refptr<FileHandleHolder> file_handle_;
- base::PlatformFileInfo file_info_;
+ base::File::Info file_info_;
};
// Class to perform file read operations across multiple threads.
diff --git a/ppapi/proxy/flash_file_resource.cc b/ppapi/proxy/flash_file_resource.cc
index ce7a2ce..6b8fc6c 100644
--- a/ppapi/proxy/flash_file_resource.cc
+++ b/ppapi/proxy/flash_file_resource.cc
@@ -206,7 +206,7 @@ int32_t FlashFileResource::QueryFileHelper(const std::string& path,
if (path.empty() || !info)
return PP_ERROR_BADARGUMENT;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path));
int32_t error = SyncCall<PpapiPluginMsg_FlashFile_QueryFileReply>(BROWSER,
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 1cd3e14..76fa380 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1926,7 +1926,7 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_CreateDir,
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_QueryFile,
ppapi::PepperFilePath /* path */)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFile_QueryFileReply,
- base::PlatformFileInfo /* file_info */)
+ base::File::Info /* file_info */)
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_GetDirContents,
ppapi::PepperFilePath /* path */)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFile_GetDirContentsReply,
diff --git a/ppapi/shared_impl/file_type_conversion.cc b/ppapi/shared_impl/file_type_conversion.cc
index 1a4bb16..0b94725 100644
--- a/ppapi/shared_impl/file_type_conversion.cc
+++ b/ppapi/shared_impl/file_type_conversion.cc
@@ -5,30 +5,31 @@
#include "ppapi/shared_impl/file_type_conversion.h"
#include "base/logging.h"
+#include "base/platform_file.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/shared_impl/time_conversion.h"
namespace ppapi {
-int PlatformFileErrorToPepperError(base::PlatformFileError error_code) {
+int FileErrorToPepperError(base::File::Error error_code) {
switch (error_code) {
- case base::PLATFORM_FILE_OK:
+ case base::File::FILE_OK:
return PP_OK;
- case base::PLATFORM_FILE_ERROR_EXISTS:
+ case base::File::FILE_ERROR_EXISTS:
return PP_ERROR_FILEEXISTS;
- case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ case base::File::FILE_ERROR_NOT_FOUND:
return PP_ERROR_FILENOTFOUND;
- case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
- case base::PLATFORM_FILE_ERROR_SECURITY:
+ case base::File::FILE_ERROR_ACCESS_DENIED:
+ case base::File::FILE_ERROR_SECURITY:
return PP_ERROR_NOACCESS;
- case base::PLATFORM_FILE_ERROR_NO_MEMORY:
+ case base::File::FILE_ERROR_NO_MEMORY:
return PP_ERROR_NOMEMORY;
- case base::PLATFORM_FILE_ERROR_NO_SPACE:
+ case base::File::FILE_ERROR_NO_SPACE:
return PP_ERROR_NOSPACE;
- case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY:
+ case base::File::FILE_ERROR_NOT_A_DIRECTORY:
return PP_ERROR_FAILED;
- case base::PLATFORM_FILE_ERROR_NOT_A_FILE:
+ case base::File::FILE_ERROR_NOT_A_FILE:
return PP_ERROR_NOTAFILE;
default:
return PP_ERROR_FAILED;
@@ -80,9 +81,9 @@ bool PepperFileOpenFlagsToPlatformFileFlags(int32_t pp_open_flags,
return true;
}
-void PlatformFileInfoToPepperFileInfo(const base::PlatformFileInfo& info,
- PP_FileSystemType fs_type,
- PP_FileInfo* info_out) {
+void FileInfoToPepperFileInfo(const base::File::Info& info,
+ PP_FileSystemType fs_type,
+ PP_FileInfo* info_out) {
DCHECK(info_out);
info_out->size = info.size;
info_out->creation_time = TimeToPPTime(info.creation_time);
diff --git a/ppapi/shared_impl/file_type_conversion.h b/ppapi/shared_impl/file_type_conversion.h
index c41b79b..7c5454d 100644
--- a/ppapi/shared_impl/file_type_conversion.h
+++ b/ppapi/shared_impl/file_type_conversion.h
@@ -5,7 +5,7 @@
#ifndef PPAPI_SHARED_IMPL_FILE_TYPE_CONVERSION_H_
#define PPAPI_SHARED_IMPL_FILE_TYPE_CONVERSION_H_
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/ppb_file_system.h"
@@ -13,8 +13,7 @@
namespace ppapi {
-PPAPI_SHARED_EXPORT int PlatformFileErrorToPepperError(
- base::PlatformFileError error_code);
+PPAPI_SHARED_EXPORT int FileErrorToPepperError(base::File::Error error_code);
// Converts a PP_FileOpenFlags_Dev flag combination into a corresponding
// PlatformFileFlags flag combination.
@@ -23,8 +22,8 @@ PPAPI_SHARED_EXPORT bool PepperFileOpenFlagsToPlatformFileFlags(
int32_t pp_open_flags,
int* flags_out);
-PPAPI_SHARED_EXPORT void PlatformFileInfoToPepperFileInfo(
- const base::PlatformFileInfo& info,
+PPAPI_SHARED_EXPORT void FileInfoToPepperFileInfo(
+ const base::File::Info& info,
PP_FileSystemType fs_type,
PP_FileInfo* info_out);