| OLD | NEW |
| 1 // Copyright 2010 The Native Client Authors. All rights reserved. | 1 // Copyright 2010 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can | 2 // Use of this source code is governed by a BSD-style license that can |
| 3 // be found in the LICENSE file. | 3 // be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // SRPC-abstraction wrappers around PPB_URLResponseInfo functions. | 5 // SRPC-abstraction wrappers around PPB_URLResponseInfo functions. |
| 6 | 6 |
| 7 #include "native_client/src/include/nacl_macros.h" | 7 #include "native_client/src/include/nacl_macros.h" |
| 8 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" | 8 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
| 9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" | 9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
| 10 #include "ppapi/c/ppb_url_response_info.h" | 10 #include "ppapi/c/ppb_url_response_info.h" |
| 11 #include "srpcgen/ppb_rpc.h" | 11 #include "srpcgen/ppb_rpc.h" |
| 12 | 12 |
| 13 void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_IsURLResponseInfo( | 13 void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_IsURLResponseInfo( |
| 14 NaClSrpcRpc* rpc, | 14 NaClSrpcRpc* rpc, |
| 15 NaClSrpcClosure* done, | 15 NaClSrpcClosure* done, |
| 16 // inputs | 16 // inputs |
| 17 int64_t resource, | 17 PP_Resource resource, |
| 18 // outputs | 18 // outputs |
| 19 int32_t* is_url_response_info) { | 19 int32_t* is_url_response_info) { |
| 20 NACL_UNTESTED(); | 20 NACL_UNTESTED(); |
| 21 NaClSrpcClosureRunner runner(done); | 21 NaClSrpcClosureRunner runner(done); |
| 22 PP_Bool pp_is_url_response_info = | 22 PP_Bool pp_is_url_response_info = |
| 23 ppapi_proxy::PPBURLResponseInfoInterface()->IsURLResponseInfo(resource); | 23 ppapi_proxy::PPBURLResponseInfoInterface()->IsURLResponseInfo(resource); |
| 24 *is_url_response_info = (pp_is_url_response_info == PP_TRUE); | 24 *is_url_response_info = (pp_is_url_response_info == PP_TRUE); |
| 25 rpc->result = NACL_SRPC_RESULT_OK; | 25 rpc->result = NACL_SRPC_RESULT_OK; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetProperty( | 28 void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetProperty( |
| 29 NaClSrpcRpc* rpc, | 29 NaClSrpcRpc* rpc, |
| 30 NaClSrpcClosure* done, | 30 NaClSrpcClosure* done, |
| 31 // inputs | 31 // inputs |
| 32 int64_t response, | 32 PP_Resource response, |
| 33 int32_t property, | 33 int32_t property, |
| 34 // outputs | 34 // outputs |
| 35 nacl_abi_size_t* value_size, char* value_bytes) { | 35 nacl_abi_size_t* value_size, char* value_bytes) { |
| 36 NACL_UNTESTED(); | 36 NACL_UNTESTED(); |
| 37 NaClSrpcClosureRunner runner(done); | 37 NaClSrpcClosureRunner runner(done); |
| 38 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 38 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
| 39 PP_Var value = | 39 PP_Var value = |
| 40 ppapi_proxy::PPBURLResponseInfoInterface()->GetProperty( | 40 ppapi_proxy::PPBURLResponseInfoInterface()->GetProperty( |
| 41 response, | 41 response, |
| 42 static_cast<PP_URLResponseProperty>(property)); | 42 static_cast<PP_URLResponseProperty>(property)); |
| 43 if (!ppapi_proxy::SerializeTo(&value, value_bytes, value_size)) | 43 if (!ppapi_proxy::SerializeTo(&value, value_bytes, value_size)) |
| 44 return; | 44 return; |
| 45 rpc->result = NACL_SRPC_RESULT_OK; | 45 rpc->result = NACL_SRPC_RESULT_OK; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetBodyAsFileRef( | 48 void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetBodyAsFileRef( |
| 49 NaClSrpcRpc* rpc, | 49 NaClSrpcRpc* rpc, |
| 50 NaClSrpcClosure* done, | 50 NaClSrpcClosure* done, |
| 51 // inputs | 51 // inputs |
| 52 int64_t response, | 52 PP_Resource response, |
| 53 // outputs | 53 // outputs |
| 54 int64_t* file_ref) { | 54 PP_Resource* file_ref) { |
| 55 NACL_UNTESTED(); | 55 NACL_UNTESTED(); |
| 56 NaClSrpcClosureRunner runner(done); | 56 NaClSrpcClosureRunner runner(done); |
| 57 *file_ref = | 57 *file_ref = |
| 58 ppapi_proxy::PPBURLResponseInfoInterface()->GetBodyAsFileRef(response); | 58 ppapi_proxy::PPBURLResponseInfoInterface()->GetBodyAsFileRef(response); |
| 59 rpc->result = NACL_SRPC_RESULT_OK; | 59 rpc->result = NACL_SRPC_RESULT_OK; |
| 60 } | 60 } |
| OLD | NEW |