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