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

Unified Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 268793002: Pepper: Move DoPostMessage out of trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 7 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: 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,
« no previous file with comments | « no previous file | content/public/renderer/pepper_plugin_instance.h » ('j') | ppapi/api/private/ppb_nacl_private.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698