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

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

Issue 7706021: Convert FileRefImpl and URLRequestInfo to shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tests fixed Created 9 years, 3 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/enter_proxy.h" 8 #include "ppapi/proxy/enter_proxy.h"
9 #include "ppapi/proxy/host_dispatcher.h" 9 #include "ppapi/proxy/host_dispatcher.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty( 64 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty(
65 INTERFACE_ID_PPB_URL_RESPONSE_INFO, host_resource(), property, &result)); 65 INTERFACE_ID_PPB_URL_RESPONSE_INFO, host_resource(), property, &result));
66 return result.Return(dispatcher); 66 return result.Return(dispatcher);
67 } 67 }
68 68
69 PP_Resource URLResponseInfo::GetBodyAsFileRef() { 69 PP_Resource URLResponseInfo::GetBodyAsFileRef() {
70 // This could be more efficient by having the host automatically send us the 70 // This could be more efficient by having the host automatically send us the
71 // file ref when the request is streaming to a file and it's in the state 71 // file ref when the request is streaming to a file and it's in the state
72 // where the file is ready. This will prevent us from having to do this sync 72 // where the file is ready. This will prevent us from having to do this sync
73 // IPC here. 73 // IPC here.
74 PPBFileRef_CreateInfo create_info; 74 PPB_FileRef_CreateInfo create_info;
75 PluginDispatcher::GetForResource(this)->Send( 75 PluginDispatcher::GetForResource(this)->Send(
76 new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef( 76 new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef(
77 INTERFACE_ID_PPB_URL_RESPONSE_INFO, host_resource(), &create_info)); 77 INTERFACE_ID_PPB_URL_RESPONSE_INFO, host_resource(), &create_info));
78 return PPB_FileRef_Proxy::DeserializeFileRef(create_info); 78 return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
79 } 79 }
80 80
81 // PPB_URLResponseInfo_Proxy --------------------------------------------------- 81 // PPB_URLResponseInfo_Proxy ---------------------------------------------------
82 82
83 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy( 83 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(
84 Dispatcher* dispatcher, 84 Dispatcher* dispatcher,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 PP_Var result_var = PP_MakeUndefined(); 128 PP_Var result_var = PP_MakeUndefined();
129 if (enter.succeeded()) { 129 if (enter.succeeded()) {
130 result_var = enter.object()->GetProperty( 130 result_var = enter.object()->GetProperty(
131 static_cast<PP_URLResponseProperty>(property)); 131 static_cast<PP_URLResponseProperty>(property));
132 } 132 }
133 result.Return(dispatcher(), result_var); 133 result.Return(dispatcher(), result_var);
134 } 134 }
135 135
136 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef( 136 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef(
137 const HostResource& response, 137 const HostResource& response,
138 PPBFileRef_CreateInfo* result) { 138 PPB_FileRef_CreateInfo* result) {
139 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response); 139 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response);
140 PP_Resource file_ref = 0; 140 PP_Resource file_ref = 0;
141 if (enter.succeeded()) 141 if (enter.succeeded())
142 file_ref = enter.object()->GetBodyAsFileRef(); 142 file_ref = enter.object()->GetBodyAsFileRef();
143 143
144 // Use the FileRef proxy to serialize. 144 // Use the FileRef proxy to serialize.
145 DCHECK(!dispatcher()->IsPlugin()); 145 DCHECK(!dispatcher()->IsPlugin());
146 HostDispatcher* host_disp = static_cast<HostDispatcher*>(dispatcher()); 146 HostDispatcher* host_disp = static_cast<HostDispatcher*>(dispatcher());
147 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>( 147 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
148 host_disp->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_FILE_REF)); 148 host_disp->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_FILE_REF));
149 file_ref_proxy->SerializeFileRef(file_ref, result); 149 file_ref_proxy->SerializeFileRef(file_ref, result);
150 } 150 }
151 151
152 } // namespace proxy 152 } // namespace proxy
153 } // namespace ppapi 153 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698