Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.cc

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_messaging.h"
6
7 #include "native_client/src/include/nacl_scoped_ptr.h"
8 #include "native_client/src/include/portability.h"
9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h"
10 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
11 #include "native_client/src/shared/ppapi_proxy/utility.h"
12 #include "native_client/src/shared/srpc/nacl_srpc.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_var.h"
15 #include "srpcgen/ppb_rpc.h"
16
17 namespace ppapi_proxy {
18
19 namespace {
20
21 void PostMessage(PP_Instance instance, struct PP_Var message) {
22 DebugPrintf("PPB_Messaging::PostMessage: instance=%"NACL_PRIu32"\n",
23 instance);
24 if (!ppapi_proxy::PPBCoreInterface()->IsMainThread())
25 return; // Only supported on main thread.
26
27 uint32_t message_length = kMaxVarSize;
28 nacl::scoped_array<char> message_bytes(Serialize(&message, 1,
29 &message_length));
30 NaClSrpcError srpc_result =
31 PpbMessagingRpcClient::PPB_Messaging_PostMessage(
32 GetMainSrpcChannel(),
33 instance,
34 message_length,
35 message_bytes.get());
36 DebugPrintf("PPB_Messaging::PostMessage: %s\n",
37 NaClSrpcErrorString(srpc_result));
38 }
39
40 } // namespace
41
42 const PPB_Messaging* PluginMessaging::GetInterface() {
43 static const PPB_Messaging messaging_interface = {
44 PostMessage
45 };
46 return &messaging_interface;
47 }
48
49 } // namespace ppapi_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698