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 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" |
| 6 |
| 7 #include <stdio.h> |
| 8 #include "native_client/src/include/nacl_macros.h" |
| 9 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 10 #include "native_client/src/include/portability.h" |
| 11 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
| 12 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" |
| 13 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 14 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 15 #include "ppapi/c/ppb_instance.h" |
| 16 #include "srpcgen/ppb_rpc.h" |
| 17 |
| 18 namespace ppapi_proxy { |
| 19 |
| 20 namespace { |
| 21 |
| 22 PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) { |
| 23 DebugPrintf("PPB_Instance::BindGraphics: instance=%"NACL_PRIu32 |
| 24 " device=%"NACL_PRIu32"\n", instance, device); |
| 25 int32_t success = 0; |
| 26 |
| 27 NaClSrpcError srpc_result = |
| 28 PpbInstanceRpcClient::PPB_Instance_BindGraphics( |
| 29 GetMainSrpcChannel(), |
| 30 instance, |
| 31 device, |
| 32 &success); |
| 33 DebugPrintf("PPB_Instance::BindGraphics: %s\n", |
| 34 NaClSrpcErrorString(srpc_result)); |
| 35 if (srpc_result == NACL_SRPC_RESULT_OK && success) |
| 36 return PP_TRUE; |
| 37 else |
| 38 return PP_FALSE; |
| 39 } |
| 40 |
| 41 PP_Bool IsFullFrame(PP_Instance instance) { |
| 42 DebugPrintf("PPB_Instance::IsFullFrame: instance=%"NACL_PRIu32"\n", |
| 43 instance); |
| 44 int32_t is_full_frame = 0; |
| 45 |
| 46 NaClSrpcError srpc_result = |
| 47 PpbInstanceRpcClient::PPB_Instance_IsFullFrame( |
| 48 GetMainSrpcChannel(), |
| 49 instance, |
| 50 &is_full_frame); |
| 51 DebugPrintf("PPB_Instance::IsFullFrame: %s\n", |
| 52 NaClSrpcErrorString(srpc_result)); |
| 53 if (srpc_result == NACL_SRPC_RESULT_OK && is_full_frame) |
| 54 return PP_TRUE; |
| 55 else |
| 56 return PP_FALSE; |
| 57 } |
| 58 |
| 59 } // namespace |
| 60 |
| 61 const PPB_Instance* PluginInstance::GetInterface() { |
| 62 static const PPB_Instance instance_interface = { |
| 63 BindGraphics, |
| 64 IsFullFrame |
| 65 }; |
| 66 return &instance_interface; |
| 67 } |
| 68 |
| 69 } // namespace ppapi_proxy |
OLD | NEW |