| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/shared/ppapi_proxy/plugin_image_data.h" | 7 #include "native_client/src/shared/ppapi_proxy/plugin_image_data.h" |
| 8 | 8 |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 (init_to_zero == PP_TRUE), | 64 (init_to_zero == PP_TRUE), |
| 65 &resource); | 65 &resource); |
| 66 if (retval == NACL_SRPC_RESULT_OK) { | 66 if (retval == NACL_SRPC_RESULT_OK) { |
| 67 return static_cast<PP_Resource>(resource); | 67 return static_cast<PP_Resource>(resource); |
| 68 } else { | 68 } else { |
| 69 return kInvalidResourceId; | 69 return kInvalidResourceId; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 PP_Bool IsImageData(PP_Resource resource) { | 73 PP_Bool IsImageData(PP_Resource resource) { |
| 74 int32_t result; | 74 return PluginResource::GetAs<PluginImageData>(resource).get() |
| 75 NaClSrpcError retval = | 75 ? PP_TRUE : PP_FALSE; |
| 76 PpbImageDataRpcClient::PPB_ImageData_IsImageData( | |
| 77 GetMainSrpcChannel(), | |
| 78 static_cast<int64_t>(resource), | |
| 79 &result); | |
| 80 if (retval == NACL_SRPC_RESULT_OK) { | |
| 81 return (result ? PP_TRUE : PP_FALSE); | |
| 82 } else { | |
| 83 return PP_FALSE; | |
| 84 } | |
| 85 } | 76 } |
| 86 | 77 |
| 87 PP_Bool Describe(PP_Resource resource, | 78 PP_Bool Describe(PP_Resource resource, |
| 88 struct PP_ImageDataDesc* desc) { | 79 struct PP_ImageDataDesc* desc) { |
| 89 int32_t result; | 80 int32_t result; |
| 90 nacl_abi_size_t desc_size = kPpImageDataDescBytes; | 81 nacl_abi_size_t desc_size = kPpImageDataDescBytes; |
| 91 NaClSrpcError retval = | 82 NaClSrpcError retval = |
| 92 PpbImageDataRpcClient::PPB_ImageData_Describe( | 83 PpbImageDataRpcClient::PPB_ImageData_Describe( |
| 93 GetMainSrpcChannel(), | 84 GetMainSrpcChannel(), |
| 94 static_cast<int64_t>(resource), | 85 static_cast<int64_t>(resource), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 Create, | 117 Create, |
| 127 IsImageData, | 118 IsImageData, |
| 128 Describe, | 119 Describe, |
| 129 Map, | 120 Map, |
| 130 Unmap, | 121 Unmap, |
| 131 }; | 122 }; |
| 132 return &intf; | 123 return &intf; |
| 133 } | 124 } |
| 134 | 125 |
| 135 } // namespace ppapi_proxy | 126 } // namespace ppapi_proxy |
| OLD | NEW |