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