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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/child/mojo/mojo_application.h ('k') | content/common/mojo/mojo_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/child/mojo/mojo_application.h"
6
7 #include "content/child/child_process.h"
8 #include "content/common/mojo/mojo_messages.h"
9 #include "ipc/ipc_message.h"
10
11 namespace content {
12
13 MojoApplication::MojoApplication(mojo::ShellClient* shell_client)
14 : shell_client_(shell_client) {
15 }
16
17 MojoApplication::~MojoApplication() {
18 }
19
20 bool MojoApplication::OnMessageReceived(const IPC::Message& msg) {
21 bool handled = true;
22 IPC_BEGIN_MESSAGE_MAP(MojoApplication, msg)
23 IPC_MESSAGE_HANDLER(MojoMsg_Activate, OnActivate)
24 IPC_MESSAGE_UNHANDLED(handled = false)
25 IPC_END_MESSAGE_MAP()
26 return handled;
27 }
28
29 void MojoApplication::OnActivate(
30 const IPC::PlatformFileForTransit& file) {
31 #if defined(OS_POSIX)
32 base::PlatformFile handle = file.fd;
33 #elif defined(OS_WIN)
34 base::PlatformFile handle = file;
35 #endif
36 mojo::ScopedMessagePipeHandle message_pipe =
37 channel_init_.Init(handle,
38 ChildProcess::current()->io_message_loop_proxy());
39 DCHECK(message_pipe.is_valid());
40
41 shell_.reset(
42 mojo::ScopedShellHandle::From(message_pipe.Pass()), shell_client_);
43 }
44
45 } // namespace content
OLDNEW
« 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