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

Unified Diff: ppapi/cpp/instance.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/instance.cc
===================================================================
--- ppapi/cpp/instance.cc (revision 78988)
+++ ppapi/cpp/instance.cc (working copy)
@@ -4,6 +4,7 @@
#include "ppapi/cpp/instance.h"
+#include "ppapi/c/dev/ppb_messaging_dev.h"
#include "ppapi/c/dev/ppp_printing_dev.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/cpp/common.h"
@@ -25,6 +26,10 @@
return PPB_INSTANCE_INTERFACE;
}
+template <> const char* interface_name<PPB_Messaging_Dev>() {
+ return PPB_MESSAGING_DEV_INTERFACE;
+}
+
} // namespace
Instance::Instance(PP_Instance instance) : pp_instance_(instance) {
@@ -61,6 +66,10 @@
return false;
}
+void Instance::HandleMessage(const Var& /*message_data*/) {
+ return;
+}
+
Var Instance::GetInstanceObject() {
return Var();
}
@@ -115,6 +124,13 @@
Var::OutException(exception).get()));
}
+void Instance::PostMessage(const Var& message) {
+ if (!has_interface<PPB_Messaging_Dev>())
+ return;
+ get_interface<PPB_Messaging_Dev>()->PostMessage(pp_instance(),
+ message.pp_var());
+}
+
void Instance::AddPerInstanceObject(const std::string& interface_name,
void* object) {
// Ensure we're not trying to register more than one object per interface

Powered by Google App Engine
This is Rietveld 408576698