From 76bf34a3260833d1cd522a9a7ccc4114baa4b72b Mon Sep 17 00:00:00 2001 From: "teravest@chromium.org" Date: Thu, 5 Sep 2013 23:36:16 +0000 Subject: Revert 221284 "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 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=216744 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=218305 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=219911 > > Review URL: https://codereview.chromium.org/21966004 TBR=teravest@chromium.org Review URL: https://codereview.chromium.org/23647008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221544 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/proxy/file_ref_resource.cc | 51 +++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'ppapi/proxy/file_ref_resource.cc') diff --git a/ppapi/proxy/file_ref_resource.cc b/ppapi/proxy/file_ref_resource.cc index 7cd96bc..4c098a5 100644 --- a/ppapi/proxy/file_ref_resource.cc +++ b/ppapi/proxy/file_ref_resource.cc @@ -22,7 +22,7 @@ namespace proxy { FileRefResource::FileRefResource( Connection connection, PP_Instance instance, - const FileRefCreateInfo& create_info) + const FileRef_CreateInfo& create_info) : PluginResource(connection, instance), create_info_(create_info), file_system_resource_(create_info.file_system_plugin_resource) { @@ -34,26 +34,19 @@ FileRefResource::FileRefResource( create_info_.internal_path.erase(path_size - 1, 1); path_var_ = new StringVar(create_info_.internal_path); + create_info_.display_name = GetNameForInternalFilePath( create_info_.internal_path); } name_var_ = new StringVar(create_info_.display_name); - if (create_info_.browser_pending_host_resource_id != 0 && - create_info_.renderer_pending_host_resource_id != 0) { - AttachToPendingHost(BROWSER, create_info_.browser_pending_host_resource_id); - AttachToPendingHost(RENDERER, - create_info_.renderer_pending_host_resource_id); + if (create_info_.pending_host_resource_id != 0) { + AttachToPendingHost(BROWSER, create_info_.pending_host_resource_id); } else { - CHECK(create_info_.browser_pending_host_resource_id == 0); - CHECK(create_info_.renderer_pending_host_resource_id == 0); CHECK(create_info_.file_system_type != PP_FILESYSTEMTYPE_EXTERNAL); SendCreate(BROWSER, PpapiHostMsg_FileRef_CreateInternal( create_info.file_system_plugin_resource, create_info.internal_path)); - SendCreate(RENDERER, PpapiHostMsg_FileRef_CreateInternal( - create_info.file_system_plugin_resource, - create_info.internal_path)); } } @@ -64,7 +57,7 @@ FileRefResource::~FileRefResource() { PP_Resource FileRefResource::CreateFileRef( Connection connection, PP_Instance instance, - const FileRefCreateInfo& create_info) { + const FileRef_CreateInfo& create_info) { // If we have a valid file_system resource, ensure that its type matches that // of the fs_type parameter. if (create_info.file_system_plugin_resource != 0) { @@ -89,7 +82,9 @@ PP_Resource FileRefResource::CreateFileRef( } thunk::PPB_FileRef_API* FileRefResource::AsPPB_FileRef_API() { - return this; + // TODO: return "this" once we update PPB_FileRef_API. + NOTREACHED(); + return NULL; } PP_FileSystemType FileRefResource::GetFileSystemType() const { @@ -116,7 +111,7 @@ PP_Resource FileRefResource::GetParent() { pos++; std::string parent_path = create_info_.internal_path.substr(0, pos); - ppapi::FileRefCreateInfo parent_info; + ppapi::FileRef_CreateInfo parent_info; parent_info.file_system_type = create_info_.file_system_type; parent_info.internal_path = parent_path; parent_info.display_name = GetNameForInternalFilePath(parent_path); @@ -189,9 +184,33 @@ int32_t FileRefResource::ReadDirectoryEntries( return PP_OK_COMPLETIONPENDING; } -const FileRefCreateInfo& FileRefResource::GetCreateInfo() const { +/* +const FileRef_CreateInfo& FileRefResource::GetCreateInfo() const { return create_info_; } +*/ +const PPB_FileRef_CreateInfo& FileRefResource::GetCreateInfo() const { + // FIXME + NOTREACHED(); + PPB_FileRef_CreateInfo *info = new PPB_FileRef_CreateInfo(); + return *info; +} + +// TODO(teravest): Remove this when we are finished moving to the new proxy. +int32_t FileRefResource::QueryInHost(linked_ptr info, + scoped_refptr callback) { + NOTREACHED(); + return PP_ERROR_FAILED; +} + +// TODO(teravest): Remove this when we are finished moving to the new proxy. +int32_t FileRefResource::ReadDirectoryEntriesInHost( + linked_ptr > files, + linked_ptr > file_types, + scoped_refptr callback) { + NOTREACHED(); + return PP_ERROR_FAILED; +} PP_Var FileRefResource::GetAbsolutePath() { if (!absolute_path_var_.get()) { @@ -229,7 +248,7 @@ void FileRefResource::OnDirectoryEntriesReply( const PP_ArrayOutput& output, scoped_refptr callback, const ResourceMessageReplyParams& params, - const std::vector& infos, + const std::vector& infos, const std::vector& file_types) { if (!TrackedCallback::IsPending(callback)) return; -- cgit v1.1