[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / mojo / shell / app_child_process_host.cc
blob0740608789aade2d0877115b220efbccb9e118c9
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.
5 #include "mojo/shell/app_child_process_host.h"
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h"
10 #include "mojo/embedder/embedder.h"
11 #include "mojo/public/cpp/system/core.h"
12 #include "mojo/shell/context.h"
13 #include "mojo/shell/task_runners.h"
15 namespace mojo {
16 namespace shell {
18 AppChildProcessHost::AppChildProcessHost(
19 Context* context,
20 AppChildControllerClient* controller_client)
21 : ChildProcessHost(context, this, ChildProcess::TYPE_APP),
22 controller_client_(controller_client),
23 channel_info_(NULL) {
26 AppChildProcessHost::~AppChildProcessHost() {
29 void AppChildProcessHost::WillStart() {
30 DCHECK(platform_channel()->is_valid());
32 mojo::ScopedMessagePipeHandle handle(embedder::CreateChannel(
33 platform_channel()->Pass(),
34 context()->task_runners()->io_runner(),
35 base::Bind(&AppChildProcessHost::DidCreateChannel,
36 base::Unretained(this)),
37 base::MessageLoop::current()->message_loop_proxy()));
39 controller_.Bind(handle.Pass());
40 controller_.set_client(controller_client_);
43 void AppChildProcessHost::DidStart(bool success) {
44 DVLOG(2) << "AppChildProcessHost::DidStart()";
46 if (!success) {
47 LOG(ERROR) << "Failed to start app child process";
48 controller_client_->AppCompleted(MOJO_RESULT_UNKNOWN);
49 return;
53 // Callback for |embedder::CreateChannel()|.
54 void AppChildProcessHost::DidCreateChannel(
55 embedder::ChannelInfo* channel_info) {
56 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()";
58 CHECK(channel_info);
59 channel_info_ = channel_info;
62 } // namespace shell
63 } // namespace mojo