OLD | NEW |
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/child_process_host.h" | 5 #include "shell/child_process_host.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 DCHECK(child_process_.IsValid()); | 54 DCHECK(child_process_.IsValid()); |
55 int rv = -1; | 55 int rv = -1; |
56 LOG_IF(ERROR, !child_process_.WaitForExit(&rv)) | 56 LOG_IF(ERROR, !child_process_.WaitForExit(&rv)) |
57 << "Failed to wait for child process"; | 57 << "Failed to wait for child process"; |
58 child_process_.Close(); | 58 child_process_.Close(); |
59 return rv; | 59 return rv; |
60 } | 60 } |
61 | 61 |
62 void ChildProcessHost::StartApp( | 62 void ChildProcessHost::StartApp( |
63 const mojo::String& app_path, | 63 const mojo::String& app_path, |
64 bool clean_app_path, | |
65 mojo::InterfaceRequest<mojo::Application> application_request, | 64 mojo::InterfaceRequest<mojo::Application> application_request, |
66 const ChildController::StartAppCallback& on_app_complete) { | 65 const ChildController::StartAppCallback& on_app_complete) { |
67 DCHECK(controller_); | 66 DCHECK(controller_); |
68 | 67 |
69 on_app_complete_ = on_app_complete; | 68 on_app_complete_ = on_app_complete; |
70 controller_->StartApp( | 69 controller_->StartApp( |
71 app_path, clean_app_path, application_request.Pass(), | 70 app_path, application_request.Pass(), |
72 base::Bind(&ChildProcessHost::AppCompleted, base::Unretained(this))); | 71 base::Bind(&ChildProcessHost::AppCompleted, base::Unretained(this))); |
73 } | 72 } |
74 | 73 |
75 void ChildProcessHost::ExitNow(int32_t exit_code) { | 74 void ChildProcessHost::ExitNow(int32_t exit_code) { |
76 DCHECK(controller_); | 75 DCHECK(controller_); |
77 | 76 |
78 controller_->ExitNow(exit_code); | 77 controller_->ExitNow(exit_code); |
79 } | 78 } |
80 | 79 |
81 void ChildProcessHost::DidStart(bool success) { | 80 void ChildProcessHost::DidStart(bool success) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 on_app_complete_.reset(); | 129 on_app_complete_.reset(); |
131 on_app_complete.Run(result); | 130 on_app_complete.Run(result); |
132 } | 131 } |
133 } | 132 } |
134 | 133 |
135 void ChildProcessHost::OnConnectionError() { | 134 void ChildProcessHost::OnConnectionError() { |
136 AppCompleted(MOJO_RESULT_UNKNOWN); | 135 AppCompleted(MOJO_RESULT_UNKNOWN); |
137 } | 136 } |
138 | 137 |
139 } // namespace shell | 138 } // namespace shell |
OLD | NEW |