diff options
-rw-r--r-- | ppapi/c/dev/pp_file_info_dev.h | 31 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_file_io_dev.h | 108 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_file_ref_dev.h | 70 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_file_system_dev.h | 36 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_chooser_dev.cc | 8 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_chooser_dev.h | 4 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_io_dev.cc | 110 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_io_dev.h | 40 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_ref_dev.cc | 114 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_ref_dev.h | 54 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_system_dev.cc | 40 | ||||
-rw-r--r-- | ppapi/cpp/dev/file_system_dev.h | 20 | ||||
-rw-r--r-- | ppapi/examples/file_chooser/file_chooser.cc | 4 | ||||
-rw-r--r-- | ppapi/ppapi_cpp.gypi | 3 | ||||
-rw-r--r-- | ppapi/tests/test_file_io.cc | 88 | ||||
-rw-r--r-- | ppapi/tests/test_file_io.h | 4 | ||||
-rw-r--r-- | ppapi/tests/test_file_system.cc | 8 |
17 files changed, 74 insertions, 668 deletions
diff --git a/ppapi/c/dev/pp_file_info_dev.h b/ppapi/c/dev/pp_file_info_dev.h index 782b4f9..b298e22 100644 --- a/ppapi/c/dev/pp_file_info_dev.h +++ b/ppapi/c/dev/pp_file_info_dev.h @@ -5,34 +5,11 @@ #ifndef PPAPI_C_DEV_PP_FILE_INFO_DEV_H_ #define PPAPI_C_DEV_PP_FILE_INFO_DEV_H_ -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_file_info.h" -typedef enum { - PP_FILETYPE_REGULAR, - PP_FILETYPE_DIRECTORY, - PP_FILETYPE_OTHER /* A catch-all for unidentified types. */ -} PP_FileType_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileType_Dev, 4); - -typedef enum { - PP_FILESYSTEMTYPE_INVALID = 0, /* For identifying invalid return values. */ - PP_FILESYSTEMTYPE_EXTERNAL, - PP_FILESYSTEMTYPE_LOCALPERSISTENT, - PP_FILESYSTEMTYPE_LOCALTEMPORARY -} PP_FileSystemType_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileSystemType_Dev, 4); - -struct PP_FileInfo_Dev { - int64_t size; /* Measured in bytes */ - PP_FileType_Dev type; - PP_FileSystemType_Dev system_type; - PP_Time creation_time; - PP_Time last_access_time; - PP_Time last_modified_time; -}; -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FileInfo_Dev, 40); +typedef PP_FileType PP_FileType_Dev; +typedef PP_FileSystemType PP_FileSystemType_Dev; +typedef struct PP_FileInfo PP_FileInfo_Dev; #endif /* PPAPI_C_DEV_PP_FILE_INFO_DEV_H_ */ diff --git a/ppapi/c/dev/ppb_file_io_dev.h b/ppapi/c/dev/ppb_file_io_dev.h index 4ffd282..3700968 100644 --- a/ppapi/c/dev/ppb_file_io_dev.h +++ b/ppapi/c/dev/ppb_file_io_dev.h @@ -5,115 +5,11 @@ #ifndef PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ #define PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" - -struct PP_CompletionCallback; -struct PP_FileInfo_Dev; - -typedef enum { - // Requests read access to a file. - PP_FILEOPENFLAG_READ = 1 << 0, - - // Requests write access to a file. May be combined with - // PP_FILEOPENFLAG_READ to request read and write access. - PP_FILEOPENFLAG_WRITE = 1 << 1, - - // Requests that the file be created if it does not exist. If the file - // already exists, then this flag is ignored unless PP_FILEOPENFLAG_EXCLUSIVE - // was also specified, in which case FileIO::Open will fail. - PP_FILEOPENFLAG_CREATE = 1 << 2, - - // Requests that the file be truncated to length 0 if it exists and is a - // regular file. PP_FILEOPENFLAG_WRITE must also be specified. - PP_FILEOPENFLAG_TRUNCATE = 1 << 3, - - // Requests that the file is created when this flag is combined with - // PP_FILEOPENFLAG_CREATE. If this flag is specified, and the file already - // exists, then the FileIO::Open call will fail. - PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4 -} PP_FileOpenFlags_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileOpenFlags_Dev, 4); +#include "ppapi/c/ppb_file_io.h" #define PPB_FILEIO_DEV_INTERFACE_0_4 "PPB_FileIO(Dev);0.4" #define PPB_FILEIO_DEV_INTERFACE PPB_FILEIO_DEV_INTERFACE_0_4 -// Use this interface to operate on a regular file (PP_FileType_Regular). -struct PPB_FileIO_Dev { - // Creates a new FileIO object. Returns 0 if the module is invalid. - PP_Resource (*Create)(PP_Instance instance); - - // Returns PP_TRUE if the given resource is a FileIO. Returns PP_FALSE if the - // resource is invalid or some type other than a FileIO. - PP_Bool (*IsFileIO)(PP_Resource resource); - - // Open the specified regular file for I/O according to the given open flags, - // which is a bit-mask of the PP_FileOpenFlags values. Upon success, the - // corresponding file is classified as "in use" by this FileIO object until - // such time as the FileIO object is closed or destroyed. - int32_t (*Open)(PP_Resource file_io, - PP_Resource file_ref, - int32_t open_flags, - struct PP_CompletionCallback callback); - - // Queries info about the file opened by this FileIO object. Fails if the - // FileIO object has not been opened. - int32_t (*Query)(PP_Resource file_io, - struct PP_FileInfo_Dev* info, - struct PP_CompletionCallback callback); - - // Updates timestamps for the file opened by this FileIO object. Fails if - // the FileIO object has not been opened. - int32_t (*Touch)(PP_Resource file_io, - PP_Time last_access_time, - PP_Time last_modified_time, - struct PP_CompletionCallback callback); - - // Read from an offset in the file. The size of the buffer must be large - // enough to hold the specified number of bytes to read. May perform a - // partial read. Returns the number of bytes read or an error code. If the - // return value is 0, then it indicates that end-of-file was reached. It is - // valid to call Read multiple times with a completion callback to queue up - // parallel reads from the file at different offsets. - int32_t (*Read)(PP_Resource file_io, - int64_t offset, - char* buffer, - int32_t bytes_to_read, - struct PP_CompletionCallback callback); - - // Write to an offset in the file. May perform a partial write. Returns the - // number of bytes written or an error code. It is valid to call Write - // multiple times with a completion callback to queue up parallel writes to - // the file at different offsets. The FileIO object must have been opened - // with write access. - int32_t (*Write)(PP_Resource file_io, - int64_t offset, - const char* buffer, - int32_t bytes_to_write, - struct PP_CompletionCallback callback); - - // Sets the length of the file. If the file size is extended, then the - // extended area of the file is zero-filled. The FileIO object must have - // been opened with write access. - int32_t (*SetLength)(PP_Resource file_io, - int64_t length, - struct PP_CompletionCallback callback); - - // Flush changes to disk. This call can be very expensive! - int32_t (*Flush)(PP_Resource file_io, - struct PP_CompletionCallback callback); - - // Cancels any IO that may be pending, and closes the FileIO object. Any - // pending callbacks will still run, reporting PP_Error_Aborted if pending IO - // was interrupted. It is NOT valid to call Open again after a call to this - // method. Note: If the FileIO object is destroyed, and it is still open, - // then it will be implicitly closed, so you are not required to call the - // Close method. - void (*Close)(PP_Resource file_io); -}; +typedef struct PPB_FileIO PPB_FileIO_Dev; #endif /* PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ */ diff --git a/ppapi/c/dev/ppb_file_ref_dev.h b/ppapi/c/dev/ppb_file_ref_dev.h index 05b3d9c..31c7327 100644 --- a/ppapi/c/dev/ppb_file_ref_dev.h +++ b/ppapi/c/dev/ppb_file_ref_dev.h @@ -5,77 +5,11 @@ #ifndef PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ #define PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ -#include "ppapi/c/dev/pp_file_info_dev.h" -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_var.h" - -struct PP_CompletionCallback; +#include "ppapi/c/ppb_file_ref.h" #define PPB_FILEREF_DEV_INTERFACE_0_8 "PPB_FileRef(Dev);0.8" #define PPB_FILEREF_DEV_INTERFACE PPB_FILEREF_DEV_INTERFACE_0_8 -// A FileRef is a "weak pointer" to a file in a file system. It contains a -// PP_FileSystemType identifier and a file path string. -struct PPB_FileRef_Dev { - // Creates a weak pointer to a file in the given filesystem. File paths are - // POSIX style. Returns 0 if the path is malformed. - PP_Resource (*Create)(PP_Resource file_system, const char* path); - - // Returns PP_TRUE if the given resource is a FileRef. Returns PP_FALSE if the - // resource is invalid or some type other than a FileRef. - PP_Bool (*IsFileRef)(PP_Resource resource); - - // Returns the file system identifier of this file, or - // PP_FILESYSTEMTYPE_INVALID if the file ref is invalid. - PP_FileSystemType_Dev (*GetFileSystemType)(PP_Resource file_ref); - - // Returns the name of the file. The value returned by this function does not - // include any path component (such as the name of the parent directory, for - // example). It is just the name of the file. To get the full file path, use - // the GetPath() function. - struct PP_Var (*GetName)(PP_Resource file_ref); - - // Returns the absolute path of the file. This method fails if the file - // system type is PP_FileSystemType_External. - struct PP_Var (*GetPath)(PP_Resource file_ref); - - // Returns the parent directory of this file. If file_ref points to the root - // of the filesystem, then the root is returned. This method fails if the - // file system type is PP_FileSystemType_External. - PP_Resource (*GetParent)(PP_Resource file_ref); - - // Makes a new directory in the filesystem as well as any parent directories - // if the make_ancestors parameter is PP_TRUE. It is not valid to make a - // directory in the external filesystem. Fails if the directory already - // exists or if ancestor directories do not exist and make_ancestors was not - // passed as PP_TRUE. - int32_t (*MakeDirectory)(PP_Resource directory_ref, - PP_Bool make_ancestors, - struct PP_CompletionCallback callback); - - // Updates timestamps for a file. You must have write access to the file if - // it exists in the external filesystem. - int32_t (*Touch)(PP_Resource file_ref, - PP_Time last_access_time, - PP_Time last_modified_time, - struct PP_CompletionCallback callback); - - // Delete a file or directory. If file_ref refers to a directory, then the - // directory must be empty. It is an error to delete a file or directory - // that is in use. It is not valid to delete a file in the external - // filesystem. - int32_t (*Delete)(PP_Resource file_ref, - struct PP_CompletionCallback callback); - - // Rename a file or directory. file_ref and new_file_ref must both refer to - // files in the same filesystem. It is an error to rename a file or - // directory that is in use. It is not valid to rename a file in the - // external filesystem. - int32_t (*Rename)(PP_Resource file_ref, - PP_Resource new_file_ref, - struct PP_CompletionCallback callback); -}; +typedef struct PPB_FileRef PPB_FileRef_Dev; #endif /* PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ */ diff --git a/ppapi/c/dev/ppb_file_system_dev.h b/ppapi/c/dev/ppb_file_system_dev.h index ba1e517..32ce3fc 100644 --- a/ppapi/c/dev/ppb_file_system_dev.h +++ b/ppapi/c/dev/ppb_file_system_dev.h @@ -5,43 +5,11 @@ #ifndef PPAPI_C_DEV_PPB_FILE_SYSTEM_DEV_H_ #define PPAPI_C_DEV_PPB_FILE_SYSTEM_DEV_H_ -#include "ppapi/c/dev/pp_file_info_dev.h" -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" - -struct PP_CompletionCallback; +#include "ppapi/c/ppb_file_system.h" #define PPB_FILESYSTEM_DEV_INTERFACE_0_6 "PPB_FileSystem(Dev);0.6" #define PPB_FILESYSTEM_DEV_INTERFACE PPB_FILESYSTEM_DEV_INTERFACE_0_6 -struct PPB_FileSystem_Dev { - /** Creates a filesystem object of the given type. */ - PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType_Dev type); - - /** Returns PP_TRUE if the given resource is a FileSystem. */ - PP_Bool (*IsFileSystem)(PP_Resource resource); - - /** - * Opens the file system. A file system must be opened before running any - * other operation on it. - * - * TODO(brettw) clarify whether this must have completed before a file can - * be opened in it. Clarify what it means to be "completed." - */ - int32_t (*Open)(PP_Resource file_system, - int64_t expected_size, - struct PP_CompletionCallback callback); - - /** - * Returns the type of the given file system. - * - * Returns PP_FILESYSTEMTYPE_INVALID if the given resource is not a valid - * filesystem. It is valid to call this function even before Open completes. - */ - PP_FileSystemType_Dev (*GetType)(PP_Resource file_system); -}; +typedef struct PPB_FileSystem PPB_FileSystem_Dev; #endif /* PPAPI_C_DEV_PPB_FILE_SYSTEM_DEV_H_ */ diff --git a/ppapi/cpp/dev/file_chooser_dev.cc b/ppapi/cpp/dev/file_chooser_dev.cc index e0c0e62..aa6535b 100644 --- a/ppapi/cpp/dev/file_chooser_dev.cc +++ b/ppapi/cpp/dev/file_chooser_dev.cc @@ -7,7 +7,7 @@ #include "ppapi/c/dev/ppb_file_chooser_dev.h" #include "ppapi/c/pp_errors.h" #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/file_ref_dev.h" +#include "ppapi/cpp/file_ref.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" @@ -41,10 +41,10 @@ int32_t FileChooser_Dev::Show(const CompletionCallback& cc) { pp_resource(), cc.pp_completion_callback()); } -FileRef_Dev FileChooser_Dev::GetNextChosenFile() const { +FileRef FileChooser_Dev::GetNextChosenFile() const { if (!has_interface<PPB_FileChooser_Dev>()) - return FileRef_Dev(); - return FileRef_Dev(FileRef_Dev::PassRef(), + return FileRef(); + return FileRef(FileRef::PassRef(), get_interface<PPB_FileChooser_Dev>()->GetNextChosenFile(pp_resource())); } diff --git a/ppapi/cpp/dev/file_chooser_dev.h b/ppapi/cpp/dev/file_chooser_dev.h index 1feff61..c2a40e1 100644 --- a/ppapi/cpp/dev/file_chooser_dev.h +++ b/ppapi/cpp/dev/file_chooser_dev.h @@ -12,7 +12,7 @@ struct PP_FileChooserOptions_Dev; namespace pp { class CompletionCallback; -class FileRef_Dev; +class FileRef; class Instance; class FileChooser_Dev : public Resource { @@ -27,7 +27,7 @@ class FileChooser_Dev : public Resource { // PPB_FileChooser methods: int32_t Show(const CompletionCallback& cc); - FileRef_Dev GetNextChosenFile() const; + FileRef GetNextChosenFile() const; }; } // namespace pp diff --git a/ppapi/cpp/dev/file_io_dev.cc b/ppapi/cpp/dev/file_io_dev.cc deleted file mode 100644 index 586de42..0000000 --- a/ppapi/cpp/dev/file_io_dev.cc +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/dev/file_io_dev.h" - -#include "ppapi/c/dev/ppb_file_io_dev.h" -#include "ppapi/c/dev/ppb_file_io_trusted_dev.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/file_ref_dev.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_FileIO_Dev>() { - return PPB_FILEIO_DEV_INTERFACE; -} - -} // namespace - -FileIO_Dev::FileIO_Dev() { -} - -FileIO_Dev::FileIO_Dev(Instance* instance) { - if (!has_interface<PPB_FileIO_Dev>()) - return; - PassRefFromConstructor(get_interface<PPB_FileIO_Dev>()->Create( - instance->pp_instance())); -} - -FileIO_Dev::FileIO_Dev(const FileIO_Dev& other) - : Resource(other) { -} - -int32_t FileIO_Dev::Open(const FileRef_Dev& file_ref, - int32_t open_flags, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileIO_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIO_Dev>()->Open( - pp_resource(), file_ref.pp_resource(), open_flags, - cc.pp_completion_callback()); -} - -int32_t FileIO_Dev::Query(PP_FileInfo_Dev* result_buf, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileIO_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIO_Dev>()->Query( - pp_resource(), result_buf, cc.pp_completion_callback()); -} - -int32_t FileIO_Dev::Touch(PP_Time last_access_time, - PP_Time last_modified_time, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileIO_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIO_Dev>()->Touch( - pp_resource(), last_access_time, last_modified_time, - cc.pp_completion_callback()); -} - -int32_t FileIO_Dev::Read(int64_t offset, - char* buffer, - int32_t bytes_to_read, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileIO_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIO_Dev>()->Read(pp_resource(), - offset, buffer, bytes_to_read, cc.pp_completion_callback()); -} - -int32_t FileIO_Dev::Write(int64_t offset, - const char* buffer, - int32_t bytes_to_write, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileIO_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIO_Dev>()->Write( - pp_resource(), offset, buffer, bytes_to_write, - cc.pp_completion_callback()); -} - -int32_t FileIO_Dev::SetLength(int64_t length, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileIO_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIO_Dev>()->SetLength( - pp_resource(), length, cc.pp_completion_callback()); -} - -int32_t FileIO_Dev::Flush(const CompletionCallback& cc) { - if (!has_interface<PPB_FileIO_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIO_Dev>()->Flush( - pp_resource(), cc.pp_completion_callback()); -} - -void FileIO_Dev::Close() { - if (!has_interface<PPB_FileIO_Dev>()) - return; - get_interface<PPB_FileIO_Dev>()->Close(pp_resource()); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/file_io_dev.h b/ppapi/cpp/dev/file_io_dev.h index 532f76a..86555d5 100644 --- a/ppapi/cpp/dev/file_io_dev.h +++ b/ppapi/cpp/dev/file_io_dev.h @@ -5,47 +5,11 @@ #ifndef PPAPI_CPP_DEV_FILE_IO_DEV_H_ #define PPAPI_CPP_DEV_FILE_IO_DEV_H_ -#include "ppapi/c/pp_time.h" -#include "ppapi/cpp/resource.h" - -struct PP_FileInfo_Dev; +#include "ppapi/cpp/file_io.h" namespace pp { -class CompletionCallback; -class FileRef_Dev; -class Instance; - -class FileIO_Dev : public Resource { - public: - // Constructs an is_null resource. - FileIO_Dev(); - - FileIO_Dev(Instance* instance); - FileIO_Dev(const FileIO_Dev& other); - - // PPB_FileIO methods: - int32_t Open(const FileRef_Dev& file_ref, - int32_t open_flags, - const CompletionCallback& cc); - int32_t Query(PP_FileInfo_Dev* result_buf, - const CompletionCallback& cc); - int32_t Touch(PP_Time last_access_time, - PP_Time last_modified_time, - const CompletionCallback& cc); - int32_t Read(int64_t offset, - char* buffer, - int32_t bytes_to_read, - const CompletionCallback& cc); - int32_t Write(int64_t offset, - const char* buffer, - int32_t bytes_to_write, - const CompletionCallback& cc); - int32_t SetLength(int64_t length, - const CompletionCallback& cc); - int32_t Flush(const CompletionCallback& cc); - void Close(); -}; +typedef FileIO FileIO_Dev; } // namespace pp diff --git a/ppapi/cpp/dev/file_ref_dev.cc b/ppapi/cpp/dev/file_ref_dev.cc deleted file mode 100644 index 882adb1..0000000 --- a/ppapi/cpp/dev/file_ref_dev.cc +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/dev/file_ref_dev.h" - -#include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/file_system_dev.h" -#include "ppapi/cpp/module_impl.h" - - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_FileRef_Dev>() { - return PPB_FILEREF_DEV_INTERFACE; -} - -} // namespace - -FileRef_Dev::FileRef_Dev(PP_Resource resource) : Resource(resource) { -} - -FileRef_Dev::FileRef_Dev(PassRef, PP_Resource resource) { - PassRefFromConstructor(resource); -} - -FileRef_Dev::FileRef_Dev(const FileSystem_Dev& file_system, - const char* path) { - if (!has_interface<PPB_FileRef_Dev>()) - return; - PassRefFromConstructor(get_interface<PPB_FileRef_Dev>()->Create( - file_system.pp_resource(), path)); -} - -FileRef_Dev::FileRef_Dev(const FileRef_Dev& other) - : Resource(other) { -} - -PP_FileSystemType_Dev FileRef_Dev::GetFileSystemType() const { - if (!has_interface<PPB_FileRef_Dev>()) - return PP_FILESYSTEMTYPE_EXTERNAL; - return get_interface<PPB_FileRef_Dev>()->GetFileSystemType(pp_resource()); -} - -Var FileRef_Dev::GetName() const { - if (!has_interface<PPB_FileRef_Dev>()) - return Var(); - return Var(Var::PassRef(), - get_interface<PPB_FileRef_Dev>()->GetName(pp_resource())); -} - -Var FileRef_Dev::GetPath() const { - if (!has_interface<PPB_FileRef_Dev>()) - return Var(); - return Var(Var::PassRef(), - get_interface<PPB_FileRef_Dev>()->GetPath(pp_resource())); -} - -FileRef_Dev FileRef_Dev::GetParent() const { - if (!has_interface<PPB_FileRef_Dev>()) - return FileRef_Dev(); - return FileRef_Dev(PassRef(), - get_interface<PPB_FileRef_Dev>()->GetParent( - pp_resource())); -} - -int32_t FileRef_Dev::MakeDirectory(const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef_Dev>()->MakeDirectory( - pp_resource(), - PP_FALSE, // make_ancestors - cc.pp_completion_callback()); -} - -int32_t FileRef_Dev::MakeDirectoryIncludingAncestors( - const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef_Dev>()->MakeDirectory( - pp_resource(), - PP_TRUE, // make_ancestors - cc.pp_completion_callback()); -} - -int32_t FileRef_Dev::Touch(PP_Time last_access_time, - PP_Time last_modified_time, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef_Dev>()->Touch( - pp_resource(), last_access_time, last_modified_time, - cc.pp_completion_callback()); -} - -int32_t FileRef_Dev::Delete(const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef_Dev>()->Delete( - pp_resource(), cc.pp_completion_callback()); -} - -int32_t FileRef_Dev::Rename(const FileRef_Dev& new_file_ref, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef_Dev>()->Rename( - pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/file_ref_dev.h b/ppapi/cpp/dev/file_ref_dev.h index 85b7545..8085faa 100644 --- a/ppapi/cpp/dev/file_ref_dev.h +++ b/ppapi/cpp/dev/file_ref_dev.h @@ -5,61 +5,11 @@ #ifndef PPAPI_CPP_DEV_FILE_REF_DEV_H_ #define PPAPI_CPP_DEV_FILE_REF_DEV_H_ -#include "ppapi/c/dev/ppb_file_ref_dev.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/cpp/resource.h" -#include "ppapi/cpp/var.h" +#include "ppapi/c/ppb_file_ref.h" namespace pp { -class CompletionCallback; -class FileSystem_Dev; - -class FileRef_Dev : public Resource { - public: - // Creates an is_null() FileRef object. - FileRef_Dev() {} - - // This constructor is used when we've gotten a PP_Resource as a return value - // that we need to addref. - explicit FileRef_Dev(PP_Resource resource); - - // This constructor is used when we've gotten a PP_Resource as a return value - // that has already been addref'ed for us. - struct PassRef {}; - FileRef_Dev(PassRef, PP_Resource resource); - - // Creates a FileRef pointing to a path in the given filesystem. - FileRef_Dev(const FileSystem_Dev& file_system, const char* path); - - FileRef_Dev(const FileRef_Dev& other); - - // Returns the file system type. - PP_FileSystemType_Dev GetFileSystemType() const; - - // Returns the name of the file. - Var GetName() const; - - // Returns the absolute path of the file. See PPB_FileRef::GetPath for more - // details. - Var GetPath() const; - - // Returns the parent directory of this file. See PPB_FileRef::GetParent for - // more details. - FileRef_Dev GetParent() const; - - int32_t MakeDirectory(const CompletionCallback& cc); - - int32_t MakeDirectoryIncludingAncestors(const CompletionCallback& cc); - - int32_t Touch(PP_Time last_access_time, - PP_Time last_modified_time, - const CompletionCallback& cc); - - int32_t Delete(const CompletionCallback& cc); - - int32_t Rename(const FileRef_Dev& new_file_ref, const CompletionCallback& cc); -}; +typedef FileRef FileRef_Dev; } // namespace pp diff --git a/ppapi/cpp/dev/file_system_dev.cc b/ppapi/cpp/dev/file_system_dev.cc deleted file mode 100644 index bba49dd..0000000 --- a/ppapi/cpp/dev/file_system_dev.cc +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/dev/file_system_dev.h" - -#include "ppapi/c/dev/ppb_file_system_dev.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/file_ref_dev.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_FileSystem_Dev>() { - return PPB_FILESYSTEM_DEV_INTERFACE; -} - -} // namespace - -FileSystem_Dev::FileSystem_Dev(Instance* instance, - PP_FileSystemType_Dev type) { - if (!has_interface<PPB_FileSystem_Dev>()) - return; - PassRefFromConstructor(get_interface<PPB_FileSystem_Dev>()->Create( - instance->pp_instance(), type)); -} - -int32_t FileSystem_Dev::Open(int64_t expected_size, - const CompletionCallback& cc) { - if (!has_interface<PPB_FileSystem_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileSystem_Dev>()->Open( - pp_resource(), expected_size, cc.pp_completion_callback()); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/file_system_dev.h b/ppapi/cpp/dev/file_system_dev.h index 497740a..ab9e81e 100644 --- a/ppapi/cpp/dev/file_system_dev.h +++ b/ppapi/cpp/dev/file_system_dev.h @@ -5,27 +5,11 @@ #ifndef PPAPI_CPP_DEV_FILE_SYSTEM_DEV_H_ #define PPAPI_CPP_DEV_FILE_SYSTEM_DEV_H_ -#include "ppapi/c/dev/pp_file_info_dev.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/resource.h" - -struct PP_FileInfo_Dev; +#include "ppapi/cpp/file_system.h" namespace pp { -class CompletionCallback; -class FileRef_Dev; - -// Wraps methods from ppb_file_system.h -class FileSystem_Dev : public Resource { - public: - FileSystem_Dev(Instance* instance, PP_FileSystemType_Dev type); - - int32_t Open(int64_t expected_size, const CompletionCallback& cc); -}; +typedef FileSystem FileSystem_Dev; } // namespace pp diff --git a/ppapi/examples/file_chooser/file_chooser.cc b/ppapi/examples/file_chooser/file_chooser.cc index 32a10c5..598095f 100644 --- a/ppapi/examples/file_chooser/file_chooser.cc +++ b/ppapi/examples/file_chooser/file_chooser.cc @@ -6,7 +6,7 @@ #include "ppapi/c/pp_input_event.h" #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/dev/file_chooser_dev.h" -#include "ppapi/cpp/dev/file_ref_dev.h" +#include "ppapi/cpp/file_ref.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/private/instance_private.h" #include "ppapi/cpp/private/var_private.h" @@ -56,7 +56,7 @@ class MyInstance : public pp::InstancePrivate { if (!file_chooser) return; - pp::FileRef_Dev file_ref = file_chooser->GetNextChosenFile(); + pp::FileRef file_ref = file_chooser->GetNextChosenFile(); while (!file_ref.is_null()) { Log(file_ref.GetName()); file_ref = file_chooser->GetNextChosenFile(); diff --git a/ppapi/ppapi_cpp.gypi b/ppapi/ppapi_cpp.gypi index 2296e19..80d0966 100644 --- a/ppapi/ppapi_cpp.gypi +++ b/ppapi/ppapi_cpp.gypi @@ -192,11 +192,8 @@ 'cpp/dev/directory_reader_dev.h', 'cpp/dev/file_chooser_dev.cc', 'cpp/dev/file_chooser_dev.h', - 'cpp/dev/file_io_dev.cc', 'cpp/dev/file_io_dev.h', - 'cpp/dev/file_ref_dev.cc', 'cpp/dev/file_ref_dev.h', - 'cpp/dev/file_system_dev.cc', 'cpp/dev/file_system_dev.h', 'cpp/dev/find_dev.cc', 'cpp/dev/find_dev.h', diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc index bd5e546..56aedfa 100644 --- a/ppapi/tests/test_file_io.cc +++ b/ppapi/tests/test_file_io.cc @@ -8,12 +8,12 @@ #include <string.h> #include "base/memory/scoped_ptr.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/dev/ppb_file_io_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" -#include "ppapi/cpp/dev/file_io_dev.h" -#include "ppapi/cpp/dev/file_ref_dev.h" -#include "ppapi/cpp/dev/file_system_dev.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_file_io.h" +#include "ppapi/cpp/file_io.h" +#include "ppapi/cpp/file_ref.h" +#include "ppapi/cpp/file_system.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" #include "ppapi/tests/test_utils.h" @@ -59,7 +59,7 @@ std::string ReportOpenError(int32_t open_flags) { } int32_t ReadEntireFile(PP_Instance instance, - pp::FileIO_Dev* file_io, + pp::FileIO* file_io, int32_t offset, std::string* data) { TestCompletionCallback callback(instance); @@ -82,7 +82,7 @@ int32_t ReadEntireFile(PP_Instance instance, } int32_t WriteEntireBuffer(PP_Instance instance, - pp::FileIO_Dev* file_io, + pp::FileIO* file_io, int32_t offset, const std::string& data) { TestCompletionCallback callback(instance); @@ -128,8 +128,8 @@ void TestFileIO::RunTest() { std::string TestFileIO::TestOpen() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); - pp::FileRef_Dev file_ref(file_system, "/file_open"); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileRef file_ref(file_system, "/file_open"); int32_t rv = file_system.Open(1024, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open force_async", rv); @@ -226,8 +226,8 @@ std::string TestFileIO::TestOpen() { std::string TestFileIO::TestReadWriteSetLength() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); - pp::FileRef_Dev file_ref(file_system, "/file_read_write_setlength"); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileRef file_ref(file_system, "/file_read_write_setlength"); int32_t rv = file_system.Open(1024, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open force_async", rv); @@ -236,7 +236,7 @@ std::string TestFileIO::TestReadWriteSetLength() { if (rv != PP_OK) return ReportError("FileSystem::Open", rv); - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_TRUNCATE | @@ -349,7 +349,7 @@ std::string TestFileIO::TestReadWriteSetLength() { std::string TestFileIO::TestTouchQuery() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open force_async", rv); @@ -358,8 +358,8 @@ std::string TestFileIO::TestTouchQuery() { if (rv != PP_OK) return ReportError("FileSystem::Open", rv); - pp::FileRef_Dev file_ref(file_system, "/file_touch"); - pp::FileIO_Dev file_io(instance_); + pp::FileRef file_ref(file_system, "/file_touch"); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_TRUNCATE | @@ -393,7 +393,7 @@ std::string TestFileIO::TestTouchQuery() { if (rv != PP_OK) return ReportError("FileIO::Touch", rv); - PP_FileInfo_Dev info; + PP_FileInfo info; rv = file_io.Query(&info, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Query force_async", rv); @@ -424,8 +424,8 @@ std::string TestFileIO::TestTouchQuery() { std::string TestFileIO::TestAbortCalls() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); - pp::FileRef_Dev file_ref(file_system, "/file_abort_calls"); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileRef file_ref(file_system, "/file_abort_calls"); int32_t rv = file_system.Open(1024, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open force_async", rv); @@ -436,7 +436,7 @@ std::string TestFileIO::TestAbortCalls() { // First, create a file which to do ops on. { - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, callback); @@ -459,7 +459,7 @@ std::string TestFileIO::TestAbortCalls() { // Abort |Open()|. { callback.reset_run_count(); - rv = pp::FileIO_Dev(instance_) + rv = pp::FileIO(instance_) .Open(file_ref, PP_FILEOPENFLAG_READ,callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -476,9 +476,9 @@ std::string TestFileIO::TestAbortCalls() { // Abort |Query()|. { - PP_FileInfo_Dev info = { 0 }; + PP_FileInfo info = { 0 }; { - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -494,7 +494,7 @@ std::string TestFileIO::TestAbortCalls() { } // Destroy |file_io|. if (rv == PP_OK_COMPLETIONPENDING) { // Save a copy and make sure |info| doesn't get written to. - PP_FileInfo_Dev info_copy; + PP_FileInfo info_copy; memcpy(&info_copy, &info, sizeof(info)); rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) @@ -509,7 +509,7 @@ std::string TestFileIO::TestAbortCalls() { // Abort |Touch()|. { { - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -536,7 +536,7 @@ std::string TestFileIO::TestAbortCalls() { { char buf[3] = { 0 }; { - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -568,7 +568,7 @@ std::string TestFileIO::TestAbortCalls() { { char buf[3] = { 0 }; { - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -594,7 +594,7 @@ std::string TestFileIO::TestAbortCalls() { // Abort |SetLength()|. { { - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -620,7 +620,7 @@ std::string TestFileIO::TestAbortCalls() { // Abort |Flush()|. { { - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -651,8 +651,8 @@ std::string TestFileIO::TestAbortCalls() { std::string TestFileIO::TestParallelReads() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); - pp::FileRef_Dev file_ref(file_system, "/file_parallel_reads"); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileRef file_ref(file_system, "/file_parallel_reads"); int32_t rv = file_system.Open(1024, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open force_async", rv); @@ -661,7 +661,7 @@ std::string TestFileIO::TestParallelReads() { if (rv != PP_OK) return ReportError("FileSystem::Open", rv); - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_TRUNCATE | @@ -759,8 +759,8 @@ std::string TestFileIO::TestParallelReads() { std::string TestFileIO::TestParallelWrites() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); - pp::FileRef_Dev file_ref(file_system, "/file_parallel_writes"); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileRef file_ref(file_system, "/file_parallel_writes"); int32_t rv = file_system.Open(1024, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open force_async", rv); @@ -769,7 +769,7 @@ std::string TestFileIO::TestParallelWrites() { if (rv != PP_OK) return ReportError("FileSystem::Open", rv); - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_TRUNCATE | @@ -849,8 +849,8 @@ std::string TestFileIO::TestParallelWrites() { std::string TestFileIO::TestNotAllowMixedReadWrite() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); - pp::FileRef_Dev file_ref(file_system, "/file_not_allow_mixed_read_write"); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileRef file_ref(file_system, "/file_not_allow_mixed_read_write"); int32_t rv = file_system.Open(1024, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open force_async", rv); @@ -859,7 +859,7 @@ std::string TestFileIO::TestNotAllowMixedReadWrite() { if (rv != PP_OK) return ReportError("FileSystem::Open", rv); - pp::FileIO_Dev file_io(instance_); + pp::FileIO file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_TRUNCATE | @@ -899,7 +899,7 @@ std::string TestFileIO::TestNotAllowMixedReadWrite() { PASS(); } -std::string TestFileIO::MatchOpenExpectations(pp::FileSystem_Dev* file_system, +std::string TestFileIO::MatchOpenExpectations(pp::FileSystem* file_system, size_t open_flags, size_t expectations) { std::string bad_argument = @@ -922,9 +922,9 @@ std::string TestFileIO::MatchOpenExpectations(pp::FileSystem_Dev* file_system, bool truncate_if_exists = !!(expectations & TRUNCATE_IF_EXISTS); TestCompletionCallback callback(instance_->pp_instance(), force_async_); - pp::FileRef_Dev existent_file_ref( + pp::FileRef existent_file_ref( *file_system, "/match_open_expectation_existent_non_empty_file"); - pp::FileRef_Dev nonexistent_file_ref( + pp::FileRef nonexistent_file_ref( *file_system, "/match_open_expectation_nonexistent_file"); // Setup files for test. @@ -945,7 +945,7 @@ std::string TestFileIO::MatchOpenExpectations(pp::FileSystem_Dev* file_system, if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND) return ReportError("FileRef::Delete", rv); - pp::FileIO_Dev existent_file_io(instance_); + pp::FileIO existent_file_io(instance_); rv = existent_file_io.Open(existent_file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, callback); @@ -962,7 +962,7 @@ std::string TestFileIO::MatchOpenExpectations(pp::FileSystem_Dev* file_system, return ReportError("FileIO::Write", rv); } - pp::FileIO_Dev existent_file_io(instance_); + pp::FileIO existent_file_io(instance_); int32_t rv = existent_file_io.Open(existent_file_ref, open_flags, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); @@ -974,7 +974,7 @@ std::string TestFileIO::MatchOpenExpectations(pp::FileSystem_Dev* file_system, } if (!invalid_combination && open_if_exists) { - PP_FileInfo_Dev info; + PP_FileInfo info; rv = existent_file_io.Query(&info, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Query force_async", rv); @@ -987,7 +987,7 @@ std::string TestFileIO::MatchOpenExpectations(pp::FileSystem_Dev* file_system, return ReportOpenError(open_flags); } - pp::FileIO_Dev nonexistent_file_io(instance_); + pp::FileIO nonexistent_file_io(instance_); rv = nonexistent_file_io.Open(nonexistent_file_ref, open_flags, callback); if (force_async_ && rv != PP_OK_COMPLETIONPENDING) return ReportError("FileIO::Open force_async", rv); diff --git a/ppapi/tests/test_file_io.h b/ppapi/tests/test_file_io.h index dcc9f812..bf86797 100644 --- a/ppapi/tests/test_file_io.h +++ b/ppapi/tests/test_file_io.h @@ -10,7 +10,7 @@ #include "ppapi/tests/test_case.h" namespace pp { -class FileSystem_Dev; +class FileSystem; } // namespace pp class TestFileIO : public TestCase { @@ -50,7 +50,7 @@ class TestFileIO : public TestCase { // 1) INVALID_FLAG_COMBINATION // 2) (DONT_)?CREATE_IF_DOESNT_EXIST | (DONT_)?OPEN_IF_EXISTS | // (DONT_)?TRUNCATE_IF_EXISTS - std::string MatchOpenExpectations(pp::FileSystem_Dev* file_system, + std::string MatchOpenExpectations(pp::FileSystem* file_system, size_t open_flags, size_t expectations); }; diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc index fe5c902..9232385 100644 --- a/ppapi/tests/test_file_system.cc +++ b/ppapi/tests/test_file_system.cc @@ -7,7 +7,7 @@ #include <string.h> #include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/dev/file_system_dev.h" +#include "ppapi/cpp/file_system.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" @@ -26,7 +26,7 @@ std::string TestFileSystem::TestOpen() { TestCompletionCallback callback(instance_->pp_instance(), force_async_); // Open. - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); @@ -35,7 +35,7 @@ std::string TestFileSystem::TestOpen() { // Open aborted (see the DirectoryReader test for comments). callback.reset_run_count(); - rv = pp::FileSystem_Dev(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY) + rv = pp::FileSystem(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY) .Open(1024, callback); if (callback.run_count() > 0) return "FileSystem::Open ran callback synchronously."; @@ -56,7 +56,7 @@ std::string TestFileSystem::TestMultipleOpens() { // Should not allow multiple opens, no matter the first open has completed or // not. TestCompletionCallback callback_1(instance_->pp_instance(), force_async_); - pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv_1 = file_system.Open(1024, callback_1); if (callback_1.run_count() > 0) return "FileSystem::Open1 ran callback synchronously."; |