diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 04:51:07 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 04:51:07 +0000 |
commit | 6f75c95235c7ea357e180ddfb6d1cba143d87645 (patch) | |
tree | e5440672cfbe6bac4d28f6790ab1c5b4ee8b3f93 /ppapi/proxy | |
parent | ecba6c3763755a5c617972d74f0d798939183260 (diff) | |
download | chromium_src-6f75c95235c7ea357e180ddfb6d1cba143d87645.zip chromium_src-6f75c95235c7ea357e180ddfb6d1cba143d87645.tar.gz chromium_src-6f75c95235c7ea357e180ddfb6d1cba143d87645.tar.bz2 |
Convert FileRefImpl and URLRequestInfo to shared_impl.
One nice side effect of this change is that there are no longer any IPCs
associated with the request info. Instead, we just send the parameters to
the host when we open a url loader.
Review URL: http://codereview.chromium.org/7706021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98391 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 63 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.cc | 34 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.h | 11 | ||||
-rw-r--r-- | ppapi/proxy/ppb_file_chooser_proxy.cc | 10 | ||||
-rw-r--r-- | ppapi/proxy/ppb_file_chooser_proxy.h | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppb_file_ref_proxy.cc | 88 | ||||
-rw-r--r-- | ppapi/proxy/ppb_file_ref_proxy.h | 11 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.cc | 43 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.h | 6 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_loader_proxy.cc | 27 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_loader_proxy.h | 5 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_request_info_proxy.cc | 163 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_request_info_proxy.h | 24 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_response_info_proxy.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_response_info_proxy.h | 6 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.cc | 9 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.h | 4 | ||||
-rw-r--r-- | ppapi/proxy/serialized_structs.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/serialized_structs.h | 11 |
19 files changed, 169 insertions, 358 deletions
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index cd1efe1..f786163 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -34,6 +34,7 @@ #include "ppapi/proxy/serialized_structs.h" #include "ppapi/shared_impl/input_event_impl.h" #include "ppapi/shared_impl/ppapi_preferences.h" +#include "ppapi/shared_impl/url_request_info_impl.h" #define IPC_MESSAGE_START PpapiMsgStart @@ -108,6 +109,35 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::InputEventData) IPC_STRUCT_TRAITS_MEMBER(character_text) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(ppapi::PPB_URLRequestInfo_Data) + IPC_STRUCT_TRAITS_MEMBER(url) + IPC_STRUCT_TRAITS_MEMBER(method) + IPC_STRUCT_TRAITS_MEMBER(headers) + IPC_STRUCT_TRAITS_MEMBER(stream_to_file) + IPC_STRUCT_TRAITS_MEMBER(follow_redirects) + IPC_STRUCT_TRAITS_MEMBER(record_download_progress) + IPC_STRUCT_TRAITS_MEMBER(record_upload_progress) + IPC_STRUCT_TRAITS_MEMBER(has_custom_referrer_url) + IPC_STRUCT_TRAITS_MEMBER(custom_referrer_url) + IPC_STRUCT_TRAITS_MEMBER(allow_cross_origin_requests) + IPC_STRUCT_TRAITS_MEMBER(allow_credentials) + IPC_STRUCT_TRAITS_MEMBER(has_custom_content_transfer_encoding) + IPC_STRUCT_TRAITS_MEMBER(custom_content_transfer_encoding) + IPC_STRUCT_TRAITS_MEMBER(prefetch_buffer_upper_threshold) + IPC_STRUCT_TRAITS_MEMBER(prefetch_buffer_lower_threshold) + IPC_STRUCT_TRAITS_MEMBER(body) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(ppapi::PPB_URLRequestInfo_Data::BodyItem) + IPC_STRUCT_TRAITS_MEMBER(is_file) + IPC_STRUCT_TRAITS_MEMBER(data) + // Note: we don't serialize file_ref. + IPC_STRUCT_TRAITS_MEMBER(file_ref_host_resource) + IPC_STRUCT_TRAITS_MEMBER(start_offset) + IPC_STRUCT_TRAITS_MEMBER(number_of_bytes) + IPC_STRUCT_TRAITS_MEMBER(expected_last_modified_time) +IPC_STRUCT_TRAITS_END() + // These are from the browser to the plugin. // Loads the given plugin. IPC_MESSAGE_CONTROL1(PpapiMsg_LoadPlugin, FilePath /* path */) @@ -189,7 +219,7 @@ IPC_MESSAGE_ROUTED3( PpapiMsg_PPBFileChooser_ChooseComplete, ppapi::HostResource /* chooser */, int32_t /* result_code (will be != PP_OK on failure */, - std::vector<ppapi::proxy::PPBFileRef_CreateInfo> /* chosen_files */) + std::vector<ppapi::PPB_FileRef_CreateInfo> /* chosen_files */) // PPB_FileSystem. IPC_MESSAGE_ROUTED2( @@ -531,10 +561,10 @@ IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBFileChooser_Show, IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFileRef_Create, ppapi::HostResource /* file_system */, std::string /* path */, - ppapi::proxy::PPBFileRef_CreateInfo /* result */) + ppapi::PPB_FileRef_CreateInfo /* result */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFileRef_GetParent, ppapi::HostResource /* file_ref */, - ppapi::proxy::PPBFileRef_CreateInfo /* result */) + ppapi::PPB_FileRef_CreateInfo /* result */) IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileRef_MakeDirectory, ppapi::HostResource /* file_ref */, PP_Bool /* make_ancestors */, @@ -575,8 +605,9 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetProxyForURL, PP_Instance /* instance */, std::string /* url */, ppapi::proxy::SerializedVar /* result */) -IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBFlash_Navigate, - ppapi::HostResource /* request_info */, +IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate, + PP_Instance /* instance */, + ppapi::PPB_URLRequestInfo_Data /* request_data */, std::string /* target */, bool /* from_user_action */, int32_t /* result */) @@ -840,7 +871,7 @@ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLLoader_Create, ppapi::HostResource /* result */) IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBURLLoader_Open, ppapi::HostResource /* loader */, - ppapi::HostResource /*request_info */, + ppapi::PPB_URLRequestInfo_Data /* request_data */, uint32_t /* serialized_callback */) IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLLoader_FollowRedirect, ppapi::HostResource /* loader */, @@ -860,24 +891,6 @@ IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_Close, IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_GrantUniversalAccess, ppapi::HostResource /* loader */) -// PPB_URLRequestInfo. -IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLRequestInfo_Create, - PP_Instance /* instance */, - ppapi::HostResource /* result */) -IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBURLRequestInfo_SetProperty, - ppapi::HostResource /* request */, - int32_t /* property */, - ppapi::proxy::SerializedVar /* value */) -IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLRequestInfo_AppendDataToBody, - ppapi::HostResource /* request */, - std::string /* data */) -IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBURLRequestInfo_AppendFileToBody, - ppapi::HostResource /* request */, - ppapi::HostResource /* file_ref */, - int64_t /* start_offset */, - int64_t /* number_of_bytes */, - double /* expected_last_modified_time */) - // PPB_URLResponseInfo. IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBURLResponseInfo_GetProperty, ppapi::HostResource /* response */, @@ -885,7 +898,7 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBURLResponseInfo_GetProperty, ppapi::proxy::SerializedVar /* result */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef, ppapi::HostResource /* response */, - ppapi::proxy::PPBFileRef_CreateInfo /* result */) + ppapi::PPB_FileRef_CreateInfo /* result */) // PPB_URLUtil. IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBURLUtil_ResolveRelativeToDocument, diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index 0e3c6de..b80df34 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -248,33 +248,31 @@ void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Log( std::string* l) { } -// PPBFileRef_CreateInfo ------------------------------------------------------- +// PPB_FileRef_CreateInfo ------------------------------------------------------ // static -void ParamTraits<ppapi::proxy::PPBFileRef_CreateInfo>::Write( - Message* m, - const param_type& p) { +void ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Write(Message* m, + const param_type& p) { ParamTraits<ppapi::HostResource>::Write(m, p.resource); ParamTraits<int>::Write(m, p.file_system_type); - ParamTraits<ppapi::proxy::SerializedVar>::Write(m, p.path); - ParamTraits<ppapi::proxy::SerializedVar>::Write(m, p.name); + ParamTraits<std::string>::Write(m, p.path); + ParamTraits<std::string>::Write(m, p.name); } // static -bool ParamTraits<ppapi::proxy::PPBFileRef_CreateInfo>::Read(const Message* m, - void** iter, - param_type* r) { +bool ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Read(const Message* m, + void** iter, + param_type* r) { return ParamTraits<ppapi::HostResource>::Read(m, iter, &r->resource) && ParamTraits<int>::Read(m, iter, &r->file_system_type) && - ParamTraits<ppapi::proxy::SerializedVar>::Read(m, iter, &r->path) && - ParamTraits<ppapi::proxy::SerializedVar>::Read(m, iter, &r->name); + ParamTraits<std::string>::Read(m, iter, &r->path) && + ParamTraits<std::string>::Read(m, iter, &r->name); } // static -void ParamTraits<ppapi::proxy::PPBFileRef_CreateInfo>::Log( - const param_type& p, - std::string* l) { +void ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Log(const param_type& p, + std::string* l) { } // PPBURLLoader_UpdateProgress_Params ------------------------------------------ @@ -440,16 +438,16 @@ void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Log( std::string* l) { } -// std::vector<PPBFileRef_CreateInfo> ------------------------------------------ +// std::vector<PPB_FileRef_CreateInfo> ----------------------------------------- -void ParamTraits< std::vector<ppapi::proxy::PPBFileRef_CreateInfo> >::Write( +void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Write( Message* m, const param_type& p) { WriteVectorWithoutCopy(m, p); } // static -bool ParamTraits< std::vector<ppapi::proxy::PPBFileRef_CreateInfo> >::Read( +bool ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Read( const Message* m, void** iter, param_type* r) { @@ -457,7 +455,7 @@ bool ParamTraits< std::vector<ppapi::proxy::PPBFileRef_CreateInfo> >::Read( } // static -void ParamTraits< std::vector<ppapi::proxy::PPBFileRef_CreateInfo> >::Log( +void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Log( const param_type& p, std::string* l) { } diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index b53d5f5..71fa9cb 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -13,6 +13,7 @@ #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_var.h" +#include "ppapi/shared_impl/file_ref_impl.h" struct PP_FileInfo; struct PP_ObjectProperty; @@ -22,10 +23,10 @@ struct PP_Flash_NetAddress; namespace ppapi { class HostResource; +//struct PPB_FileRef_CreateInfo; namespace proxy { -struct PPBFileRef_CreateInfo; struct PPBFlash_DrawGlyphs_Params; struct PPBURLLoader_UpdateProgress_Params; struct SerializedDirEntry; @@ -79,8 +80,8 @@ struct ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params> { }; template<> -struct ParamTraits<ppapi::proxy::PPBFileRef_CreateInfo> { - typedef ppapi::proxy::PPBFileRef_CreateInfo param_type; +struct ParamTraits<ppapi::PPB_FileRef_CreateInfo> { + typedef ppapi::PPB_FileRef_CreateInfo param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); static void Log(const param_type& p, std::string* l); @@ -135,8 +136,8 @@ struct ParamTraits< std::vector<ppapi::proxy::SerializedVar> > { }; template<> -struct ParamTraits< std::vector<ppapi::proxy::PPBFileRef_CreateInfo> > { - typedef std::vector<ppapi::proxy::PPBFileRef_CreateInfo> param_type; +struct ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> > { + typedef std::vector<ppapi::PPB_FileRef_CreateInfo> param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); static void Log(const param_type& p, std::string* l); diff --git a/ppapi/proxy/ppb_file_chooser_proxy.cc b/ppapi/proxy/ppb_file_chooser_proxy.cc index 10ed0d9..f13ea86 100644 --- a/ppapi/proxy/ppb_file_chooser_proxy.cc +++ b/ppapi/proxy/ppb_file_chooser_proxy.cc @@ -39,7 +39,7 @@ class FileChooser : public Resource, // Handles the choose complete notification from the host. void ChooseComplete( int32_t result_code, - const std::vector<PPBFileRef_CreateInfo>& chosen_files); + const std::vector<PPB_FileRef_CreateInfo>& chosen_files); private: PP_CompletionCallback current_show_callback_; @@ -106,7 +106,7 @@ PP_Resource FileChooser::GetNextChosenFile() { void FileChooser::ChooseComplete( int32_t result_code, - const std::vector<PPBFileRef_CreateInfo>& chosen_files) { + const std::vector<PPB_FileRef_CreateInfo>& chosen_files) { // Convert each of the passed in file infos to resources. These will be owned // by the FileChooser object until they're passed to the plugin. DCHECK(file_queue_.empty()); @@ -245,7 +245,7 @@ void PPB_FileChooser_Proxy::OnMsgShow(const HostResource& chooser) { void PPB_FileChooser_Proxy::OnMsgChooseComplete( const HostResource& chooser, int32_t result_code, - const std::vector<PPBFileRef_CreateInfo>& chosen_files) { + const std::vector<PPB_FileRef_CreateInfo>& chosen_files) { EnterPluginFromHostResource<PPB_FileChooser_API> enter(chooser); if (enter.succeeded()) { static_cast<FileChooser*>(enter.object())->ChooseComplete( @@ -255,7 +255,7 @@ void PPB_FileChooser_Proxy::OnMsgChooseComplete( void PPB_FileChooser_Proxy::OnShowCallback(int32_t result, const HostResource& chooser) { - std::vector<PPBFileRef_CreateInfo> files; + std::vector<PPB_FileRef_CreateInfo> files; if (result == PP_OK) { // Jump through some hoops to get the FileRef proxy. Since we know we're // in the host at this point, we can ask the host dispatcher for it. @@ -268,7 +268,7 @@ void PPB_FileChooser_Proxy::OnShowCallback(int32_t result, while (PP_Resource cur_file_resource = ppb_file_chooser_target()->GetNextChosenFile( chooser.host_resource())) { - PPBFileRef_CreateInfo cur_create_info; + PPB_FileRef_CreateInfo cur_create_info; file_ref_proxy->SerializeFileRef(cur_file_resource, &cur_create_info); files.push_back(cur_create_info); } diff --git a/ppapi/proxy/ppb_file_chooser_proxy.h b/ppapi/proxy/ppb_file_chooser_proxy.h index 322edc2..4f3bc84 100644 --- a/ppapi/proxy/ppb_file_chooser_proxy.h +++ b/ppapi/proxy/ppb_file_chooser_proxy.h @@ -20,10 +20,10 @@ struct PPB_FileChooser_Dev; namespace ppapi { class HostResource; +struct PPB_FileRef_CreateInfo; namespace proxy { -struct PPBFileRef_CreateInfo; class SerializedVarReceiveInput; class PPB_FileChooser_Proxy : public InterfaceProxy { @@ -58,7 +58,7 @@ class PPB_FileChooser_Proxy : public InterfaceProxy { void OnMsgChooseComplete( const ppapi::HostResource& chooser, int32_t result_code, - const std::vector<PPBFileRef_CreateInfo>& chosen_files); + const std::vector<PPB_FileRef_CreateInfo>& chosen_files); // Called when the show is complete in the host. This will notify the plugin // via IPC and OnMsgChooseComplete will be called there. diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc index 9ad0635..0cf26bd 100644 --- a/ppapi/proxy/ppb_file_ref_proxy.cc +++ b/ppapi/proxy/ppb_file_ref_proxy.cc @@ -12,7 +12,7 @@ #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/serialized_var.h" -#include "ppapi/thunk/ppb_file_ref_api.h" +#include "ppapi/shared_impl/file_ref_impl.h" #include "ppapi/thunk/resource_creation_api.h" #include "ppapi/thunk/thunk.h" @@ -33,18 +33,12 @@ InterfaceProxy* CreateFileRefProxy(Dispatcher* dispatcher, } // namespace -class FileRef : public Resource, public PPB_FileRef_API { +class FileRef : public FileRefImpl { public: - explicit FileRef(const PPBFileRef_CreateInfo& info); + explicit FileRef(const PPB_FileRef_CreateInfo& info); virtual ~FileRef(); - // Resource overrides. - virtual PPB_FileRef_API* AsPPB_FileRef_API() OVERRIDE; - - // PPB_FileRef_API implementation. - virtual PP_FileSystemType GetFileSystemType() const OVERRIDE; - virtual PP_Var GetName() const OVERRIDE; - virtual PP_Var GetPath() const OVERRIDE; + // PPB_FileRef_API implementation (not provided by FileRefImpl). virtual PP_Resource GetParent() OVERRIDE; virtual int32_t MakeDirectory(PP_Bool make_ancestors, PP_CompletionCallback callback) OVERRIDE; @@ -60,50 +54,18 @@ class FileRef : public Resource, public PPB_FileRef_API { return PluginDispatcher::GetForResource(this); } - PP_FileSystemType file_system_type_; - PP_Var path_; - PP_Var name_; - - DISALLOW_COPY_AND_ASSIGN(FileRef); + DISALLOW_IMPLICIT_CONSTRUCTORS(FileRef); }; -FileRef::FileRef(const PPBFileRef_CreateInfo& info) - : Resource(info.resource) { - Dispatcher* dispatcher = PluginDispatcher::GetForResource(this); - - file_system_type_ = static_cast<PP_FileSystemType>(info.file_system_type); - - name_ = ReceiveSerializedVarReturnValue(info.name).Return(dispatcher); - path_ = ReceiveSerializedVarReturnValue(info.path).Return(dispatcher); +FileRef::FileRef(const PPB_FileRef_CreateInfo& info) + : FileRefImpl(FileRefImpl::InitAsProxy(), info) { } FileRef::~FileRef() { - PluginVarTracker& var_tracker = - PluginResourceTracker::GetInstance()->var_tracker(); - var_tracker.ReleaseVar(path_); - var_tracker.ReleaseVar(name_); -} - -PPB_FileRef_API* FileRef::AsPPB_FileRef_API() { - return this; -} - -PP_FileSystemType FileRef::GetFileSystemType() const { - return file_system_type_; -} - -PP_Var FileRef::GetName() const { - PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(name_); - return name_; -} - -PP_Var FileRef::GetPath() const { - PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(path_); - return path_; } PP_Resource FileRef::GetParent() { - PPBFileRef_CreateInfo create_info; + PPB_FileRef_CreateInfo create_info; GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_GetParent( INTERFACE_ID_PPB_FILE_REF, host_resource(), &create_info)); return PPB_FileRef_Proxy::DeserializeFileRef(create_info); @@ -176,7 +138,7 @@ PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system, if (!file_system_object) return 0; - PPBFileRef_CreateInfo create_info; + PPB_FileRef_CreateInfo create_info; PluginDispatcher::GetForResource(file_system_object)->Send( new PpapiHostMsg_PPBFileRef_Create( INTERFACE_ID_PPB_FILE_REF, file_system_object->host_resource(), @@ -200,35 +162,15 @@ bool PPB_FileRef_Proxy::OnMessageReceived(const IPC::Message& msg) { } void PPB_FileRef_Proxy::SerializeFileRef(PP_Resource file_ref, - PPBFileRef_CreateInfo* result) { + PPB_FileRef_CreateInfo* result) { EnterResourceNoLock<PPB_FileRef_API> enter(file_ref, false); - if (enter.failed()) { - NOTREACHED(); - return; - } - - // We need the instance out of the resource for serializing back to the - // plugin. This code can only run in the host. - if (dispatcher()->IsPlugin()) { - NOTREACHED(); - return; - } - HostDispatcher* host_dispatcher = static_cast<HostDispatcher*>(dispatcher()); - PP_Instance instance = - host_dispatcher->ppb_proxy()->GetInstanceForResource(file_ref); - - result->resource.SetHostResource(instance, file_ref); - result->file_system_type = - static_cast<int>(enter.object()->GetFileSystemType()); - result->path = SerializedVarReturnValue::Convert(dispatcher(), - enter.object()->GetPath()); - result->name = SerializedVarReturnValue::Convert(dispatcher(), - enter.object()->GetName()); + if (enter.succeeded()) + *result = enter.object()->GetCreateInfo(); } // static PP_Resource PPB_FileRef_Proxy::DeserializeFileRef( - const PPBFileRef_CreateInfo& serialized) { + const PPB_FileRef_CreateInfo& serialized) { if (serialized.resource.is_null()) return 0; // Resource invalid. return (new FileRef(serialized))->GetReference(); @@ -236,7 +178,7 @@ PP_Resource PPB_FileRef_Proxy::DeserializeFileRef( void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system, const std::string& path, - PPBFileRef_CreateInfo* result) { + PPB_FileRef_CreateInfo* result) { EnterFunctionNoLock<ResourceCreationAPI> enter(file_system.instance(), true); if (enter.failed()) return; @@ -248,7 +190,7 @@ void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system, } void PPB_FileRef_Proxy::OnMsgGetParent(const HostResource& host_resource, - PPBFileRef_CreateInfo* result) { + PPB_FileRef_CreateInfo* result) { EnterHostFromHostResource<PPB_FileRef_API> enter(host_resource); if (enter.succeeded()) SerializeFileRef(enter.object()->GetParent(), result); diff --git a/ppapi/proxy/ppb_file_ref_proxy.h b/ppapi/proxy/ppb_file_ref_proxy.h index 3ae502d..1241343 100644 --- a/ppapi/proxy/ppb_file_ref_proxy.h +++ b/ppapi/proxy/ppb_file_ref_proxy.h @@ -18,11 +18,10 @@ struct PPB_FileRef_Dev; namespace ppapi { class HostResource; +struct PPB_FileRef_CreateInfo; namespace proxy { -struct PPBFileRef_CreateInfo; - class PPB_FileRef_Proxy : public InterfaceProxy { public: PPB_FileRef_Proxy(Dispatcher* dispatcher, const void* target_interface); @@ -46,7 +45,7 @@ class PPB_FileRef_Proxy : public InterfaceProxy { // Various PPAPI functions return file refs from various interfaces, so this // function is public so anybody can send a file ref. void SerializeFileRef(PP_Resource file_ref, - PPBFileRef_CreateInfo* result); + PPB_FileRef_CreateInfo* result); // Creates a plugin resource from the given CreateInfo sent from the host. // The value will be the result of calling SerializeFileRef on the host. @@ -56,15 +55,15 @@ class PPB_FileRef_Proxy : public InterfaceProxy { // Various PPAPI functions return file refs from various interfaces, so this // function is public so anybody can receive a file ref. static PP_Resource DeserializeFileRef( - const PPBFileRef_CreateInfo& serialized); + const PPB_FileRef_CreateInfo& serialized); private: // Message handlers. void OnMsgCreate(const ppapi::HostResource& file_system, const std::string& path, - PPBFileRef_CreateInfo* result); + PPB_FileRef_CreateInfo* result); void OnMsgGetParent(const ppapi::HostResource& host_resource, - PPBFileRef_CreateInfo* result); + PPB_FileRef_CreateInfo* result); void OnMsgMakeDirectory(const ppapi::HostResource& host_resource, PP_Bool make_ancestors, uint32_t serialized_callback); diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 725af5f..c551ace 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -19,6 +19,10 @@ #include "ppapi/proxy/proxy_module.h" #include "ppapi/proxy/serialized_var.h" #include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/scoped_pp_resource.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_url_request_info_api.h" +#include "ppapi/thunk/resource_creation_api.h" namespace ppapi { namespace proxy { @@ -95,20 +99,19 @@ PP_Var GetProxyForURL(PP_Instance instance, const char* url) { int32_t Navigate(PP_Resource request_id, const char* target, bool from_user_action) { - Resource* request_object = - PluginResourceTracker::GetInstance()->GetResource(request_id); - if (!request_object) + thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true); + if (enter.failed()) return PP_ERROR_BADRESOURCE; + PP_Instance instance = enter.resource()->pp_instance(); - PluginDispatcher* dispatcher = - PluginDispatcher::GetForInstance(request_object->pp_instance()); + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); if (!dispatcher) return PP_ERROR_FAILED; int32_t result = PP_ERROR_FAILED; dispatcher->Send(new PpapiHostMsg_PPBFlash_Navigate( INTERFACE_ID_PPB_FLASH, - request_object->host_resource(), target, from_user_action, + instance, enter.object()->GetData(), target, from_user_action, &result)); return result; } @@ -256,18 +259,40 @@ void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance, instance, url.c_str())); } -void PPB_Flash_Proxy::OnMsgNavigate(const HostResource& request_info, +void PPB_Flash_Proxy::OnMsgNavigate(PP_Instance instance, + const PPB_URLRequestInfo_Data& data, const std::string& target, bool from_user_action, int32_t* result) { DCHECK(!dispatcher()->IsPlugin()); + + // Validate the PP_Instance since we'll be constructing resources on its + // behalf. + HostDispatcher* host_dispatcher = static_cast<HostDispatcher*>(dispatcher()); + if (HostDispatcher::GetForInstance(instance) != host_dispatcher) { + NOTREACHED(); + *result = PP_ERROR_BADARGUMENT; + return; + } + // We need to allow re-entrancy here, because this may call into Javascript // (e.g. with a "javascript:" URL), or do things like navigate away from the // page, either one of which will need to re-enter into the plugin. // It is safe, because it is essentially equivalent to NPN_GetURL, where Flash // would expect re-entrancy. When running in-process, it does re-enter here. - static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); - *result = ppb_flash_target()->Navigate(request_info.host_resource(), + host_dispatcher->set_allow_plugin_reentrancy(); + + // Make a temporary request resource. + thunk::EnterFunctionNoLock<thunk::ResourceCreationAPI> enter(instance, true); + if (enter.failed()) { + *result = PP_ERROR_FAILED; + return; + } + ScopedPPResource request_resource( + ScopedPPResource::PassRef(), + enter.functions()->CreateURLRequestInfo(instance, data)); + + *result = ppb_flash_target()->Navigate(request_resource, target.c_str(), from_user_action); } diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index faf4222..f893ce2 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -19,6 +19,9 @@ struct PP_FileInfo; struct PPB_Flash; namespace ppapi { + +struct PPB_URLRequestInfo_Data; + namespace proxy { struct PPBFlash_DrawGlyphs_Params; @@ -47,7 +50,8 @@ class PPB_Flash_Proxy : public InterfaceProxy { void OnMsgGetProxyForURL(PP_Instance instance, const std::string& url, SerializedVarReturnValue result); - void OnMsgNavigate(const HostResource& request_info, + void OnMsgNavigate(PP_Instance instance, + const PPB_URLRequestInfo_Data& data, const std::string& target, bool from_user_action, int32_t* result); diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc index 3f6cd10..e6ef68e 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.cc +++ b/ppapi/proxy/ppb_url_loader_proxy.cc @@ -22,6 +22,7 @@ #include "ppapi/proxy/plugin_resource_tracker.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppb_url_response_info_proxy.h" +#include "ppapi/shared_impl/scoped_pp_resource.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_url_loader_api.h" #include "ppapi/thunk/resource_creation_api.h" @@ -180,16 +181,14 @@ PPB_URLLoader_API* URLLoader::AsPPB_URLLoader_API() { int32_t URLLoader::Open(PP_Resource request_id, PP_CompletionCallback callback) { - Resource* request_object = - PluginResourceTracker::GetInstance()->GetResource(request_id); - if (!request_object) - return PP_ERROR_BADARGUMENT; + EnterResourceNoLock<thunk::PPB_URLRequestInfo_API> enter(request_id, true); + if (enter.failed()) + return PP_ERROR_BADRESOURCE; // TODO(brettw) http://crbug.com/86279: SendCallback doesn't ensure that // the proper callback semantics happen if the object is deleted. GetDispatcher()->Send(new PpapiHostMsg_PPBURLLoader_Open( - INTERFACE_ID_PPB_URL_LOADER, host_resource(), - request_object->host_resource(), + INTERFACE_ID_PPB_URL_LOADER, host_resource(), enter.object()->GetData(), GetDispatcher()->callback_tracker().SendCallback(callback))); return PP_OK_COMPLETIONPENDING; } @@ -453,13 +452,23 @@ void PPB_URLLoader_Proxy::OnMsgCreate(PP_Instance instance, } void PPB_URLLoader_Proxy::OnMsgOpen(const HostResource& loader, - const HostResource& request_info, + const PPB_URLRequestInfo_Data& data, uint32_t serialized_callback) { + // Have to be careful to always issue the callback, so don't return early. EnterHostFromHostResource<PPB_URLLoader_API> enter(loader); + EnterFunctionNoLock<ResourceCreationAPI> enter_creation( + loader.instance(), true); + PP_CompletionCallback callback = ReceiveCallback(serialized_callback); + int32_t result = PP_ERROR_BADRESOURCE; - if (enter.succeeded()) - result = enter.object()->Open(request_info.host_resource(), callback); + if (enter.succeeded() && enter_creation.succeeded()) { + ScopedPPResource request_resource( + ScopedPPResource::PassRef(), + enter_creation.functions()->CreateURLRequestInfo(loader.instance(), + data)); + result = enter.object()->Open(request_resource, callback); + } if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); // TODO(brettw) bug 73236 register for the status callbacks. diff --git a/ppapi/proxy/ppb_url_loader_proxy.h b/ppapi/proxy/ppb_url_loader_proxy.h index 7f2ec40..17825f1 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.h +++ b/ppapi/proxy/ppb_url_loader_proxy.h @@ -20,6 +20,9 @@ struct PPB_URLLoader; struct PPB_URLLoaderTrusted; namespace ppapi { + +struct PPB_URLRequestInfo_Data; + namespace proxy { struct PPBURLLoader_UpdateProgress_Params; @@ -62,7 +65,7 @@ class PPB_URLLoader_Proxy : public InterfaceProxy { void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result); void OnMsgOpen(const ppapi::HostResource& loader, - const ppapi::HostResource& request_info, + const PPB_URLRequestInfo_Data& data, uint32_t serialized_callback); void OnMsgFollowRedirect(const ppapi::HostResource& loader, uint32_t serialized_callback); diff --git a/ppapi/proxy/ppb_url_request_info_proxy.cc b/ppapi/proxy/ppb_url_request_info_proxy.cc index cf9dd3d..e5861f0 100644 --- a/ppapi/proxy/ppb_url_request_info_proxy.cc +++ b/ppapi/proxy/ppb_url_request_info_proxy.cc @@ -4,18 +4,10 @@ #include "ppapi/proxy/ppb_url_request_info_proxy.h" -#include "ppapi/c/ppb_url_request_info.h" -#include "ppapi/proxy/enter_proxy.h" #include "ppapi/proxy/plugin_dispatcher.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/thunk/ppb_url_request_info_api.h" -#include "ppapi/thunk/resource_creation_api.h" +#include "ppapi/shared_impl/url_request_info_impl.h" #include "ppapi/thunk/thunk.h" -using ppapi::thunk::EnterFunctionNoLock; -using ppapi::thunk::PPB_URLRequestInfo_API; -using ppapi::thunk::ResourceCreationAPI; - namespace ppapi { namespace proxy { @@ -28,86 +20,6 @@ InterfaceProxy* CreateURLRequestInfoProxy(Dispatcher* dispatcher, } // namespace -class URLRequestInfo : public Resource, - public PPB_URLRequestInfo_API { - public: - URLRequestInfo(const HostResource& resource); - virtual ~URLRequestInfo(); - - virtual PPB_URLRequestInfo_API* AsPPB_URLRequestInfo_API() OVERRIDE; - - // PPB_URLRequestInfo_API implementation. - virtual PP_Bool SetProperty(PP_URLRequestProperty property, - PP_Var var) OVERRIDE; - virtual PP_Bool AppendDataToBody(const void* data, uint32_t len) OVERRIDE; - virtual PP_Bool AppendFileToBody( - PP_Resource file_ref, - int64_t start_offset, - int64_t number_of_bytes, - PP_Time expected_last_modified_time) OVERRIDE; - - private: - PluginDispatcher* GetDispatcher() const { - return PluginDispatcher::GetForResource(this); - } - - DISALLOW_COPY_AND_ASSIGN(URLRequestInfo); -}; - -URLRequestInfo::URLRequestInfo(const HostResource& resource) - : Resource(resource) { -} - -URLRequestInfo::~URLRequestInfo() { -} - -PPB_URLRequestInfo_API* URLRequestInfo::AsPPB_URLRequestInfo_API() { - return this; -} - -PP_Bool URLRequestInfo::SetProperty(PP_URLRequestProperty property, - PP_Var var) { - GetDispatcher()->Send(new PpapiHostMsg_PPBURLRequestInfo_SetProperty( - INTERFACE_ID_PPB_URL_REQUEST_INFO, host_resource(), - static_cast<int32_t>(property), - SerializedVarSendInput(GetDispatcher(), var))); - - // TODO(brettw) do some validation on the types. We should be able to tell on - // the plugin side whether the request will succeed or fail in the renderer. - return PP_TRUE; -} - -PP_Bool URLRequestInfo::AppendDataToBody(const void* data, uint32_t len) { - GetDispatcher()->Send(new PpapiHostMsg_PPBURLRequestInfo_AppendDataToBody( - INTERFACE_ID_PPB_URL_REQUEST_INFO, host_resource(), - std::string(static_cast<const char*>(data), len))); - - // TODO(brettw) do some validation. We should be able to tell on the plugin - // side whether the request will succeed or fail in the renderer. - return PP_TRUE; -} - -PP_Bool URLRequestInfo::AppendFileToBody(PP_Resource file_ref, - int64_t start_offset, - int64_t number_of_bytes, - PP_Time expected_last_modified_time) { - Resource* file_ref_object = - PluginResourceTracker::GetInstance()->GetResource(file_ref); - if (!file_ref_object) - return PP_FALSE; - - GetDispatcher()->Send(new PpapiHostMsg_PPBURLRequestInfo_AppendFileToBody( - INTERFACE_ID_PPB_URL_REQUEST_INFO, host_resource(), - file_ref_object->host_resource(), - start_offset, number_of_bytes, expected_last_modified_time)); - - // TODO(brettw) do some validation. We should be able to tell on the plugin - // side whether the request will succeed or fail in the renderer. - return PP_TRUE; -} - -// PPB_URLRequestInfo_Proxy ---------------------------------------------------- - PPB_URLRequestInfo_Proxy::PPB_URLRequestInfo_Proxy( Dispatcher* dispatcher, const void* target_interface) @@ -129,78 +41,9 @@ const InterfaceProxy::Info* PPB_URLRequestInfo_Proxy::GetInfo() { return &info; } -// static -PP_Resource PPB_URLRequestInfo_Proxy::CreateProxyResource( - PP_Instance instance) { - PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); - if (!dispatcher) - return 0; - - HostResource result; - dispatcher->Send(new PpapiHostMsg_PPBURLRequestInfo_Create( - INTERFACE_ID_PPB_URL_REQUEST_INFO, instance, &result)); - if (result.is_null()) - return 0; - return (new URLRequestInfo(result))->GetReference(); -} - bool PPB_URLRequestInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(PPB_URLRequestInfo_Proxy, msg) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLRequestInfo_Create, OnMsgCreate) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLRequestInfo_SetProperty, - OnMsgSetProperty) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLRequestInfo_AppendDataToBody, - OnMsgAppendDataToBody) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLRequestInfo_AppendFileToBody, - OnMsgAppendFileToBody) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - // TODO(brettw): handle bad messages. - return handled; -} - -void PPB_URLRequestInfo_Proxy::OnMsgCreate( - PP_Instance instance, - HostResource* result) { - EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true); - if (enter.succeeded()) { - result->SetHostResource(instance, - enter.functions()->CreateURLRequestInfo(instance)); - } -} - -void PPB_URLRequestInfo_Proxy::OnMsgSetProperty( - HostResource request, - int32_t property, - SerializedVarReceiveInput value) { - EnterHostFromHostResource<PPB_URLRequestInfo_API> enter(request); - if (enter.succeeded()) { - enter.object()->SetProperty(static_cast<PP_URLRequestProperty>(property), - value.Get(dispatcher())); - } -} - -void PPB_URLRequestInfo_Proxy::OnMsgAppendDataToBody( - HostResource request, - const std::string& data) { - EnterHostFromHostResource<PPB_URLRequestInfo_API> enter(request); - if (enter.succeeded()) - enter.object()->AppendDataToBody(data.c_str(), data.size()); -} - -void PPB_URLRequestInfo_Proxy::OnMsgAppendFileToBody( - HostResource request, - HostResource file_ref, - int64_t start_offset, - int64_t number_of_bytes, - double expected_last_modified_time) { - EnterHostFromHostResource<PPB_URLRequestInfo_API> enter(request); - if (enter.succeeded()) { - enter.object()->AppendFileToBody( - file_ref.host_resource(), start_offset, number_of_bytes, - expected_last_modified_time); - } + // No messages to handle. + return false; } } // namespace proxy diff --git a/ppapi/proxy/ppb_url_request_info_proxy.h b/ppapi/proxy/ppb_url_request_info_proxy.h index e17ddb2..6242bf8 100644 --- a/ppapi/proxy/ppb_url_request_info_proxy.h +++ b/ppapi/proxy/ppb_url_request_info_proxy.h @@ -7,16 +7,13 @@ #include "base/basictypes.h" #include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" #include "ppapi/proxy/interface_proxy.h" -#include "ppapi/shared_impl/host_resource.h" - -struct PPB_URLRequestInfo; namespace ppapi { -namespace proxy { -class SerializedVarReceiveInput; +struct PPB_URLRequestInfo_Data; + +namespace proxy { class PPB_URLRequestInfo_Proxy : public InterfaceProxy { public: @@ -26,25 +23,10 @@ class PPB_URLRequestInfo_Proxy : public InterfaceProxy { static const Info* GetInfo(); - static PP_Resource CreateProxyResource(PP_Instance instance); - // InterfaceProxy implementation. virtual bool OnMessageReceived(const IPC::Message& msg); private: - // Message handlers. - void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result); - void OnMsgSetProperty(ppapi::HostResource request, - int32_t property, - SerializedVarReceiveInput value); - void OnMsgAppendDataToBody(ppapi::HostResource request, - const std::string& data); - void OnMsgAppendFileToBody(ppapi::HostResource request, - ppapi::HostResource file_ref, - int64_t start_offset, - int64_t number_of_bytes, - double expected_last_modified_time); - DISALLOW_COPY_AND_ASSIGN(PPB_URLRequestInfo_Proxy); }; diff --git a/ppapi/proxy/ppb_url_response_info_proxy.cc b/ppapi/proxy/ppb_url_response_info_proxy.cc index 5be2afe..3801e5f 100644 --- a/ppapi/proxy/ppb_url_response_info_proxy.cc +++ b/ppapi/proxy/ppb_url_response_info_proxy.cc @@ -71,7 +71,7 @@ PP_Resource URLResponseInfo::GetBodyAsFileRef() { // file ref when the request is streaming to a file and it's in the state // where the file is ready. This will prevent us from having to do this sync // IPC here. - PPBFileRef_CreateInfo create_info; + PPB_FileRef_CreateInfo create_info; PluginDispatcher::GetForResource(this)->Send( new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef( INTERFACE_ID_PPB_URL_RESPONSE_INFO, host_resource(), &create_info)); @@ -135,7 +135,7 @@ void PPB_URLResponseInfo_Proxy::OnMsgGetProperty( void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef( const HostResource& response, - PPBFileRef_CreateInfo* result) { + PPB_FileRef_CreateInfo* result) { EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response); PP_Resource file_ref = 0; if (enter.succeeded()) diff --git a/ppapi/proxy/ppb_url_response_info_proxy.h b/ppapi/proxy/ppb_url_response_info_proxy.h index 9713256..a81549d 100644 --- a/ppapi/proxy/ppb_url_response_info_proxy.h +++ b/ppapi/proxy/ppb_url_response_info_proxy.h @@ -15,9 +15,11 @@ struct PPB_URLResponseInfo; namespace ppapi { + +struct PPB_FileRef_CreateInfo; + namespace proxy { -struct PPBFileRef_CreateInfo; class SerializedVarReturnValue; class PPB_URLResponseInfo_Proxy : public InterfaceProxy { @@ -45,7 +47,7 @@ class PPB_URLResponseInfo_Proxy : public InterfaceProxy { int32_t property, SerializedVarReturnValue result); void OnMsgGetBodyAsFileRef(const ppapi::HostResource& response, - PPBFileRef_CreateInfo* result); + PPB_FileRef_CreateInfo* result); DISALLOW_COPY_AND_ASSIGN(PPB_URLResponseInfo_Proxy); }; diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index 70f3f38..89d6504 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -27,7 +27,6 @@ #include "ppapi/proxy/ppb_image_data_proxy.h" #include "ppapi/proxy/ppb_surface_3d_proxy.h" #include "ppapi/proxy/ppb_url_loader_proxy.h" -#include "ppapi/proxy/ppb_url_request_info_proxy.h" #include "ppapi/proxy/ppb_video_capture_proxy.h" #include "ppapi/proxy/ppb_video_decoder_proxy.h" #include "ppapi/shared_impl/audio_config_impl.h" @@ -35,6 +34,7 @@ #include "ppapi/shared_impl/function_group_base.h" #include "ppapi/shared_impl/host_resource.h" #include "ppapi/shared_impl/input_event_impl.h" +#include "ppapi/shared_impl/url_request_info_impl.h" #include "ppapi/shared_impl/var.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_image_data_api.h" @@ -289,8 +289,11 @@ PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { return PPB_URLLoader_Proxy::CreateProxyResource(instance); } -PP_Resource ResourceCreationProxy::CreateURLRequestInfo(PP_Instance instance) { - return PPB_URLRequestInfo_Proxy::CreateProxyResource(instance); +PP_Resource ResourceCreationProxy::CreateURLRequestInfo( + PP_Instance instance, + const PPB_URLRequestInfo_Data& data) { + return (new URLRequestInfoImpl( + HostResource::MakeInstanceOnly(instance), data))->GetReference(); } PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index 0cbf230..3f2e76e 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -109,7 +109,9 @@ class ResourceCreationProxy : public FunctionGroupBase, const char* name, const char* proto) OVERRIDE; virtual PP_Resource CreateURLLoader(PP_Instance instance) OVERRIDE; - virtual PP_Resource CreateURLRequestInfo(PP_Instance instance) OVERRIDE; + virtual PP_Resource CreateURLRequestInfo( + PP_Instance instance, + const PPB_URLRequestInfo_Data& data) OVERRIDE; virtual PP_Resource CreateVideoCapture(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateVideoDecoder( PP_Instance instance, diff --git a/ppapi/proxy/serialized_structs.cc b/ppapi/proxy/serialized_structs.cc index 4fd62ca..e327b60 100644 --- a/ppapi/proxy/serialized_structs.cc +++ b/ppapi/proxy/serialized_structs.cc @@ -63,10 +63,6 @@ void SerializedFontDescription::SetToPPFontDescription( desc->word_spacing = word_spacing; } -PPBFileRef_CreateInfo::PPBFileRef_CreateInfo() - : file_system_type(PP_FILESYSTEMTYPE_EXTERNAL) { -} - PPBFlash_DrawGlyphs_Params::PPBFlash_DrawGlyphs_Params() : instance(0), font_desc(), diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h index 159ee39..706d6be 100644 --- a/ppapi/proxy/serialized_structs.h +++ b/ppapi/proxy/serialized_structs.h @@ -70,17 +70,6 @@ struct SerializedDirEntry { bool is_dir; }; -// FileRefs are created in a number of places and they include a number of -// return values. This struct encapsulates everything in one place. -struct PPBFileRef_CreateInfo { - PPBFileRef_CreateInfo(); // Initializes to 0. - - ppapi::HostResource resource; - int file_system_type; // One of PP_FileSystemType values. - SerializedVar path; - SerializedVar name; -}; - struct PPBFlash_DrawGlyphs_Params { PPBFlash_DrawGlyphs_Params(); ~PPBFlash_DrawGlyphs_Params(); |