Index: components/nacl/renderer/ppb_nacl_private_impl.cc |
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc |
index e5249445644f858a2a204c6dc572e5d3924050de..cf42d203dabba855bc804581d0cb592ee2ac6272 100644 |
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc |
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc |
@@ -40,6 +40,7 @@ |
#include "ppapi/shared_impl/ppapi_permissions.h" |
#include "ppapi/shared_impl/ppapi_preferences.h" |
#include "ppapi/shared_impl/var.h" |
+#include "ppapi/shared_impl/var_tracker.h" |
#include "ppapi/thunk/enter.h" |
#include "third_party/WebKit/public/platform/WebURLLoader.h" |
#include "third_party/WebKit/public/web/WebDocument.h" |
@@ -1177,6 +1178,23 @@ PP_Bool GetPNaClResourceInfo(PP_Instance instance, |
return PP_TRUE; |
} |
+void PostMessageToJavaScriptMainThread(PP_Instance instance, |
+ const std::string& message) { |
+ content::PepperPluginInstance* plugin_instance = |
+ content::PepperPluginInstance::Get(instance); |
+ if (plugin_instance) { |
+ PP_Var message_var = ppapi::StringVar::StringToPPVar(message); |
+ plugin_instance->PostMessageToJavaScript(message_var); |
+ ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(message_var); |
+ } |
+} |
+ |
+void PostMessageToJavaScript(PP_Instance instance, const char* message) { |
+ ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&PostMessageToJavaScriptMainThread, instance, message)); |
+} |
+ |
const PPB_NaCl_Private nacl_interface = { |
&LaunchSelLdr, |
&StartPpapiProxy, |