summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbsy@google.com <bsy@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 01:30:02 +0000
committerbsy@google.com <bsy@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 01:30:02 +0000
commita72d72016bb1fbe64020b52b01ca77658f5a87dd (patch)
tree30a9416fd86f2d8c90d87a3bef0d312ba49a5952 /ppapi
parent63a822490bb1ac98d4fb8a1e76187ecd3ae5c118 (diff)
downloadchromium_src-a72d72016bb1fbe64020b52b01ca77658f5a87dd.zip
chromium_src-a72d72016bb1fbe64020b52b01ca77658f5a87dd.tar.gz
chromium_src-a72d72016bb1fbe64020b52b01ca77658f5a87dd.tar.bz2
Chrome-side change to support stdout/err to postmessage debug hookup.
This CL adds virtual function in reverse interface needed to support Native Client side debuggging only support for sending standard output and standard error output (write syscall buffer contents) through the reverse channel to the renderer to be transformed into PostMessage data. We do not use message channels because PPAPI currently does not support message channels; instead messages are prefixed by a fixed string which a debug-use-only event listener should match (and invoke stopPropagation on). BUG= http://code.google.com/p/nativeclient/issues/detail?id=2474 TEST= nacl-side CL, see http://codereview.chromium.org/8825007 Review URL: http://codereview.chromium.org/8826005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/native_client/src/trusted/plugin/browser_interface.h1
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc32
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.h13
3 files changed, 44 insertions, 2 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/browser_interface.h b/ppapi/native_client/src/trusted/plugin/browser_interface.h
index 40191f4..2a5bf8a3 100644
--- a/ppapi/native_client/src/trusted/plugin/browser_interface.h
+++ b/ppapi/native_client/src/trusted/plugin/browser_interface.h
@@ -16,7 +16,6 @@
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/include/nacl_string.h"
#include "native_client/src/include/portability.h"
-#include "ppapi/cpp/instance.h"
namespace pp {
class InstancePrivate;
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index cf1c29a..ad1fbcf 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) {
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h
index 1d0c3bf..31f28c1 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h
@@ -19,7 +19,6 @@
#include "native_client/src/shared/srpc/nacl_srpc.h"
#include "native_client/src/trusted/reverse_service/reverse_service.h"
#include "native_client/src/trusted/plugin/utility.h"
-#include "native_client/src/trusted/plugin/file_downloader.h"
#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
#include "native_client/src/trusted/weak_ref/weak_ref.h"
@@ -47,6 +46,13 @@ struct LogToJavaScriptConsoleResource {
std::string message;
};
+struct PostMessageResource {
+ public:
+ explicit PostMessageResource(std::string msg)
+ : message(msg) {}
+ std::string message;
+};
+
struct OpenManifestEntryResource {
public:
OpenManifestEntryResource(std::string target_url,
@@ -100,6 +106,8 @@ class PluginReverseInterface: public nacl::ReverseInterface {
virtual void Log(nacl::string message);
+ virtual void DoPostMessage(nacl::string message);
+
virtual void StartupInitializationComplete();
virtual bool EnumerateManifestKeys(std::set<nacl::string>* out_keys);
@@ -116,6 +124,9 @@ class PluginReverseInterface: public nacl::ReverseInterface {
virtual void Log_MainThreadContinuation(LogToJavaScriptConsoleResource* p,
int32_t err);
+ virtual void PostMessage_MainThreadContinuation(PostMessageResource* p,
+ int32_t err);
+
virtual void OpenManifestEntry_MainThreadContinuation(
OpenManifestEntryResource* p,
int32_t err);