| 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 "services/shell/runner/host/in_process_native_runner.h" | 5 #include "services/shell/runner/host/in_process_native_runner.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // It is important to let the thread exit before unloading the DSO (when | 28 // It is important to let the thread exit before unloading the DSO (when |
| 29 // app_library_ is destructed), because the library may have registered | 29 // app_library_ is destructed), because the library may have registered |
| 30 // thread-local data and destructors to run on thread termination. | 30 // thread-local data and destructors to run on thread termination. |
| 31 if (thread_) { | 31 if (thread_) { |
| 32 DCHECK(thread_->HasBeenStarted()); | 32 DCHECK(thread_->HasBeenStarted()); |
| 33 DCHECK(!thread_->HasBeenJoined()); | 33 DCHECK(!thread_->HasBeenJoined()); |
| 34 thread_->Join(); | 34 thread_->Join(); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 mojom::ShellClientPtr InProcessNativeRunner::Start( | 38 mojom::ServicePtr InProcessNativeRunner::Start( |
| 39 const base::FilePath& app_path, | 39 const base::FilePath& app_path, |
| 40 const Identity& target, | 40 const Identity& target, |
| 41 bool start_sandboxed, | 41 bool start_sandboxed, |
| 42 const base::Callback<void(base::ProcessId)>& pid_available_callback, | 42 const base::Callback<void(base::ProcessId)>& pid_available_callback, |
| 43 const base::Closure& app_completed_callback) { | 43 const base::Closure& app_completed_callback) { |
| 44 app_path_ = app_path; | 44 app_path_ = app_path; |
| 45 | 45 |
| 46 DCHECK(!request_.is_pending()); | 46 DCHECK(!request_.is_pending()); |
| 47 mojom::ShellClientPtr client; | 47 mojom::ServicePtr client; |
| 48 request_ = GetProxy(&client); | 48 request_ = GetProxy(&client); |
| 49 | 49 |
| 50 DCHECK(app_completed_callback_runner_.is_null()); | 50 DCHECK(app_completed_callback_runner_.is_null()); |
| 51 app_completed_callback_runner_ = base::Bind( | 51 app_completed_callback_runner_ = base::Bind( |
| 52 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), | 52 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), |
| 53 FROM_HERE, app_completed_callback); | 53 FROM_HERE, app_completed_callback); |
| 54 | 54 |
| 55 DCHECK(!thread_); | 55 DCHECK(!thread_); |
| 56 std::string thread_name = "mojo:app_thread"; | 56 std::string thread_name = "mojo:app_thread"; |
| 57 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 86 const base::FilePath& app_path) { | 86 const base::FilePath& app_path) { |
| 87 // Non-Mojo apps are always run in a new process. | 87 // Non-Mojo apps are always run in a new process. |
| 88 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { | 88 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { |
| 89 return base::WrapUnique( | 89 return base::WrapUnique( |
| 90 new OutOfProcessNativeRunner(launch_process_runner_, nullptr)); | 90 new OutOfProcessNativeRunner(launch_process_runner_, nullptr)); |
| 91 } | 91 } |
| 92 return base::WrapUnique(new InProcessNativeRunner); | 92 return base::WrapUnique(new InProcessNativeRunner); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace shell | 95 } // namespace shell |
| OLD | NEW |