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

Side by Side Diff: shell/app_child_process_host.cc

Issue 1047333002: For the out-of-process NativeRunner, make sure that Start()'s callback always gets called. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « shell/app_child_process_host.h ('k') | shell/app_child_process_host_unittest.cc » ('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 "shell/app_child_process_host.h" 5 #include "shell/app_child_process_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "mojo/edk/embedder/embedder.h" 10 #include "mojo/edk/embedder/embedder.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void AppChildProcessHost::WillStart() { 44 void AppChildProcessHost::WillStart() {
45 DCHECK(platform_channel()->is_valid()); 45 DCHECK(platform_channel()->is_valid());
46 46
47 ScopedMessagePipeHandle handle(embedder::CreateChannel( 47 ScopedMessagePipeHandle handle(embedder::CreateChannel(
48 platform_channel()->Pass(), context()->task_runners()->io_runner(), 48 platform_channel()->Pass(), context()->task_runners()->io_runner(),
49 base::Bind(&AppChildProcessHost::DidCreateChannel, 49 base::Bind(&AppChildProcessHost::DidCreateChannel,
50 base::Unretained(this)), 50 base::Unretained(this)),
51 base::MessageLoop::current()->message_loop_proxy())); 51 base::MessageLoop::current()->message_loop_proxy()));
52 52
53 controller_.Bind(handle.Pass()); 53 controller_.Bind(handle.Pass());
54 controller_.set_error_handler(this);
54 } 55 }
55 56
56 void AppChildProcessHost::DidStart(bool success) { 57 void AppChildProcessHost::DidStart(bool success) {
57 DVLOG(2) << "AppChildProcessHost::DidStart()"; 58 DVLOG(2) << "AppChildProcessHost::DidStart()";
58 59
59 if (!success) { 60 if (!success) {
60 LOG(ERROR) << "Failed to start app child process"; 61 LOG(ERROR) << "Failed to start app child process";
61 AppCompleted(MOJO_RESULT_UNKNOWN); 62 AppCompleted(MOJO_RESULT_UNKNOWN);
62 return; 63 return;
63 } 64 }
64 } 65 }
65 66
67 void AppChildProcessHost::OnConnectionError() {
68 AppCompleted(MOJO_RESULT_UNKNOWN);
69 }
70
66 // Callback for |embedder::CreateChannel()|. 71 // Callback for |embedder::CreateChannel()|.
67 void AppChildProcessHost::DidCreateChannel( 72 void AppChildProcessHost::DidCreateChannel(
68 embedder::ChannelInfo* channel_info) { 73 embedder::ChannelInfo* channel_info) {
69 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; 74 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()";
70 75
71 CHECK(channel_info); 76 CHECK(channel_info);
72 channel_info_ = channel_info; 77 channel_info_ = channel_info;
73 } 78 }
74 79
75 void AppChildProcessHost::AppCompleted(int32_t result) { 80 void AppChildProcessHost::AppCompleted(int32_t result) {
76 if (!on_app_complete_.is_null()) { 81 if (!on_app_complete_.is_null()) {
77 auto on_app_complete = on_app_complete_; 82 auto on_app_complete = on_app_complete_;
78 on_app_complete_.reset(); 83 on_app_complete_.reset();
79 on_app_complete.Run(result); 84 on_app_complete.Run(result);
80 } 85 }
81 } 86 }
82 87
83 } // namespace shell 88 } // namespace shell
84 } // namespace mojo 89 } // namespace mojo
OLDNEW
« no previous file with comments | « shell/app_child_process_host.h ('k') | shell/app_child_process_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698