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

Unified Diff: content/child/mojo/mojo_application.cc

Issue 236813002: Move Mojo channel initialization closer to IPC::Channel setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more missing deps Created 6 years, 8 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
« no previous file with comments | « content/child/mojo/mojo_application.h ('k') | content/common/mojo/mojo_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/mojo/mojo_application.cc
diff --git a/content/child/mojo/mojo_application.cc b/content/child/mojo/mojo_application.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1d61c0b15b2faa6605eabaf8ef5ff2af4cf85e91
--- /dev/null
+++ b/content/child/mojo/mojo_application.cc
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/mojo/mojo_application.h"
+
+#include "content/child/child_process.h"
+#include "content/common/mojo/mojo_messages.h"
+#include "ipc/ipc_message.h"
+
+namespace content {
+
+MojoApplication::MojoApplication(mojo::ShellClient* shell_client)
+ : shell_client_(shell_client) {
+}
+
+MojoApplication::~MojoApplication() {
+}
+
+bool MojoApplication::OnMessageReceived(const IPC::Message& msg) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(MojoApplication, msg)
+ IPC_MESSAGE_HANDLER(MojoMsg_Activate, OnActivate)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void MojoApplication::OnActivate(
+ const IPC::PlatformFileForTransit& file) {
+#if defined(OS_POSIX)
+ base::PlatformFile handle = file.fd;
+#elif defined(OS_WIN)
+ base::PlatformFile handle = file;
+#endif
+ mojo::ScopedMessagePipeHandle message_pipe =
+ channel_init_.Init(handle,
+ ChildProcess::current()->io_message_loop_proxy());
+ DCHECK(message_pipe.is_valid());
+
+ shell_.reset(
+ mojo::ScopedShellHandle::From(message_pipe.Pass()), shell_client_);
+}
+
+} // namespace content
« no previous file with comments | « content/child/mojo/mojo_application.h ('k') | content/common/mojo/mojo_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698