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

Unified Diff: ppapi/cpp/module.cc

Issue 6716005: A proposal and implementation for an initial postMessage interface. These in... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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/cpp/module.cc
===================================================================
--- ppapi/cpp/module.cc (revision 78988)
+++ ppapi/cpp/module.cc (working copy)
@@ -25,6 +25,7 @@
#include <string.h>
+#include "ppapi/c/dev/ppp_messaging_dev.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppp_instance.h"
@@ -134,6 +135,20 @@
&Instance_GetInstanceObject
};
+void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) {
+ Module* module_singleton = Module::Get();
+ if (!module_singleton)
+ return;
+ Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
+ if (!instance)
+ return;
+ instance->HandleMessage(Var(Var::PassRef(), var));
+}
+
+static PPP_Messaging_Dev instance_messaging_interface = {
+ &Messaging_HandleMessage
+};
+
// Module ----------------------------------------------------------------------
Module::Module() : pp_module_(0), get_browser_interface_(NULL), core_(NULL) {
@@ -152,6 +167,9 @@
if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0)
return &instance_interface;
+ if (strcmp(interface_name, PPP_MESSAGING_DEV_INTERFACE) == 0)
+ return &instance_messaging_interface;
+
// Now see if anything was dynamically registered.
InterfaceMap::const_iterator found = additional_interfaces_.find(
std::string(interface_name));

Powered by Google App Engine
This is Rietveld 408576698