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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_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/browser_ppp_messaging.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.cc (revision 0)
+++ ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.cc (revision 0)
@@ -0,0 +1,46 @@
+// 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/browser_ppp_messaging.h"
+
+#include "native_client/src/include/nacl_scoped_ptr.h"
+#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
+#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
+#include "native_client/src/shared/ppapi_proxy/utility.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "srpcgen/ppp_rpc.h"
+
+namespace ppapi_proxy {
+
+namespace {
+
+void HandleMessage(PP_Instance instance, struct PP_Var message) {
+ DebugPrintf("PPP_Messaging::HandleMessage: instance=%"NACL_PRIu32"\n",
+ instance);
+ uint32_t message_length = kMaxVarSize;
+ nacl::scoped_array<char> message_bytes(Serialize(&message, 1,
+ &message_length));
+ NaClSrpcError srpc_result =
+ PppMessagingRpcClient::PPP_Messaging_HandleMessage(
+ GetMainSrpcChannel(instance),
+ instance,
+ message_length,
+ message_bytes.get());
+
+ DebugPrintf("PPP_Messaging::HandleMessage: %s\n",
+ NaClSrpcErrorString(srpc_result));
+}
+
+} // namespace
+
+const PPP_Messaging* BrowserMessaging::GetInterface() {
+ static const PPP_Messaging messaging_interface = {
+ HandleMessage
+ };
+ return &messaging_interface;
+}
+
+} // namespace ppapi_proxy
+

Powered by Google App Engine
This is Rietveld 408576698