OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2010 The Native Client 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 "srpcgen/ppb_rpc.h" | 5 #include "srpcgen/ppb_rpc.h" |
6 #include "native_client/src/include/portability.h" | 6 #include "native_client/src/include/portability.h" |
7 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" | 7 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
8 #include "native_client/src/shared/ppapi_proxy/utility.h" | 8 #include "native_client/src/shared/ppapi_proxy/utility.h" |
9 #include "ppapi/c/ppb_image_data.h" | 9 #include "ppapi/c/ppb_image_data.h" |
10 #include "ppapi/c/pp_point.h" | 10 #include "ppapi/c/pp_point.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 PP_Bool pp_success = | 37 PP_Bool pp_success = |
38 ppapi_proxy::PPBImageDataInterface()->IsImageDataFormatSupported( | 38 ppapi_proxy::PPBImageDataInterface()->IsImageDataFormatSupported( |
39 static_cast<PP_ImageDataFormat>(format)); | 39 static_cast<PP_ImageDataFormat>(format)); |
40 *success = static_cast<int32_t>(pp_success == PP_TRUE); | 40 *success = static_cast<int32_t>(pp_success == PP_TRUE); |
41 rpc->result = NACL_SRPC_RESULT_OK; | 41 rpc->result = NACL_SRPC_RESULT_OK; |
42 } | 42 } |
43 | 43 |
44 void PpbImageDataRpcServer::PPB_ImageData_Create( | 44 void PpbImageDataRpcServer::PPB_ImageData_Create( |
45 NaClSrpcRpc* rpc, | 45 NaClSrpcRpc* rpc, |
46 NaClSrpcClosure* done, | 46 NaClSrpcClosure* done, |
47 int64_t module, | 47 PP_Module module, |
48 int32_t format, | 48 int32_t format, |
49 nacl_abi_size_t size_bytes, int32_t* size, | 49 nacl_abi_size_t size_bytes, int32_t* size, |
50 int32_t init_to_zero, | 50 int32_t init_to_zero, |
51 int64_t* resource) { | 51 PP_Resource* resource) { |
52 NaClSrpcClosureRunner runner(done); | 52 NaClSrpcClosureRunner runner(done); |
53 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 53 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
54 if (size_bytes != sizeof(struct PP_Size)) { | 54 if (size_bytes != sizeof(struct PP_Size)) { |
55 return; | 55 return; |
56 } | 56 } |
57 PP_Resource pp_resource = | 57 *resource = ppapi_proxy::PPBImageDataInterface()->Create( |
58 ppapi_proxy::PPBImageDataInterface()->Create( | 58 module, |
59 static_cast<PP_Module>(module), | 59 static_cast<PP_ImageDataFormat>(format), |
60 static_cast<PP_ImageDataFormat>(format), | 60 static_cast<const struct PP_Size*>( |
61 static_cast<const struct PP_Size*>( | 61 reinterpret_cast<struct PP_Size*>(size)), |
62 reinterpret_cast<struct PP_Size*>(size)), | 62 (init_to_zero ? PP_TRUE : PP_FALSE)); |
63 (init_to_zero ? PP_TRUE : PP_FALSE)); | |
64 *resource = static_cast<int64_t>(pp_resource); | |
65 rpc->result = NACL_SRPC_RESULT_OK; | 63 rpc->result = NACL_SRPC_RESULT_OK; |
66 } | 64 } |
67 | 65 |
68 void PpbImageDataRpcServer::PPB_ImageData_IsImageData( | 66 void PpbImageDataRpcServer::PPB_ImageData_IsImageData( |
69 NaClSrpcRpc* rpc, | 67 NaClSrpcRpc* rpc, |
70 NaClSrpcClosure* done, | 68 NaClSrpcClosure* done, |
71 int64_t resource, | 69 PP_Resource resource, |
72 int32_t* success) { | 70 int32_t* success) { |
73 NaClSrpcClosureRunner runner(done); | 71 NaClSrpcClosureRunner runner(done); |
74 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 72 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
75 PP_Bool pp_success = | 73 PP_Bool pp_success = |
76 ppapi_proxy::PPBImageDataInterface()->IsImageData( | 74 ppapi_proxy::PPBImageDataInterface()->IsImageData(resource); |
77 static_cast<PP_Resource>(resource)); | |
78 *success = (pp_success == PP_TRUE); | 75 *success = (pp_success == PP_TRUE); |
79 rpc->result = NACL_SRPC_RESULT_OK; | 76 rpc->result = NACL_SRPC_RESULT_OK; |
80 } | 77 } |
81 | 78 |
82 void PpbImageDataRpcServer::PPB_ImageData_Describe( | 79 void PpbImageDataRpcServer::PPB_ImageData_Describe( |
83 NaClSrpcRpc* rpc, | 80 NaClSrpcRpc* rpc, |
84 NaClSrpcClosure* done, | 81 NaClSrpcClosure* done, |
85 int64_t resource, | 82 PP_Resource resource, |
86 nacl_abi_size_t* desc_bytes, int32_t* desc, | 83 nacl_abi_size_t* desc_bytes, int32_t* desc, |
87 int32_t* success) { | 84 int32_t* success) { |
88 NaClSrpcClosureRunner runner(done); | 85 NaClSrpcClosureRunner runner(done); |
89 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 86 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
90 if (*desc_bytes != sizeof(struct PP_ImageDataDesc)) { | 87 if (*desc_bytes != sizeof(struct PP_ImageDataDesc)) { |
91 return; | 88 return; |
92 } | 89 } |
93 PP_Bool pp_success = | 90 PP_Bool pp_success = |
94 ppapi_proxy::PPBImageDataInterface()->Describe( | 91 ppapi_proxy::PPBImageDataInterface()->Describe( |
95 static_cast<PP_Resource>(resource), | 92 resource, |
nfullagar
2010/12/23 21:37:00
line above and line below could fit on one line?
noelallen_use_chromium
2010/12/23 22:23:23
Done.
| |
96 reinterpret_cast<struct PP_ImageDataDesc*>(desc)); | 93 reinterpret_cast<struct PP_ImageDataDesc*>(desc)); |
97 *success = (pp_success == PP_TRUE); | 94 *success = (pp_success == PP_TRUE); |
98 rpc->result = NACL_SRPC_RESULT_OK; | 95 rpc->result = NACL_SRPC_RESULT_OK; |
99 } | 96 } |
100 | 97 |
101 // Map and Unmap are purely plugin-side methods, just using mmap/munmap. | 98 // Map and Unmap are purely plugin-side methods, just using mmap/munmap. |
OLD | NEW |