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

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

Issue 424893003: Pepper: Move NaCl fatal logging to Chrome IPC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for dmichael Created 6 years, 5 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/trusted_plugin_channel.cc
diff --git a/components/nacl/renderer/trusted_plugin_channel.cc b/components/nacl/renderer/trusted_plugin_channel.cc
index 30be80c89b91368db0dc5be8dfe3710c1094d49e..92733fd75846347f3ca69753b616159ca41974d9 100644
--- a/components/nacl/renderer/trusted_plugin_channel.cc
+++ b/components/nacl/renderer/trusted_plugin_channel.cc
@@ -5,14 +5,20 @@
#include "components/nacl/renderer/trusted_plugin_channel.h"
#include "base/callback_helpers.h"
+#include "base/strings/string_tokenizer.h"
+#include "components/nacl/common/nacl_messages.h"
#include "content/public/renderer/render_thread.h"
#include "ipc/ipc_channel_proxy.h"
+#include "ipc/ipc_message_macros.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
namespace nacl {
TrustedPluginChannel::TrustedPluginChannel(
- const IPC::ChannelHandle& handle) {
+ PP_Instance instance,
+ const IPC::ChannelHandle& handle)
+ : instance_(instance) {
channel_proxy_ = IPC::ChannelProxy::Create(
handle,
IPC::Channel::MODE_CLIENT,
@@ -28,7 +34,24 @@ bool TrustedPluginChannel::Send(IPC::Message* message) {
}
bool TrustedPluginChannel::OnMessageReceived(const IPC::Message& message) {
- return false;
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(TrustedPluginChannel, message)
+ IPC_MESSAGE_HANDLER(NaClProcessHostMsg_FatalLogReceived,
+ OnFatalLogReceived)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void TrustedPluginChannel::OnFatalLogReceived(const std::string& fatal_log) {
+ CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->
+ BelongsToCurrentThread());
+
+ base::StringTokenizer t(fatal_log, "\n");
+ while (t.GetNext()) {
+ ppapi::PpapiGlobals::Get()->LogWithSource(
+ instance_, PP_LOGLEVEL_LOG, std::string("NativeClient"), t.token());
+ }
}
} // namespace nacl

Powered by Google App Engine
This is Rietveld 408576698