diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-12 18:02:02 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-12 18:02:02 +0000 |
commit | 8d83e3bb062b7848547a00170f4b26427cd0a528 (patch) | |
tree | 58abcbb349dd108830e185bc7102b2c038cac96a /ppapi/thunk | |
parent | 778142fe27ea9f9df6c33b13c34a9798d448ccdc (diff) | |
download | chromium_src-8d83e3bb062b7848547a00170f4b26427cd0a528.zip chromium_src-8d83e3bb062b7848547a00170f4b26427cd0a528.tar.gz chromium_src-8d83e3bb062b7848547a00170f4b26427cd0a528.tar.bz2 |
Revert 216744 "Pepper: Move FileRef to the "new" resource proxy."
> Pepper: Move FileRef to the "new" resource proxy.
>
> This change moves the FileRef implementation from the previous one in the "old"
> resource model (ppb_file_ref_impl.cc) to the "new" resource model
> (pepper_file_ref_host.cc), and from the renderer to the browser.
>
> As many as possible of the supporting changes were split off to other changes
> to minimize the size of this change. Unfortunately, a lot of changes for
> URLLoader had to be rolled into this change.
>
> The data structures for CreateInfo have changed, and all users of FileRef have
> to be moved over, which is what causes this change to be so large.
>
> TBR=dmichael@chromium.org, jschuh@chromium.org, yzshen@chromium.org
> BUG=225441
>
> Review URL: https://codereview.chromium.org/21966004
TBR=teravest@google.com
Review URL: https://codereview.chromium.org/22903002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r-- | ppapi/thunk/interfaces_ppb_private.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_ppb_public_stable.h | 5 | ||||
-rw-r--r-- | ppapi/thunk/ppb_file_ref_api.h | 20 | ||||
-rw-r--r-- | ppapi/thunk/ppb_file_ref_thunk.cc | 8 | ||||
-rw-r--r-- | ppapi/thunk/resource_creation_api.h | 12 |
5 files changed, 31 insertions, 16 deletions
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h index 391904d3..3e0289c 100644 --- a/ppapi/thunk/interfaces_ppb_private.h +++ b/ppapi/thunk/interfaces_ppb_private.h @@ -33,7 +33,7 @@ PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_TRUSTED_INTERFACE_0_5, PPB_FileChooserTrusted_0_5) PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_TRUSTED_INTERFACE_0_6, PPB_FileChooserTrusted_0_6) -PROXIED_IFACE(NoAPIName, PPB_FILEREFPRIVATE_INTERFACE_0_1, +PROXIED_IFACE(PPB_FileRef, PPB_FILEREFPRIVATE_INTERFACE_0_1, PPB_FileRefPrivate_0_1) // TODO(xhwang): Move PPB_Flash_DeviceID back to interfaces_ppb_private_flash.h. PROXIED_IFACE(NoAPIName, PPB_FLASH_DEVICEID_INTERFACE_1_0, diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h index eac850e..b0918a3 100644 --- a/ppapi/thunk/interfaces_ppb_public_stable.h +++ b/ppapi/thunk/interfaces_ppb_public_stable.h @@ -19,6 +19,7 @@ // that exist in the webkit/plugins/ppapi/*_impl.h, but not in the proxy. PROXIED_API(PPB_Audio) PROXIED_API(PPB_Core) +PROXIED_API(PPB_FileRef) PROXIED_API(PPB_Graphics3D) PROXIED_API(PPB_ImageData) PROXIED_API(PPB_Instance) @@ -45,8 +46,8 @@ UNPROXIED_API(PPB_AudioConfig) // interface string. // Note: Core is special and is registered manually. PROXIED_IFACE(PPB_Audio, PPB_AUDIO_INTERFACE_1_0, PPB_Audio_1_0) -PROXIED_IFACE(NoAPIName, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef_1_0) -PROXIED_IFACE(NoAPIName, PPB_FILEREF_INTERFACE_1_1, PPB_FileRef_1_1) +PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef_1_0) +PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_1, PPB_FileRef_1_1) PROXIED_IFACE(NoAPIName, PPB_FILESYSTEM_INTERFACE_1_0, PPB_FileSystem_1_0) PROXIED_IFACE(PPB_Graphics3D, PPB_GRAPHICS_3D_INTERFACE_1_0, PPB_Graphics3D_1_0) PROXIED_IFACE(PPB_ImageData, PPB_IMAGEDATA_INTERFACE_1_0, PPB_ImageData_1_0) diff --git a/ppapi/thunk/ppb_file_ref_api.h b/ppapi/thunk/ppb_file_ref_api.h index b473ae2..ba92b63 100644 --- a/ppapi/thunk/ppb_file_ref_api.h +++ b/ppapi/thunk/ppb_file_ref_api.h @@ -10,12 +10,11 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "ppapi/c/ppb_file_ref.h" -#include "ppapi/shared_impl/file_ref_create_info.h" #include "ppapi/thunk/ppapi_thunk_export.h" namespace ppapi { -struct FileRefCreateInfo; +struct PPB_FileRef_CreateInfo; class TrackedCallback; namespace thunk { @@ -41,10 +40,25 @@ class PPAPI_THUNK_EXPORT PPB_FileRef_API { virtual int32_t ReadDirectoryEntries( const PP_ArrayOutput& output, scoped_refptr<TrackedCallback> callback) = 0; + // We define variants of Query and ReadDirectoryEntries because + // 1. we need to take linked_ptr instead of raw pointers to avoid + // use-after-free, and 2. we don't use PP_ArrayOutput for the + // communication between renderers and the browser in + // ReadDirectoryEntries. The *InHost functions must not be called in + // plugins, and Query and ReadDirectoryEntries must not be called in + // renderers. + // TODO(hamaji): These functions must be removed when we move + // FileRef to the new resource design. http://crbug.com/225441 + virtual int32_t QueryInHost(linked_ptr<PP_FileInfo> info, + scoped_refptr<TrackedCallback> callback) = 0; + virtual int32_t ReadDirectoryEntriesInHost( + linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files, + linked_ptr<std::vector<PP_FileType> > file_types, + scoped_refptr<TrackedCallback> callback) = 0; // Internal function for use in proxying. Returns the internal CreateInfo // (the contained resource does not carry a ref on behalf of the caller). - virtual const FileRefCreateInfo& GetCreateInfo() const = 0; + virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const = 0; // Private API virtual PP_Var GetAbsolutePath() = 0; diff --git a/ppapi/thunk/ppb_file_ref_thunk.cc b/ppapi/thunk/ppb_file_ref_thunk.cc index 8910faf..beb0e41 100644 --- a/ppapi/thunk/ppb_file_ref_thunk.cc +++ b/ppapi/thunk/ppb_file_ref_thunk.cc @@ -7,7 +7,6 @@ #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_file_ref_private.h" -#include "ppapi/shared_impl/file_ref_create_info.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" @@ -33,12 +32,7 @@ PP_Resource Create(PP_Resource file_system, const char* path) { EnterResourceCreationNoLock enter(instance); if (enter.failed()) return 0; - FileRefCreateInfo info; - info.file_system_type = enter_file_system.object()->GetType(); - info.internal_path = std::string(path); - info.pending_host_resource_id = 0; - info.file_system_plugin_resource = file_system; - return enter.functions()->CreateFileRef(instance, info); + return enter.functions()->CreateFileRef(instance, file_system, path); } PP_Bool IsFileRef(PP_Resource resource) { diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index bab3bb9..082f1cc 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -33,7 +33,7 @@ struct PP_Size; namespace ppapi { -struct FileRefCreateInfo; +struct PPB_FileRef_CreateInfo; struct URLRequestInfoData; struct URLResponseInfoData; @@ -49,9 +49,15 @@ class ResourceCreationAPI { virtual ~ResourceCreationAPI() {} virtual PP_Resource CreateFileIO(PP_Instance instance) = 0; + virtual PP_Resource CreateFileRef(PP_Instance instance, + PP_Resource file_system, + const char* path) = 0; + // Like the above version but takes a serialized file ref. The resource + // in the serialized file ref is passed into this, which takes ownership of + // the reference. In the proxy, the return value will be a plugin resource. + // In the impl, the return value will be the same resource ID. virtual PP_Resource CreateFileRef( - PP_Instance instance, - const FileRefCreateInfo& serialized) = 0; + const PPB_FileRef_CreateInfo& serialized) = 0; virtual PP_Resource CreateFileSystem(PP_Instance instance, PP_FileSystemType type) = 0; virtual PP_Resource CreateIsolatedFileSystem(PP_Instance instance, |