OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_CALLBACK_H_ |
| 6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_CALLBACK_H_ |
| 7 |
| 8 #include "native_client/src/include/portability.h" |
| 9 #include "native_client/src/trusted/service_runtime/include/machine/_types.h" |
| 10 |
| 11 struct NaClSrpcChannel; |
| 12 struct PP_CompletionCallback; |
| 13 |
| 14 namespace ppapi_proxy { |
| 15 |
| 16 // Pointer to function to evaluate the result of a read operation. |
| 17 typedef bool (*CheckResultFunc)(int32_t result); |
| 18 // Pointer to function to retrieve/calculate the size read. |
| 19 typedef nacl_abi_size_t (*GetReadSizeFunc)(int32_t result); |
| 20 |
| 21 // Returns a PP_CompletionCallback that will call the remote implementation of |
| 22 // a callback by |callback_id| on the plugin side on |srpc_channel|. |
| 23 // This callback allows for optimized synchronous completion. |
| 24 // Allocates data that will be deleted by the underlying callback function. |
| 25 // Returns NULL callback on failure. |
| 26 struct PP_CompletionCallback MakeRemoteCompletionCallback( |
| 27 NaClSrpcChannel* srpc_channel, |
| 28 int32_t callback_id); |
| 29 struct PP_CompletionCallback MakeRemoteCompletionCallback( |
| 30 NaClSrpcChannel* srpc_channel, |
| 31 int32_t callback_id, |
| 32 // For callbacks invoked on a byte read. |
| 33 int32_t bytes_to_read, |
| 34 char** buffer); |
| 35 struct PP_CompletionCallback MakeRemoteCompletionCallback( |
| 36 NaClSrpcChannel* srpc_channel, |
| 37 int32_t callback_id, |
| 38 // For callbacks invoked on a byte read. |
| 39 int32_t bytes_to_read, |
| 40 char** buffer, |
| 41 CheckResultFunc check_result, |
| 42 GetReadSizeFunc get_size_read_func); |
| 43 |
| 44 // If the callback won't be called, use this to clean up the data from |
| 45 // the function above. |
| 46 void DeleteRemoteCallbackInfo(struct PP_CompletionCallback callback); |
| 47 |
| 48 } // namespace ppapi_proxy |
| 49 |
| 50 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_CALLBACK_H_ |
OLD | NEW |