| 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/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 18 matching lines...) Expand all Loading... |
| 29 InterfaceRequest<Application> application_request, | 29 InterfaceRequest<Application> application_request, |
| 30 const AppChildController::StartAppCallback& on_app_complete) { | 30 const AppChildController::StartAppCallback& on_app_complete) { |
| 31 DCHECK(controller_); | 31 DCHECK(controller_); |
| 32 | 32 |
| 33 on_app_complete_ = on_app_complete; | 33 on_app_complete_ = on_app_complete; |
| 34 controller_->StartApp( | 34 controller_->StartApp( |
| 35 app_path, clean_app_path, application_request.Pass(), | 35 app_path, clean_app_path, application_request.Pass(), |
| 36 base::Bind(&AppChildProcessHost::AppCompleted, base::Unretained(this))); | 36 base::Bind(&AppChildProcessHost::AppCompleted, base::Unretained(this))); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void AppChildProcessHost::ExitNow(int32_t exit_code) { |
| 40 DCHECK(controller_); |
| 41 |
| 42 controller_->ExitNow(exit_code); |
| 43 } |
| 44 |
| 39 void AppChildProcessHost::WillStart() { | 45 void AppChildProcessHost::WillStart() { |
| 40 DCHECK(platform_channel()->is_valid()); | 46 DCHECK(platform_channel()->is_valid()); |
| 41 | 47 |
| 42 ScopedMessagePipeHandle handle(embedder::CreateChannel( | 48 ScopedMessagePipeHandle handle(embedder::CreateChannel( |
| 43 platform_channel()->Pass(), context()->task_runners()->io_runner(), | 49 platform_channel()->Pass(), context()->task_runners()->io_runner(), |
| 44 base::Bind(&AppChildProcessHost::DidCreateChannel, | 50 base::Bind(&AppChildProcessHost::DidCreateChannel, |
| 45 base::Unretained(this)), | 51 base::Unretained(this)), |
| 46 base::MessageLoop::current()->message_loop_proxy())); | 52 base::MessageLoop::current()->message_loop_proxy())); |
| 47 | 53 |
| 48 controller_.Bind(handle.Pass()); | 54 controller_.Bind(handle.Pass()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 void AppChildProcessHost::AppCompleted(int32_t result) { | 76 void AppChildProcessHost::AppCompleted(int32_t result) { |
| 71 if (!on_app_complete_.is_null()) { | 77 if (!on_app_complete_.is_null()) { |
| 72 auto on_app_complete = on_app_complete_; | 78 auto on_app_complete = on_app_complete_; |
| 73 on_app_complete_.reset(); | 79 on_app_complete_.reset(); |
| 74 on_app_complete.Run(result); | 80 on_app_complete.Run(result); |
| 75 } | 81 } |
| 76 } | 82 } |
| 77 | 83 |
| 78 } // namespace shell | 84 } // namespace shell |
| 79 } // namespace mojo | 85 } // namespace mojo |
| OLD | NEW |