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

Unified Diff: components/nacl/loader/nacl_trusted_listener.cc

Issue 2590853002: Revert of 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/loader/nacl_trusted_listener.h ('k') | components/nacl/loader/nonsfi/nonsfi_listener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nacl_trusted_listener.cc
diff --git a/components/nacl/loader/nacl_trusted_listener.cc b/components/nacl/loader/nacl_trusted_listener.cc
index 89209b2d5845bbafa3e277e1a1d30da6040458dd..df8fc200c14b78b5b5d7ef904414b338d541add3 100644
--- a/components/nacl/loader/nacl_trusted_listener.cc
+++ b/components/nacl/loader/nacl_trusted_listener.cc
@@ -6,45 +6,52 @@
#include "base/single_thread_task_runner.h"
#include "build/build_config.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "ipc/message_filter.h"
#include "native_client/src/public/chrome_main.h"
namespace {
-class NaClExitControlImpl : public nacl::mojom::NaClExitControl {
+// The OnChannelError() event must be processed in a MessageFilter so it can
+// be handled on the IO thread. The main thread used by NaClListener is busy
+// in NaClChromeMainAppStart(), so it can't be used for servicing messages.
+class EOFMessageFilter : public IPC::MessageFilter {
public:
- ~NaClExitControlImpl() override {
- // If the binding disconnects, the renderer process dropped its connection
- // to this process (the NaCl loader process), either because the <embed>
- // element was removed (perhaps implicitly if the tab was closed) or because
- // the renderer crashed. The NaCl loader process should therefore exit.
+ void OnChannelError() override {
+ // The renderer process dropped its connection to this process (the NaCl
+ // loader process), either because the <embed> element was removed
+ // (perhaps implicitly if the tab was closed) or because the renderer
+ // crashed. The NaCl loader process should therefore exit.
//
// For SFI NaCl, trusted code does this exit voluntarily, but untrusted
// code cannot disable it. However, for Non-SFI NaCl, the following exit
// call could be disabled by untrusted code.
NaClExit(0);
}
+ private:
+ ~EOFMessageFilter() override {}
};
-void CreateExitControl(nacl::mojom::NaClExitControlRequest request) {
- mojo::MakeStrongBinding(base::MakeUnique<NaClExitControlImpl>(),
- std::move(request));
}
-} // namespace
-
NaClTrustedListener::NaClTrustedListener(
- nacl::mojom::NaClRendererHostPtr renderer_host,
- base::SingleThreadTaskRunner* io_task_runner)
- : renderer_host_(std::move(renderer_host)) {
- nacl::mojom::NaClExitControlPtr exit_control;
- // The exit control binding must run on the IO thread. The main thread used
- // by NaClListener is busy in NaClChromeMainAppStart(), so it can't be used
- // for servicing messages.
- io_task_runner->PostTask(
- FROM_HERE, base::Bind(&CreateExitControl,
- base::Passed(mojo::GetProxy(&exit_control))));
- renderer_host_->ProvideExitControl(std::move(exit_control));
+ const IPC::ChannelHandle& handle,
+ base::SingleThreadTaskRunner* ipc_task_runner,
+ base::WaitableEvent* shutdown_event)
+ : channel_handle_(handle) {
+ channel_ =
+ IPC::SyncChannel::Create(handle, IPC::Channel::MODE_SERVER, this,
+ ipc_task_runner, true, /* create_channel_now */
+ shutdown_event);
+ channel_->AddFilter(new EOFMessageFilter());
}
-NaClTrustedListener::~NaClTrustedListener() = default;
+NaClTrustedListener::~NaClTrustedListener() {
+}
+
+bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) {
+ return false;
+}
+
+bool NaClTrustedListener::Send(IPC::Message* msg) {
+ return channel_->Send(msg);
+}
« no previous file with comments | « components/nacl/loader/nacl_trusted_listener.h ('k') | components/nacl/loader/nonsfi/nonsfi_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698