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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.cc (revision 0)
+++ ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.cc (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 The Native Client Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h"
+
+#include "native_client/src/include/nacl_scoped_ptr.h"
+#include "native_client/src/include/portability.h"
+#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
+#include "native_client/src/shared/ppapi_proxy/utility.h"
+#include "native_client/src/shared/srpc/nacl_srpc.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "srpcgen/ppb_rpc.h"
+
+namespace ppapi_proxy {
+
+namespace {
+
+void PostMessage(PP_Instance instance, struct PP_Var message) {
+ DebugPrintf("PPB_Messaging::PostMessage: instance=%"NACL_PRIu32"\n",
+ instance);
+ if (!ppapi_proxy::PPBCoreInterface()->IsMainThread())
+ return; // Only supported on main thread.
+
+ uint32_t message_length = kMaxVarSize;
+ nacl::scoped_array<char> message_bytes(Serialize(&message, 1,
+ &message_length));
+ NaClSrpcError srpc_result =
+ PpbMessagingRpcClient::PPB_Messaging_PostMessage(
+ GetMainSrpcChannel(),
+ instance,
+ message_length,
+ message_bytes.get());
+ DebugPrintf("PPB_Messaging::PostMessage: %s\n",
+ NaClSrpcErrorString(srpc_result));
+}
+
+} // namespace
+
+const PPB_Messaging* PluginMessaging::GetInterface() {
+ static const PPB_Messaging messaging_interface = {
+ PostMessage
+ };
+ return &messaging_interface;
+}
+
+} // namespace ppapi_proxy

Powered by Google App Engine
This is Rietveld 408576698