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

Unified Diff: ppapi/native_client/src/trusted/plugin/service_runtime.cc

Issue 8826005: Chrome-side change to support stdout/err to postmessage debug hookup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved undef of PostMessage out of instance.h Created 9 years 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
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/trusted/plugin/service_runtime.cc
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index cf1c29af4e1c445962ffa119efaa3513c2735526..ad1fbcf1d34419100bf02a435270f632298de0c1 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -34,8 +34,19 @@
#include "native_client/src/trusted/handle_pass/browser_handle.h"
#include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
+// browser_interface includes portability.h for uintptr_t etc, but it
+// also transitively includes windows.h, where PostMessage gets
+// defined as a preprocessor symbol
#include "native_client/src/trusted/plugin/browser_interface.h"
+
#include "native_client/src/trusted/plugin/manifest.h"
+
+// This is here due to a Windows API collision; plugin.h through
+// file_downloader.h transitively includes Instance.h which defines a
+// PostMessage method, so this undef must appear before any of those.
+#ifdef PostMessage
+#undef PostMessage
+#endif
#include "native_client/src/trusted/plugin/plugin.h"
#include "native_client/src/trusted/plugin/plugin_error.h"
#include "native_client/src/trusted/plugin/scriptable_handle.h"
@@ -97,6 +108,18 @@ void PluginReverseInterface::Log(nacl::string message) {
continuation);
}
+void PluginReverseInterface::DoPostMessage(nacl::string message) {
+ PostMessageResource* continuation = new PostMessageResource(message);
+ CHECK(continuation != NULL);
+ NaClLog(4, "PluginReverseInterface::DoPostMessage(%s)\n", message.c_str());
+ plugin::WeakRefCallOnMainThread(
+ anchor_,
+ 0, /* delay in ms */
+ ALLOW_THIS_IN_INITIALIZER_LIST(this),
+ &plugin::PluginReverseInterface::PostMessage_MainThreadContinuation,
+ continuation);
+}
+
void PluginReverseInterface::StartupInitializationComplete() {
NaClLog(0, "PluginReverseInterface::StartupInitializationComplete\n");
if (init_done_cb_.pp_completion_callback().func != NULL) {
@@ -121,6 +144,15 @@ void PluginReverseInterface::Log_MainThreadContinuation(
plugin_->browser_interface()->AddToConsole(static_cast<Plugin*>(plugin_),
p->message);
}
+void PluginReverseInterface::PostMessage_MainThreadContinuation(
+ PostMessageResource* p,
+ int32_t err) {
+ UNREFERENCED_PARAMETER(err);
+ NaClLog(4,
+ "PluginReverseInterface::PostMessage_MainThreadContinuation(%s)\n",
+ p->message.c_str());
+ plugin_->PostMessage(std::string("DEBUG_POSTMESSAGE:") + p->message);
+}
bool PluginReverseInterface::EnumerateManifestKeys(
std::set<nacl::string>* out_keys) {
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698