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

Side by Side Diff: content/child/mojo/mojo_application.cc

Issue 954643002: Update mojo sdk to rev 3d23dae011859a2aae49f1d1adde705c8e85d819 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use run_renderer_in_process() Created 5 years, 9 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
« no previous file with comments | « content/child/mojo/mojo_application.h ('k') | content/common/mojo/channel_init.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/mojo/mojo_application.h" 5 #include "content/child/mojo/mojo_application.h"
6 6
7 #include "content/child/child_process.h" 7 #include "content/child/child_process.h"
8 #include "content/common/application_setup.mojom.h" 8 #include "content/common/application_setup.mojom.h"
9 #include "content/common/mojo/channel_init.h"
9 #include "content/common/mojo/mojo_messages.h" 10 #include "content/common/mojo/mojo_messages.h"
10 #include "ipc/ipc_message.h" 11 #include "ipc/ipc_message.h"
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h" 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 MojoApplication::MojoApplication() { 16 MojoApplication::MojoApplication() {
16 } 17 }
17 18
18 MojoApplication::~MojoApplication() { 19 MojoApplication::~MojoApplication() {
19 } 20 }
20 21
21 bool MojoApplication::OnMessageReceived(const IPC::Message& msg) { 22 bool MojoApplication::OnMessageReceived(const IPC::Message& msg) {
22 bool handled = true; 23 bool handled = true;
23 IPC_BEGIN_MESSAGE_MAP(MojoApplication, msg) 24 IPC_BEGIN_MESSAGE_MAP(MojoApplication, msg)
24 IPC_MESSAGE_HANDLER(MojoMsg_Activate, OnActivate) 25 IPC_MESSAGE_HANDLER(MojoMsg_Activate, OnActivate)
25 IPC_MESSAGE_UNHANDLED(handled = false) 26 IPC_MESSAGE_UNHANDLED(handled = false)
26 IPC_END_MESSAGE_MAP() 27 IPC_END_MESSAGE_MAP()
27 return handled; 28 return handled;
28 } 29 }
29 30
30 void MojoApplication::OnActivate( 31 void MojoApplication::OnActivate(
31 const IPC::PlatformFileForTransit& file) { 32 const IPC::PlatformFileForTransit& file) {
32 #if defined(OS_POSIX) 33 #if defined(OS_POSIX)
33 base::PlatformFile handle = file.fd; 34 base::PlatformFile handle = file.fd;
34 #elif defined(OS_WIN) 35 #elif defined(OS_WIN)
35 base::PlatformFile handle = file; 36 base::PlatformFile handle = file;
36 #endif 37 #endif
38 scoped_refptr<base::TaskRunner> io_task_runner =
39 ChannelInit::GetSingleProcessIOTaskRunner();
40 if (!io_task_runner) {
41 io_task_runner = ChildProcess::current()->io_message_loop_proxy();
42 }
43 DCHECK(io_task_runner);
44
37 mojo::ScopedMessagePipeHandle message_pipe = 45 mojo::ScopedMessagePipeHandle message_pipe =
38 channel_init_.Init(handle, 46 channel_init_.Init(handle, io_task_runner);
39 ChildProcess::current()->io_message_loop_proxy());
40 DCHECK(message_pipe.is_valid()); 47 DCHECK(message_pipe.is_valid());
41 48
42 ApplicationSetupPtr application_setup; 49 ApplicationSetupPtr application_setup;
43 application_setup.Bind(message_pipe.Pass()); 50 application_setup.Bind(message_pipe.Pass());
44 51
45 mojo::ServiceProviderPtr services; 52 mojo::ServiceProviderPtr services;
46 mojo::ServiceProviderPtr exposed_services; 53 mojo::ServiceProviderPtr exposed_services;
47 service_registry_.Bind(GetProxy(&exposed_services)); 54 service_registry_.Bind(GetProxy(&exposed_services));
48 application_setup->ExchangeServiceProviders(GetProxy(&services), 55 application_setup->ExchangeServiceProviders(GetProxy(&services),
49 exposed_services.Pass()); 56 exposed_services.Pass());
50 service_registry_.BindRemoteServiceProvider(services.Pass()); 57 service_registry_.BindRemoteServiceProvider(services.Pass());
51 } 58 }
52 59
53 } // namespace content 60 } // namespace content
OLDNEW
« no previous file with comments | « content/child/mojo/mojo_application.h ('k') | content/common/mojo/channel_init.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698