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

Side by Side Diff: mojo/shell/app_child_process_host.cc

Issue 265793015: Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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
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 "mojo/shell/app_child_process_host.h" 5 #include "mojo/shell/app_child_process_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/embedder/embedder.h" 9 #include "mojo/embedder/embedder.h"
10 #include "mojo/public/cpp/system/core.h" 10 #include "mojo/public/cpp/system/core.h"
11 #include "mojo/shell/context.h" 11 #include "mojo/shell/context.h"
12 #include "mojo/shell/task_runners.h" 12 #include "mojo/shell/task_runners.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace shell { 15 namespace shell {
16 16
17 AppChildProcessHost::AppChildProcessHost( 17 AppChildProcessHost::AppChildProcessHost(
18 Context* context, 18 Context* context,
19 mojo_shell::AppChildControllerClient* controller_client) 19 AppChildControllerClient* controller_client)
20 : ChildProcessHost(context, this, ChildProcess::TYPE_APP), 20 : ChildProcessHost(context, this, ChildProcess::TYPE_APP),
21 controller_client_(controller_client), 21 controller_client_(controller_client),
22 channel_info_(NULL) { 22 channel_info_(NULL) {
23 } 23 }
24 24
25 AppChildProcessHost::~AppChildProcessHost() { 25 AppChildProcessHost::~AppChildProcessHost() {
26 } 26 }
27 27
28 void AppChildProcessHost::WillStart() { 28 void AppChildProcessHost::WillStart() {
29 DCHECK(platform_channel()->is_valid()); 29 DCHECK(platform_channel()->is_valid());
30 30
31 mojo::ScopedMessagePipeHandle child_message_pipe(embedder::CreateChannel( 31 mojo::ScopedMessagePipeHandle handle(embedder::CreateChannel(
32 platform_channel()->Pass(), 32 platform_channel()->Pass(),
33 context()->task_runners()->io_runner(), 33 context()->task_runners()->io_runner(),
34 base::Bind(&AppChildProcessHost::DidCreateChannel, 34 base::Bind(&AppChildProcessHost::DidCreateChannel,
35 base::Unretained(this)), 35 base::Unretained(this)),
36 base::MessageLoop::current()->message_loop_proxy())); 36 base::MessageLoop::current()->message_loop_proxy()));
37 controller_.reset( 37
38 mojo_shell::ScopedAppChildControllerHandle( 38 controller_.Bind(handle.Pass());
39 mojo_shell::AppChildControllerHandle( 39 controller_->SetClient(controller_client_);
40 child_message_pipe.release().value())), controller_client_);
41 } 40 }
42 41
43 void AppChildProcessHost::DidStart(bool success) { 42 void AppChildProcessHost::DidStart(bool success) {
44 DVLOG(2) << "AppChildProcessHost::DidStart()"; 43 DVLOG(2) << "AppChildProcessHost::DidStart()";
45 44
46 if (!success) { 45 if (!success) {
47 LOG(ERROR) << "Failed to start app child process"; 46 LOG(ERROR) << "Failed to start app child process";
48 controller_client_->AppCompleted(MOJO_RESULT_UNKNOWN); 47 controller_client_->AppCompleted(MOJO_RESULT_UNKNOWN);
49 return; 48 return;
50 } 49 }
51 } 50 }
52 51
53 // Callback for |embedder::CreateChannel()|. 52 // Callback for |embedder::CreateChannel()|.
54 void AppChildProcessHost::DidCreateChannel( 53 void AppChildProcessHost::DidCreateChannel(
55 embedder::ChannelInfo* channel_info) { 54 embedder::ChannelInfo* channel_info) {
56 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; 55 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()";
57 56
58 CHECK(channel_info); 57 CHECK(channel_info);
59 channel_info_ = channel_info; 58 channel_info_ = channel_info;
60 } 59 }
61 60
62 } // namespace shell 61 } // namespace shell
63 } // namespace mojo 62 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698