Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: ppapi/proxy/ppb_url_response_info_proxy.cc

Issue 6543028: Implement the filesystem proxy. This allows the FileRef tests to pass in the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/ppb_url_response_info_proxy.h" 5 #include "ppapi/proxy/ppb_url_response_info_proxy.h"
6 6
7 #include "ppapi/c/ppb_url_response_info.h" 7 #include "ppapi/c/ppb_url_response_info.h"
8 #include "ppapi/proxy/host_dispatcher.h"
8 #include "ppapi/proxy/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
9 #include "ppapi/proxy/plugin_resource.h" 10 #include "ppapi/proxy/plugin_resource.h"
10 #include "ppapi/proxy/ppapi_messages.h" 11 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/proxy/ppb_file_ref_proxy.h"
11 #include "ppapi/proxy/serialized_var.h" 13 #include "ppapi/proxy/serialized_var.h"
12 14
13 namespace pp { 15 namespace pp {
14 namespace proxy { 16 namespace proxy {
15 17
16 class URLResponseInfo : public PluginResource { 18 class URLResponseInfo : public PluginResource {
17 public: 19 public:
18 URLResponseInfo(const HostResource& resource) 20 URLResponseInfo(const HostResource& resource)
19 : PluginResource(resource) { 21 : PluginResource(resource) {
20 } 22 }
(...skipping 23 matching lines...) Expand all
44 return PP_MakeUndefined(); 46 return PP_MakeUndefined();
45 47
46 ReceiveSerializedVarReturnValue result; 48 ReceiveSerializedVarReturnValue result;
47 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty( 49 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty(
48 INTERFACE_ID_PPB_URL_RESPONSE_INFO, object->host_resource(), property, 50 INTERFACE_ID_PPB_URL_RESPONSE_INFO, object->host_resource(), property,
49 &result)); 51 &result));
50 return result.Return(dispatcher); 52 return result.Return(dispatcher);
51 } 53 }
52 54
53 PP_Resource GetBodyAsFileRef(PP_Resource response) { 55 PP_Resource GetBodyAsFileRef(PP_Resource response) {
54 /* 56 URLResponseInfo* object = PluginResource::GetAs<URLResponseInfo>(response);
57 if (!object)
58 return 0;
59 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
60 object->instance());
61 if (!dispatcher)
62 return 0;
63
64 // This could be more efficient by having the host automatically send us the
65 // file ref when the request is streaming to a file and it's in the state
66 // where the file is ready. This will prevent us from having to do this sync
67 // IPC here.
68 PPBFileRef_CreateInfo create_info;
55 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef( 69 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef(
56 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, &result)); 70 INTERFACE_ID_PPB_URL_RESPONSE_INFO,
57 // TODO(brettw) when we have FileRef proxied, make an object from that 71 object->host_resource(), &create_info));
58 // ref so we can track it properly and then uncomment this. 72 return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
59 */
60 return 0;
61 } 73 }
62 74
63 const PPB_URLResponseInfo urlresponseinfo_interface = { 75 const PPB_URLResponseInfo urlresponseinfo_interface = {
64 &IsURLResponseInfo, 76 &IsURLResponseInfo,
65 &GetProperty, 77 &GetProperty,
66 &GetBodyAsFileRef 78 &GetBodyAsFileRef
67 }; 79 };
68 80
69 InterfaceProxy* CreateURLResponseInfoProxy(Dispatcher* dispatcher, 81 InterfaceProxy* CreateURLResponseInfoProxy(Dispatcher* dispatcher,
70 const void* target_interface) { 82 const void* target_interface) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void PPB_URLResponseInfo_Proxy::OnMsgGetProperty( 129 void PPB_URLResponseInfo_Proxy::OnMsgGetProperty(
118 HostResource response, 130 HostResource response,
119 int32_t property, 131 int32_t property,
120 SerializedVarReturnValue result) { 132 SerializedVarReturnValue result) {
121 result.Return(dispatcher(), ppb_url_response_info_target()->GetProperty( 133 result.Return(dispatcher(), ppb_url_response_info_target()->GetProperty(
122 response.host_resource(), static_cast<PP_URLResponseProperty>(property))); 134 response.host_resource(), static_cast<PP_URLResponseProperty>(property)));
123 } 135 }
124 136
125 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef( 137 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef(
126 HostResource response, 138 HostResource response,
127 HostResource* file_ref_result) { 139 PPBFileRef_CreateInfo* result) {
128 file_ref_result->SetHostResource( 140 PP_Resource file_ref = ppb_url_response_info_target()->GetBodyAsFileRef(
129 response.instance(), 141 response.host_resource());
130 ppb_url_response_info_target()->GetBodyAsFileRef( 142
131 response.host_resource())); 143 // Use the FileRef proxy to serialize.
144 DCHECK(!dispatcher()->IsPlugin());
145 HostDispatcher* host_disp = static_cast<HostDispatcher*>(dispatcher());
146 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
147 host_disp->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_FILE_REF));
148 file_ref_proxy->SerializeFileRef(file_ref, result);
132 } 149 }
133 150
134 } // namespace proxy 151 } // namespace proxy
135 } // namespace pp 152 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698