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

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

Issue 11094060: Exclude host-side code from the NaCl IRT proxy build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « ppapi/proxy/ppb_file_io_proxy.cc ('k') | ppapi/proxy/ppb_file_system_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_file_ref_proxy.h" 5 #include "ppapi/proxy/ppb_file_ref_proxy.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 PluginDispatcher::GetForResource(file_system_object)->Send( 185 PluginDispatcher::GetForResource(file_system_object)->Send(
186 new PpapiHostMsg_PPBFileRef_Create( 186 new PpapiHostMsg_PPBFileRef_Create(
187 API_ID_PPB_FILE_REF, file_system_object->host_resource(), 187 API_ID_PPB_FILE_REF, file_system_object->host_resource(),
188 path, &create_info)); 188 path, &create_info));
189 return PPB_FileRef_Proxy::DeserializeFileRef(create_info); 189 return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
190 } 190 }
191 191
192 bool PPB_FileRef_Proxy::OnMessageReceived(const IPC::Message& msg) { 192 bool PPB_FileRef_Proxy::OnMessageReceived(const IPC::Message& msg) {
193 bool handled = true; 193 bool handled = true;
194 IPC_BEGIN_MESSAGE_MAP(PPB_FileRef_Proxy, msg) 194 IPC_BEGIN_MESSAGE_MAP(PPB_FileRef_Proxy, msg)
195 #if !defined(OS_NACL)
195 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Create, OnMsgCreate) 196 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Create, OnMsgCreate)
196 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetParent, OnMsgGetParent) 197 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetParent, OnMsgGetParent)
197 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_MakeDirectory, 198 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_MakeDirectory,
198 OnMsgMakeDirectory) 199 OnMsgMakeDirectory)
199 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Touch, OnMsgTouch) 200 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Touch, OnMsgTouch)
200 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Delete, OnMsgDelete) 201 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Delete, OnMsgDelete)
201 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Rename, OnMsgRename) 202 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Rename, OnMsgRename)
202 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetAbsolutePath, 203 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetAbsolutePath,
203 OnMsgGetAbsolutePath) 204 OnMsgGetAbsolutePath)
205 #endif // !defined(OS_NACL)
204 206
205 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileRef_CallbackComplete, 207 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileRef_CallbackComplete,
206 OnMsgCallbackComplete) 208 OnMsgCallbackComplete)
207 IPC_MESSAGE_UNHANDLED(handled = false) 209 IPC_MESSAGE_UNHANDLED(handled = false)
208 IPC_END_MESSAGE_MAP() 210 IPC_END_MESSAGE_MAP()
209 return handled; 211 return handled;
210 } 212 }
211 213
212 // static 214 // static
213 void PPB_FileRef_Proxy::SerializeFileRef(PP_Resource file_ref, 215 void PPB_FileRef_Proxy::SerializeFileRef(PP_Resource file_ref,
214 PPB_FileRef_CreateInfo* result) { 216 PPB_FileRef_CreateInfo* result) {
215 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref, false); 217 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref, false);
216 if (enter.succeeded()) 218 if (enter.succeeded())
217 *result = enter.object()->GetCreateInfo(); 219 *result = enter.object()->GetCreateInfo();
218 } 220 }
219 221
220 // static 222 // static
221 PP_Resource PPB_FileRef_Proxy::DeserializeFileRef( 223 PP_Resource PPB_FileRef_Proxy::DeserializeFileRef(
222 const PPB_FileRef_CreateInfo& serialized) { 224 const PPB_FileRef_CreateInfo& serialized) {
223 if (serialized.resource.is_null()) 225 if (serialized.resource.is_null())
224 return 0; // Resource invalid. 226 return 0; // Resource invalid.
225 return (new FileRef(serialized))->GetReference(); 227 return (new FileRef(serialized))->GetReference();
226 } 228 }
227 229
230 #if !defined(OS_NACL)
228 void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system, 231 void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system,
229 const std::string& path, 232 const std::string& path,
230 PPB_FileRef_CreateInfo* result) { 233 PPB_FileRef_CreateInfo* result) {
231 thunk::EnterResourceCreation enter(file_system.instance()); 234 thunk::EnterResourceCreation enter(file_system.instance());
232 if (enter.failed()) 235 if (enter.failed())
233 return; 236 return;
234 PP_Resource resource = enter.functions()->CreateFileRef( 237 PP_Resource resource = enter.functions()->CreateFileRef(
235 file_system.host_resource(), path.c_str()); 238 file_system.host_resource(), path.c_str());
236 if (!resource) 239 if (!resource)
237 return; // CreateInfo default constructor initializes to 0. 240 return; // CreateInfo default constructor initializes to 0.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 enter.callback())); 293 enter.callback()));
291 } 294 }
292 } 295 }
293 296
294 void PPB_FileRef_Proxy::OnMsgGetAbsolutePath(const HostResource& host_resource, 297 void PPB_FileRef_Proxy::OnMsgGetAbsolutePath(const HostResource& host_resource,
295 SerializedVarReturnValue result) { 298 SerializedVarReturnValue result) {
296 EnterHostFromHostResource<PPB_FileRef_API> enter(host_resource); 299 EnterHostFromHostResource<PPB_FileRef_API> enter(host_resource);
297 if (enter.succeeded()) 300 if (enter.succeeded())
298 result.Return(dispatcher(), enter.object()->GetAbsolutePath()); 301 result.Return(dispatcher(), enter.object()->GetAbsolutePath());
299 } 302 }
303 #endif // !defined(OS_NACL)
300 304
301 void PPB_FileRef_Proxy::OnMsgCallbackComplete( 305 void PPB_FileRef_Proxy::OnMsgCallbackComplete(
302 const HostResource& host_resource, 306 const HostResource& host_resource,
303 int callback_id, 307 int callback_id,
304 int32_t result) { 308 int32_t result) {
305 // Forward the callback info to the plugin resource. 309 // Forward the callback info to the plugin resource.
306 EnterPluginFromHostResource<PPB_FileRef_API> enter(host_resource); 310 EnterPluginFromHostResource<PPB_FileRef_API> enter(host_resource);
307 if (enter.succeeded()) 311 if (enter.succeeded())
308 static_cast<FileRef*>(enter.object())->ExecuteCallback(callback_id, result); 312 static_cast<FileRef*>(enter.object())->ExecuteCallback(callback_id, result);
309 } 313 }
310 314
315 #if !defined(OS_NACL)
311 void PPB_FileRef_Proxy::OnCallbackCompleteInHost( 316 void PPB_FileRef_Proxy::OnCallbackCompleteInHost(
312 int32_t result, 317 int32_t result,
313 const HostResource& host_resource, 318 const HostResource& host_resource,
314 int callback_id) { 319 int callback_id) {
315 // Execute OnMsgCallbackComplete in the plugin process. 320 // Execute OnMsgCallbackComplete in the plugin process.
316 Send(new PpapiMsg_PPBFileRef_CallbackComplete( 321 Send(new PpapiMsg_PPBFileRef_CallbackComplete(
317 API_ID_PPB_FILE_REF, host_resource, callback_id, result)); 322 API_ID_PPB_FILE_REF, host_resource, callback_id, result));
318 } 323 }
324 #endif // !defined(OS_NACL)
319 325
320 } // namespace proxy 326 } // namespace proxy
321 } // namespace ppapi 327 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_io_proxy.cc ('k') | ppapi/proxy/ppb_file_system_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698