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

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

Issue 2525483002: Convert NaCl renderer-loader messages to mojo. (Closed)
Patch Set: Created 4 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 | « components/nacl/renderer/trusted_plugin_channel.h ('k') | components/typemaps.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1cfef1777cdc5c3666a6bd60bbbb6aaa0c78e22c..bf47f0e940cd5aadf5fc6eb5d6556058a8bb1d96 100644
--- a/components/nacl/renderer/trusted_plugin_channel.cc
+++ b/components/nacl/renderer/trusted_plugin_channel.cc
@@ -5,56 +5,43 @@
#include "components/nacl/renderer/trusted_plugin_channel.h"
#include "base/callback_helpers.h"
-#include "components/nacl/common/nacl_renderer_messages.h"
#include "components/nacl/renderer/histogram.h"
#include "components/nacl/renderer/nexe_load_manager.h"
-#include "content/public/renderer/render_thread.h"
-#include "ipc/ipc_sync_channel.h"
-#include "ipc/ipc_message_macros.h"
#include "ppapi/c/pp_errors.h"
namespace nacl {
TrustedPluginChannel::TrustedPluginChannel(
NexeLoadManager* nexe_load_manager,
- const IPC::ChannelHandle& handle,
- base::WaitableEvent* shutdown_event,
+ mojom::NaClRendererHostRequest request,
bool is_helper_nexe)
: nexe_load_manager_(nexe_load_manager),
+ binding_(this, std::move(request)),
is_helper_nexe_(is_helper_nexe) {
- channel_ = IPC::SyncChannel::Create(
- handle, IPC::Channel::MODE_CLIENT, this,
- content::RenderThread::Get()->GetIOTaskRunner(), true, shutdown_event);
+ binding_.set_connection_error_handler(base::Bind(
+ &TrustedPluginChannel::OnChannelError, base::Unretained(this)));
}
TrustedPluginChannel::~TrustedPluginChannel() {
}
-bool TrustedPluginChannel::Send(IPC::Message* message) {
- return channel_->Send(message);
-}
-
-bool TrustedPluginChannel::OnMessageReceived(const IPC::Message& msg) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(TrustedPluginChannel, msg)
- IPC_MESSAGE_HANDLER(NaClRendererMsg_ReportExitStatus, OnReportExitStatus);
- IPC_MESSAGE_HANDLER(NaClRendererMsg_ReportLoadStatus, OnReportLoadStatus);
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
void TrustedPluginChannel::OnChannelError() {
if (!is_helper_nexe_)
nexe_load_manager_->NexeDidCrash();
}
-void TrustedPluginChannel::OnReportExitStatus(int exit_status) {
+void TrustedPluginChannel::ReportExitStatus(
+ int exit_status,
+ const ReportExitStatusCallback& callback) {
+ callback.Run();
if (!is_helper_nexe_)
nexe_load_manager_->set_exit_status(exit_status);
}
-void TrustedPluginChannel::OnReportLoadStatus(NaClErrorCode load_status) {
+void TrustedPluginChannel::ReportLoadStatus(
+ NaClErrorCode load_status,
+ const ReportLoadStatusCallback& callback) {
+ callback.Run();
if (load_status < 0 || load_status > NACL_ERROR_CODE_MAX) {
load_status = LOAD_STATUS_UNKNOWN;
}
@@ -75,4 +62,9 @@ void TrustedPluginChannel::OnReportLoadStatus(NaClErrorCode load_status) {
}
}
+void TrustedPluginChannel::ProvideExitControl(
+ mojom::NaClExitControlPtr exit_control) {
+ exit_control_ = std::move(exit_control);
+}
+
} // namespace nacl
« no previous file with comments | « components/nacl/renderer/trusted_plugin_channel.h ('k') | components/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698