| 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/out_of_process_dynamic_service_runner.h" | 5 #include "shell/out_of_process_dynamic_service_runner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 void OutOfProcessDynamicServiceRunner::Start( | 31 void OutOfProcessDynamicServiceRunner::Start( |
| 32 const base::FilePath& app_path, | 32 const base::FilePath& app_path, |
| 33 DynamicServiceRunner::CleanupBehavior cleanup_behavior, | 33 DynamicServiceRunner::CleanupBehavior cleanup_behavior, |
| 34 InterfaceRequest<Application> application_request, | 34 InterfaceRequest<Application> application_request, |
| 35 const base::Closure& app_completed_callback) { | 35 const base::Closure& app_completed_callback) { |
| 36 app_path_ = app_path; | 36 app_path_ = app_path; |
| 37 | 37 |
| 38 DCHECK(app_completed_callback_.is_null()); | 38 DCHECK(app_completed_callback_.is_null()); |
| 39 app_completed_callback_ = app_completed_callback; | 39 app_completed_callback_ = app_completed_callback; |
| 40 | 40 |
| 41 app_child_process_host_.reset( | 41 app_child_process_host_.reset(new AppChildProcessHost(context_)); |
| 42 new AppChildProcessHost(context_)); | |
| 43 app_child_process_host_->Start(); | 42 app_child_process_host_->Start(); |
| 44 | 43 |
| 45 // TODO(vtl): |app_path.AsUTF8Unsafe()| is unsafe. | 44 // TODO(vtl): |app_path.AsUTF8Unsafe()| is unsafe. |
| 46 app_child_process_host_->StartApp( | 45 app_child_process_host_->StartApp( |
| 47 app_path.AsUTF8Unsafe(), cleanup_behavior == DeleteAppPath, | 46 app_path.AsUTF8Unsafe(), cleanup_behavior == DeleteAppPath, |
| 48 application_request.Pass(), | 47 application_request.Pass(), |
| 49 base::Bind(&OutOfProcessDynamicServiceRunner::AppCompleted, | 48 base::Bind(&OutOfProcessDynamicServiceRunner::AppCompleted, |
| 50 base::Unretained(this))); | 49 base::Unretained(this))); |
| 51 } | 50 } |
| 52 | 51 |
| 53 void OutOfProcessDynamicServiceRunner::AppCompleted(int32_t result) { | 52 void OutOfProcessDynamicServiceRunner::AppCompleted(int32_t result) { |
| 54 DVLOG(2) << "OutOfProcessDynamicServiceRunner::AppCompleted(" << result | 53 DVLOG(2) << "OutOfProcessDynamicServiceRunner::AppCompleted(" << result |
| 55 << ")"; | 54 << ")"; |
| 56 | 55 |
| 57 app_child_process_host_.reset(); | 56 app_child_process_host_.reset(); |
| 58 // This object may be deleted by this callback. | 57 // This object may be deleted by this callback. |
| 59 base::Closure app_completed_callback = app_completed_callback_; | 58 base::Closure app_completed_callback = app_completed_callback_; |
| 60 app_completed_callback_.Reset(); | 59 app_completed_callback_.Reset(); |
| 61 app_completed_callback.Run(); | 60 app_completed_callback.Run(); |
| 62 } | 61 } |
| 63 | 62 |
| 64 } // namespace shell | 63 } // namespace shell |
| 65 } // namespace mojo | 64 } // namespace mojo |
| OLD | NEW |