| OLD | NEW |
| 1 // Copyright (c) 2012 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/browser_ppp_messaging.h" | 5 #include "native_client/src/shared/ppapi_proxy/browser_ppp_messaging.h" |
| 6 | 6 |
| 7 #include "native_client/src/include/nacl_scoped_ptr.h" | 7 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 8 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" | 8 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
| 9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" | 9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
| 10 #include "native_client/src/shared/ppapi_proxy/utility.h" | 10 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 11 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
| 12 #include "ppapi/c/pp_var.h" | 12 #include "ppapi/c/pp_var.h" |
| 13 #include "srpcgen/ppp_rpc.h" | 13 #include "srpcgen/ppp_rpc.h" |
| 14 | 14 |
| 15 namespace ppapi_proxy { | 15 namespace ppapi_proxy { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 void HandleMessage(PP_Instance instance, struct PP_Var message) { | 19 void HandleMessage(PP_Instance instance, struct PP_Var message) { |
| 20 DebugPrintf("PPP_Messaging::HandleMessage: instance=%"NACL_PRIu32"\n", | 20 DebugPrintf("PPP_Messaging::HandleMessage: instance=%"NACL_PRId32"\n", |
| 21 instance); | 21 instance); |
| 22 uint32_t message_length = 0; | 22 uint32_t message_length = 0; |
| 23 nacl::scoped_array<char> message_bytes(Serialize(&message, 1, | 23 nacl::scoped_array<char> message_bytes(Serialize(&message, 1, |
| 24 &message_length)); | 24 &message_length)); |
| 25 NaClSrpcError srpc_result = | 25 NaClSrpcError srpc_result = |
| 26 PppMessagingRpcClient::PPP_Messaging_HandleMessage( | 26 PppMessagingRpcClient::PPP_Messaging_HandleMessage( |
| 27 GetMainSrpcChannel(instance), | 27 GetMainSrpcChannel(instance), |
| 28 instance, | 28 instance, |
| 29 message_length, | 29 message_length, |
| 30 message_bytes.get()); | 30 message_bytes.get()); |
| 31 | 31 |
| 32 DebugPrintf("PPP_Messaging::HandleMessage: %s\n", | 32 DebugPrintf("PPP_Messaging::HandleMessage: %s\n", |
| 33 NaClSrpcErrorString(srpc_result)); | 33 NaClSrpcErrorString(srpc_result)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 const PPP_Messaging* BrowserMessaging::GetInterface() { | 38 const PPP_Messaging* BrowserMessaging::GetInterface() { |
| 39 static const PPP_Messaging messaging_interface = { | 39 static const PPP_Messaging messaging_interface = { |
| 40 HandleMessage | 40 HandleMessage |
| 41 }; | 41 }; |
| 42 return &messaging_interface; | 42 return &messaging_interface; |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace ppapi_proxy | 45 } // namespace ppapi_proxy |
| OLD | NEW |