summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 00:01:03 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 00:01:03 +0000
commit35b05b176d2a90ee1b683f62fa2bc57188d16058 (patch)
tree2512dcafdb4b6719c4a4306828298785ce8da57a /ppapi
parent7a8106e7271d718bcd8818b3340543a6204b4068 (diff)
downloadchromium_src-35b05b176d2a90ee1b683f62fa2bc57188d16058.zip
chromium_src-35b05b176d2a90ee1b683f62fa2bc57188d16058.tar.gz
chromium_src-35b05b176d2a90ee1b683f62fa2bc57188d16058.tar.bz2
Remove PlatformFile from ppapi
BUG=322664 Review URL: https://codereview.chromium.org/304513007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/nacl_irt/ppapi_dispatcher.h2
-rw-r--r--ppapi/proxy/file_io_resource.cc87
-rw-r--r--ppapi/proxy/file_io_resource.h55
-rw-r--r--ppapi/proxy/file_mapping_resource.cc8
-rw-r--r--ppapi/proxy/file_mapping_resource.h2
-rw-r--r--ppapi/proxy/file_mapping_resource_posix.cc4
-rw-r--r--ppapi/proxy/file_mapping_resource_win.cc2
-rw-r--r--ppapi/proxy/ppp_content_decryptor_private_proxy.cc2
-rw-r--r--ppapi/proxy/proxy_channel.cc6
-rw-r--r--ppapi/proxy/serialized_handle.cc10
-rw-r--r--ppapi/shared_impl/file_type_conversion.cc19
-rw-r--r--ppapi/shared_impl/platform_file.h2
-rw-r--r--ppapi/shared_impl/var.h1
13 files changed, 88 insertions, 112 deletions
diff --git a/ppapi/nacl_irt/ppapi_dispatcher.h b/ppapi/nacl_irt/ppapi_dispatcher.h
index 21829db..ebbef820 100644
--- a/ppapi/nacl_irt/ppapi_dispatcher.h
+++ b/ppapi/nacl_irt/ppapi_dispatcher.h
@@ -9,8 +9,8 @@
#include <set>
#include <string>
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
#include "base/process/process_handle.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_platform_file.h"
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
index 0564fdf..61b1a20 100644
--- a/ppapi/proxy/file_io_resource.cc
+++ b/ppapi/proxy/file_io_resource.cc
@@ -39,8 +39,7 @@ void* DummyGetDataBuffer(void* user_data, uint32_t count, uint32_t size) {
}
// File thread task to close the file handle.
-void DoClose(base::PlatformFile file) {
- base::ClosePlatformFile(file);
+void DoClose(base::File auto_close_file) {
}
} // namespace
@@ -48,29 +47,25 @@ void DoClose(base::PlatformFile file) {
namespace ppapi {
namespace proxy {
-FileIOResource::QueryOp::QueryOp(scoped_refptr<FileHandleHolder> file_handle)
- : file_handle_(file_handle) {
- DCHECK(file_handle_);
+FileIOResource::QueryOp::QueryOp(scoped_refptr<FileHolder> file_holder)
+ : file_holder_(file_holder) {
+ DCHECK(file_holder_);
}
FileIOResource::QueryOp::~QueryOp() {
}
int32_t FileIOResource::QueryOp::DoWork() {
- // 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;
+ return file_holder_->file()->GetInfo(&file_info_) ? PP_OK : PP_ERROR_FAILED;
}
-FileIOResource::ReadOp::ReadOp(scoped_refptr<FileHandleHolder> file_handle,
+FileIOResource::ReadOp::ReadOp(scoped_refptr<FileHolder> file_holder,
int64_t offset,
int32_t bytes_to_read)
- : file_handle_(file_handle),
+ : file_holder_(file_holder),
offset_(offset),
bytes_to_read_(bytes_to_read) {
- DCHECK(file_handle_);
+ DCHECK(file_holder_);
}
FileIOResource::ReadOp::~ReadOp() {
@@ -79,16 +74,15 @@ FileIOResource::ReadOp::~ReadOp() {
int32_t FileIOResource::ReadOp::DoWork() {
DCHECK(!buffer_.get());
buffer_.reset(new char[bytes_to_read_]);
- return base::ReadPlatformFile(
- file_handle_->raw_handle(), offset_, buffer_.get(), bytes_to_read_);
+ return file_holder_->file()->Read(offset_, buffer_.get(), bytes_to_read_);
}
-FileIOResource::WriteOp::WriteOp(scoped_refptr<FileHandleHolder> file_handle,
+FileIOResource::WriteOp::WriteOp(scoped_refptr<FileHolder> file_holder,
int64_t offset,
scoped_ptr<char[]> buffer,
int32_t bytes_to_write,
bool append)
- : file_handle_(file_handle),
+ : file_holder_(file_holder),
offset_(offset),
buffer_(buffer.Pass()),
bytes_to_write_(bytes_to_write),
@@ -102,11 +96,10 @@ int32_t FileIOResource::WriteOp::DoWork() {
// In append mode, we can't call WritePlatformFile, since NaCl doesn't
// implement fcntl, causing the function to call pwrite, which is incorrect.
if (append_) {
- return base::WritePlatformFileAtCurrentPos(
- file_handle_->raw_handle(), buffer_.get(), bytes_to_write_);
+ return file_holder_->file()->WriteAtCurrentPos(buffer_.get(),
+ bytes_to_write_);
} else {
- return base::WritePlatformFile(
- file_handle_->raw_handle(), offset_, buffer_.get(), bytes_to_write_);
+ return file_holder_->file()->Write(offset_, buffer_.get(), bytes_to_write_);
}
}
@@ -183,7 +176,7 @@ int32_t FileIOResource::Query(PP_FileInfo* info,
return rv;
if (!info)
return PP_ERROR_BADARGUMENT;
- if (!FileHandleHolder::IsValid(file_handle_))
+ if (!FileHolder::IsValid(file_holder_))
return PP_ERROR_FAILED;
state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
@@ -198,11 +191,7 @@ int32_t FileIOResource::Query(PP_FileInfo* info,
{
// Release the proxy lock while making a potentially slow file call.
ProxyAutoUnlock unlock;
- // 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)
+ if (file_holder_->file()->GetInfo(&file_info))
result = PP_OK;
}
if (result == PP_OK) {
@@ -217,7 +206,7 @@ int32_t FileIOResource::Query(PP_FileInfo* info,
// For the non-blocking case, post a task to the file thread and add a
// completion task to write the result.
- scoped_refptr<QueryOp> query_op(new QueryOp(file_handle_));
+ scoped_refptr<QueryOp> query_op(new QueryOp(file_holder_));
base::PostTaskAndReplyWithResult(
PpapiGlobals::Get()->GetFileTaskRunner(),
FROM_HERE,
@@ -282,7 +271,7 @@ int32_t FileIOResource::Write(int64_t offset,
return PP_ERROR_FAILED;
if (offset < 0 || bytes_to_write < 0)
return PP_ERROR_FAILED;
- if (!FileHandleHolder::IsValid(file_handle_))
+ if (!FileHolder::IsValid(file_holder_))
return PP_ERROR_FAILED;
int32_t rv = state_manager_.CheckOperationState(
@@ -408,8 +397,8 @@ void FileIOResource::Close() {
pp_resource());
}
- if (file_handle_)
- file_handle_ = NULL;
+ if (file_holder_)
+ file_holder_ = NULL;
Post(BROWSER, PpapiHostMsg_FileIO_Close(
FileGrowth(max_written_offset_, append_mode_write_amount_)));
@@ -432,22 +421,22 @@ int32_t FileIOResource::RequestOSFileHandle(
return PP_OK_COMPLETIONPENDING;
}
-FileIOResource::FileHandleHolder::FileHandleHolder(PP_FileHandle file_handle)
- : raw_handle_(file_handle) {
+FileIOResource::FileHolder::FileHolder(PP_FileHandle file_handle)
+ : file_(file_handle) {
}
// static
-bool FileIOResource::FileHandleHolder::IsValid(
- const scoped_refptr<FileIOResource::FileHandleHolder>& handle) {
- return handle && (handle->raw_handle() != base::kInvalidPlatformFileValue);
+bool FileIOResource::FileHolder::IsValid(
+ const scoped_refptr<FileIOResource::FileHolder>& handle) {
+ return handle && handle->file_.IsValid();
}
-FileIOResource::FileHandleHolder::~FileHandleHolder() {
- if (raw_handle_ != base::kInvalidPlatformFileValue) {
+FileIOResource::FileHolder::~FileHolder() {
+ if (file_.IsValid()) {
base::TaskRunner* file_task_runner =
PpapiGlobals::Get()->GetFileTaskRunner();
file_task_runner->PostTask(FROM_HERE,
- base::Bind(&DoClose, raw_handle_));
+ base::Bind(&DoClose, Passed(&file_)));
}
}
@@ -457,7 +446,7 @@ int32_t FileIOResource::ReadValidated(int64_t offset,
scoped_refptr<TrackedCallback> callback) {
if (bytes_to_read < 0)
return PP_ERROR_FAILED;
- if (!FileHandleHolder::IsValid(file_handle_))
+ if (!FileHolder::IsValid(file_holder_))
return PP_ERROR_FAILED;
state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_READ);
@@ -473,8 +462,7 @@ int32_t FileIOResource::ReadValidated(int64_t offset,
if (buffer) {
// Release the proxy lock while making a potentially slow file call.
ProxyAutoUnlock unlock;
- result = base::ReadPlatformFile(
- file_handle_->raw_handle(), offset, buffer, bytes_to_read);
+ result = file_holder_->file()->Read(offset, buffer, bytes_to_read);
if (result < 0)
result = PP_ERROR_FAILED;
}
@@ -484,7 +472,7 @@ int32_t FileIOResource::ReadValidated(int64_t offset,
// For the non-blocking case, post a task to the file thread.
scoped_refptr<ReadOp> read_op(
- new ReadOp(file_handle_, offset, bytes_to_read));
+ new ReadOp(file_holder_, offset, bytes_to_read));
base::PostTaskAndReplyWithResult(
PpapiGlobals::Get()->GetFileTaskRunner(),
FROM_HERE,
@@ -508,11 +496,10 @@ int32_t FileIOResource::WriteValidated(
// Release the proxy lock while making a potentially slow file call.
ProxyAutoUnlock unlock;
if (append) {
- result = base::WritePlatformFileAtCurrentPos(
- file_handle_->raw_handle(), buffer, bytes_to_write);
+ result = file_holder_->file()->WriteAtCurrentPos(buffer,
+ bytes_to_write);
} else {
- result = base::WritePlatformFile(
- file_handle_->raw_handle(), offset, buffer, bytes_to_write);
+ result = file_holder_->file()->Write(offset, buffer, bytes_to_write);
}
}
if (result < 0)
@@ -527,7 +514,7 @@ int32_t FileIOResource::WriteValidated(
scoped_ptr<char[]> copy(new char[bytes_to_write]);
memcpy(copy.get(), buffer, bytes_to_write);
scoped_refptr<WriteOp> write_op(
- new WriteOp(file_handle_, offset, copy.Pass(), bytes_to_write, append));
+ new WriteOp(file_holder_, offset, copy.Pass(), bytes_to_write, append));
base::PostTaskAndReplyWithResult(
PpapiGlobals::Get()->GetFileTaskRunner(),
FROM_HERE,
@@ -619,7 +606,7 @@ void FileIOResource::OnRequestWriteQuotaComplete(
} else {
bool append = (open_flags_ & PP_FILEOPENFLAG_APPEND) != 0;
scoped_refptr<WriteOp> write_op(new WriteOp(
- file_handle_, offset, buffer.Pass(), bytes_to_write, append));
+ file_holder_, offset, buffer.Pass(), bytes_to_write, append));
base::PostTaskAndReplyWithResult(
PpapiGlobals::Get()->GetFileTaskRunner(),
FROM_HERE,
@@ -693,7 +680,7 @@ void FileIOResource::OnPluginMsgOpenFileComplete(
IPC::PlatformFileForTransit transit_file;
if (params.TakeFileHandleAtIndex(0, &transit_file)) {
- file_handle_ = new FileHandleHolder(
+ file_holder_ = new FileHolder(
IPC::PlatformFileForTransitToPlatformFile(transit_file));
}
}
diff --git a/ppapi/proxy/file_io_resource.h b/ppapi/proxy/file_io_resource.h
index 557847f..c9e15df 100644
--- a/ppapi/proxy/file_io_resource.h
+++ b/ppapi/proxy/file_io_resource.h
@@ -69,8 +69,8 @@ class PPAPI_PROXY_EXPORT FileIOResource
PP_FileHandle* handle,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
- // FileHandleHolder is used to guarantee that file operations will have a
- // valid FD to operate on, even if they're in a different thread.
+ // FileHolder is used to guarantee that file operations will have a valid FD
+ // to operate on, even if they're in a different thread.
// If instead we just passed the raw FD, the FD could be closed before the
// file operation has a chance to run. It could interact with an invalid FD,
// or worse, the FD value could be reused if another file is opened quickly
@@ -80,36 +80,37 @@ class PPAPI_PROXY_EXPORT FileIOResource
//
// Operations that run on a background thread should hold one of these to
// ensure they have a valid file descriptor. The file handle is only closed
- // when the last reference to the FileHandleHolder is removed, so we are
- // guaranteed to operate on the correct file descriptor. It *is* still
- // possible that the FileIOResource will be destroyed and "Abort" callbacks
- // just before the operation does its task (e.g., Reading). In that case, we
- // might for example Read from a file even though the FileIO has been
- // destroyed and the plugin's callback got a PP_ERROR_ABORTED result. In the
- // case of a write, we could write some data to the file despite the plugin
- // receiving a PP_ERROR_ABORTED instead of a successful result.
- class FileHandleHolder : public base::RefCountedThreadSafe<FileHandleHolder> {
+ // when the last reference to the FileHolder is removed, so we are guaranteed
+ // to operate on the correct file descriptor. It *is* still possible that the
+ // FileIOResource will be destroyed and "Abort" callbacks just before the
+ // operation does its task (e.g., Reading). In that case, we might for example
+ // Read from a file even though the FileIO has been destroyed and the plugin's
+ // callback got a PP_ERROR_ABORTED result. In the case of a write, we could
+ // write some data to the file despite the plugin receiving a
+ // PP_ERROR_ABORTED instead of a successful result.
+ class FileHolder : public base::RefCountedThreadSafe<FileHolder> {
public:
- explicit FileHandleHolder(PP_FileHandle file_handle_);
- PP_FileHandle raw_handle() {
- return raw_handle_;
+ explicit FileHolder(PP_FileHandle file_handle);
+ base::File* file() {
+ return &file_;
}
static bool IsValid(
- const scoped_refptr<FileIOResource::FileHandleHolder>& handle);
+ const scoped_refptr<FileIOResource::FileHolder>& handle);
private:
- friend class base::RefCountedThreadSafe<FileHandleHolder>;
- ~FileHandleHolder();
- PP_FileHandle raw_handle_;
+ friend class base::RefCountedThreadSafe<FileHolder>;
+ ~FileHolder();
+ base::File file_;
};
- scoped_refptr<FileHandleHolder> file_handle() {
- return file_handle_;
+
+ scoped_refptr<FileHolder> file_holder() {
+ return file_holder_;
}
private:
// Class to perform file query operations across multiple threads.
class QueryOp : public base::RefCountedThreadSafe<QueryOp> {
public:
- explicit QueryOp(scoped_refptr<FileHandleHolder> file_handle);
+ explicit QueryOp(scoped_refptr<FileHolder> file_holder);
// Queries the file. Called on the file thread (non-blocking) or the plugin
// thread (blocking). This should not be called when we hold the proxy lock.
@@ -121,14 +122,14 @@ class PPAPI_PROXY_EXPORT FileIOResource
friend class base::RefCountedThreadSafe<QueryOp>;
~QueryOp();
- scoped_refptr<FileHandleHolder> file_handle_;
+ scoped_refptr<FileHolder> file_holder_;
base::File::Info file_info_;
};
// Class to perform file read operations across multiple threads.
class ReadOp : public base::RefCountedThreadSafe<ReadOp> {
public:
- ReadOp(scoped_refptr<FileHandleHolder> file_handle,
+ ReadOp(scoped_refptr<FileHolder> file_holder,
int64_t offset,
int32_t bytes_to_read);
@@ -142,7 +143,7 @@ class PPAPI_PROXY_EXPORT FileIOResource
friend class base::RefCountedThreadSafe<ReadOp>;
~ReadOp();
- scoped_refptr<FileHandleHolder> file_handle_;
+ scoped_refptr<FileHolder> file_holder_;
int64_t offset_;
int32_t bytes_to_read_;
scoped_ptr<char[]> buffer_;
@@ -151,7 +152,7 @@ class PPAPI_PROXY_EXPORT FileIOResource
// Class to perform file write operations across multiple threads.
class WriteOp : public base::RefCountedThreadSafe<WriteOp> {
public:
- WriteOp(scoped_refptr<FileHandleHolder> file_handle,
+ WriteOp(scoped_refptr<FileHolder> file_holder,
int64_t offset,
scoped_ptr<char[]> buffer,
int32_t bytes_to_write,
@@ -165,7 +166,7 @@ class PPAPI_PROXY_EXPORT FileIOResource
friend class base::RefCountedThreadSafe<WriteOp>;
~WriteOp();
- scoped_refptr<FileHandleHolder> file_handle_;
+ scoped_refptr<FileHolder> file_holder_;
int64_t offset_;
scoped_ptr<char[]> buffer_;
int32_t bytes_to_write_;
@@ -213,7 +214,7 @@ class PPAPI_PROXY_EXPORT FileIOResource
PP_FileHandle* output_handle,
const ResourceMessageReplyParams& params);
- scoped_refptr<FileHandleHolder> file_handle_;
+ scoped_refptr<FileHolder> file_holder_;
PP_FileSystemType file_system_type_;
scoped_refptr<Resource> file_system_resource_;
FileIOStateManager state_manager_;
diff --git a/ppapi/proxy/file_mapping_resource.cc b/ppapi/proxy/file_mapping_resource.cc
index 5b18dbb..c620c06 100644
--- a/ppapi/proxy/file_mapping_resource.cc
+++ b/ppapi/proxy/file_mapping_resource.cc
@@ -41,9 +41,9 @@ int32_t FileMappingResource::Map(PP_Instance /* instance */,
return PP_ERROR_BADARGUMENT;
FileIOResource* file_io_resource =
static_cast<FileIOResource*>(enter.object());
- scoped_refptr<FileIOResource::FileHandleHolder> file_handle =
- file_io_resource->file_handle();
- if (!FileIOResource::FileHandleHolder::IsValid(file_handle))
+ scoped_refptr<FileIOResource::FileHolder> file_holder =
+ file_io_resource->file_holder();
+ if (!FileIOResource::FileHolder::IsValid(file_holder))
return PP_ERROR_FAILED;
if (length < 0 || offset < 0 ||
!base::IsValueInRangeForNumericType<off_t>(offset)) {
@@ -75,7 +75,7 @@ int32_t FileMappingResource::Map(PP_Instance /* instance */,
return PP_ERROR_BADARGUMENT;
base::Callback<MapResult()> map_cb(
- base::Bind(&FileMappingResource::DoMapBlocking, file_handle, *address,
+ base::Bind(&FileMappingResource::DoMapBlocking, file_holder, *address,
length, protection, flags, offset));
if (callback->is_blocking()) {
// The plugin could release its reference to this instance when we release
diff --git a/ppapi/proxy/file_mapping_resource.h b/ppapi/proxy/file_mapping_resource.h
index 240da21..31c49f9 100644
--- a/ppapi/proxy/file_mapping_resource.h
+++ b/ppapi/proxy/file_mapping_resource.h
@@ -57,7 +57,7 @@ class PPAPI_PROXY_EXPORT FileMappingResource
// implementation is platform specific. See file_mapping_resource_posix.cc and
// file_mapping_resource_win.cc.
static MapResult DoMapBlocking(
- scoped_refptr<FileIOResource::FileHandleHolder> handle,
+ scoped_refptr<FileIOResource::FileHolder> file_holder,
void* address_hint,
int64_t length,
uint32_t protection,
diff --git a/ppapi/proxy/file_mapping_resource_posix.cc b/ppapi/proxy/file_mapping_resource_posix.cc
index b1aff77..24ce546 100644
--- a/ppapi/proxy/file_mapping_resource_posix.cc
+++ b/ppapi/proxy/file_mapping_resource_posix.cc
@@ -35,7 +35,7 @@ int32_t ErrnoToPPError(int error_code) {
// static
FileMappingResource::MapResult FileMappingResource::DoMapBlocking(
- scoped_refptr<FileIOResource::FileHandleHolder> handle,
+ scoped_refptr<FileIOResource::FileHolder> file_holder,
void* address_hint,
int64_t length,
uint32_t map_protection,
@@ -63,7 +63,7 @@ FileMappingResource::MapResult FileMappingResource::DoMapBlocking(
static_cast<size_t>(length),
prot_for_mmap,
flags_for_mmap,
- handle->raw_handle(),
+ file_holder->file()->GetPlatformFile(),
static_cast<off_t>(offset));
if (map_result.address != MAP_FAILED)
map_result.result = PP_OK;
diff --git a/ppapi/proxy/file_mapping_resource_win.cc b/ppapi/proxy/file_mapping_resource_win.cc
index 70c3d20..c5d9353 100644
--- a/ppapi/proxy/file_mapping_resource_win.cc
+++ b/ppapi/proxy/file_mapping_resource_win.cc
@@ -11,7 +11,7 @@ namespace proxy {
// static
FileMappingResource::MapResult FileMappingResource::DoMapBlocking(
- scoped_refptr<FileIOResource::FileHandleHolder> handle,
+ scoped_refptr<FileIOResource::FileHolder> file_holder,
void* address_hint,
int64_t length,
uint32_t map_protection,
diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
index da02097..1058a2e 100644
--- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
+++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
@@ -4,7 +4,7 @@
#include "ppapi/proxy/ppp_content_decryptor_private_proxy.h"
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/ppb_core.h"
#include "ppapi/proxy/content_decryptor_private_serializer.h"
diff --git a/ppapi/proxy/proxy_channel.cc b/ppapi/proxy/proxy_channel.cc
index b7f8a82..c1f48de 100644
--- a/ppapi/proxy/proxy_channel.cc
+++ b/ppapi/proxy/proxy_channel.cc
@@ -64,11 +64,7 @@ IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote(
// Channel could be closed if the plugin crashes.
if (!channel_.get()) {
if (should_close_source) {
-#if !defined(OS_NACL)
- base::ClosePlatformFile(handle);
-#else
- close(handle);
-#endif
+ base::File file_closer(handle);
}
return IPC::InvalidPlatformFileForTransit();
}
diff --git a/ppapi/proxy/serialized_handle.cc b/ppapi/proxy/serialized_handle.cc
index a59b27d..7d06c76 100644
--- a/ppapi/proxy/serialized_handle.cc
+++ b/ppapi/proxy/serialized_handle.cc
@@ -4,9 +4,9 @@
#include "ppapi/proxy/serialized_handle.h"
+#include "base/files/file.h"
#include "base/memory/shared_memory.h"
#include "base/pickle.h"
-#include "base/platform_file.h"
#include "build/build_config.h"
#include "ipc/ipc_platform_file.h"
@@ -81,13 +81,7 @@ void SerializedHandle::Close() {
break;
case SOCKET:
case FILE:
- base::PlatformFile file =
- IPC::PlatformFileForTransitToPlatformFile(descriptor_);
-#if !defined(OS_NACL)
- base::ClosePlatformFile(file);
-#else
- close(file);
-#endif
+ base::File file_closer = IPC::PlatformFileForTransitToFile(descriptor_);
break;
// No default so the compiler will warn us if a new type is added.
}
diff --git a/ppapi/shared_impl/file_type_conversion.cc b/ppapi/shared_impl/file_type_conversion.cc
index 0b94725..8d7eaf3 100644
--- a/ppapi/shared_impl/file_type_conversion.cc
+++ b/ppapi/shared_impl/file_type_conversion.cc
@@ -5,7 +5,6 @@
#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"
@@ -46,17 +45,17 @@ bool PepperFileOpenFlagsToPlatformFileFlags(int32_t pp_open_flags,
bool pp_append = !!(pp_open_flags & PP_FILEOPENFLAG_APPEND);
// Pepper allows Touch on any open file, so always set this Windows-only flag.
- int flags = base::PLATFORM_FILE_WRITE_ATTRIBUTES;
+ int flags = base::File::FLAG_WRITE_ATTRIBUTES;
if (pp_read)
- flags |= base::PLATFORM_FILE_READ;
+ flags |= base::File::FLAG_READ;
if (pp_write) {
- flags |= base::PLATFORM_FILE_WRITE;
+ flags |= base::File::FLAG_WRITE;
}
if (pp_append) {
if (pp_write)
return false;
- flags |= base::PLATFORM_FILE_APPEND;
+ flags |= base::File::FLAG_APPEND;
}
if (pp_truncate && !pp_write)
@@ -64,16 +63,16 @@ bool PepperFileOpenFlagsToPlatformFileFlags(int32_t pp_open_flags,
if (pp_create) {
if (pp_exclusive) {
- flags |= base::PLATFORM_FILE_CREATE;
+ flags |= base::File::FLAG_CREATE;
} else if (pp_truncate) {
- flags |= base::PLATFORM_FILE_CREATE_ALWAYS;
+ flags |= base::File::FLAG_CREATE_ALWAYS;
} else {
- flags |= base::PLATFORM_FILE_OPEN_ALWAYS;
+ flags |= base::File::FLAG_OPEN_ALWAYS;
}
} else if (pp_truncate) {
- flags |= base::PLATFORM_FILE_OPEN_TRUNCATED;
+ flags |= base::File::FLAG_OPEN_TRUNCATED;
} else {
- flags |= base::PLATFORM_FILE_OPEN;
+ flags |= base::File::FLAG_OPEN;
}
if (flags_out)
diff --git a/ppapi/shared_impl/platform_file.h b/ppapi/shared_impl/platform_file.h
index d2313ec..05462c4 100644
--- a/ppapi/shared_impl/platform_file.h
+++ b/ppapi/shared_impl/platform_file.h
@@ -5,7 +5,7 @@
#ifndef PPAPI_SHARED_IMPL_PLATFORM_FILE_H_
#define PPAPI_SHARED_IMPL_PLATFORM_FILE_H_
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
diff --git a/ppapi/shared_impl/var.h b/ppapi/shared_impl/var.h
index a8dec33..d5a7a55 100644
--- a/ppapi/shared_impl/var.h
+++ b/ppapi/shared_impl/var.h
@@ -10,7 +10,6 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/shared_memory.h"
-#include "base/platform_file.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"