| 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 "mojo/shell/runner/host/in_process_native_runner.h" | 5 #include "mojo/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" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/task_runner.h" | 13 #include "base/task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 15 #include "mojo/shell/runner/host/native_application_support.h" | 16 #include "mojo/shell/runner/host/native_application_support.h" |
| 16 #include "mojo/shell/runner/host/out_of_process_native_runner.h" | 17 #include "mojo/shell/runner/host/out_of_process_native_runner.h" |
| 17 #include "mojo/shell/runner/init.h" | 18 #include "mojo/shell/runner/init.h" |
| 18 | 19 |
| 19 namespace mojo { | 20 namespace mojo { |
| 20 namespace shell { | 21 namespace shell { |
| 21 | 22 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 DCHECK(!request_.is_pending()); | 45 DCHECK(!request_.is_pending()); |
| 45 request_ = std::move(request); | 46 request_ = std::move(request); |
| 46 | 47 |
| 47 DCHECK(app_completed_callback_runner_.is_null()); | 48 DCHECK(app_completed_callback_runner_.is_null()); |
| 48 app_completed_callback_runner_ = base::Bind( | 49 app_completed_callback_runner_ = base::Bind( |
| 49 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), | 50 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), |
| 50 FROM_HERE, app_completed_callback); | 51 FROM_HERE, app_completed_callback); |
| 51 | 52 |
| 52 DCHECK(!thread_); | 53 DCHECK(!thread_); |
| 53 thread_.reset(new base::DelegateSimpleThread(this, "app_thread")); | 54 std::string thread_name = base::SysWideToUTF8(app_path_.BaseName().value()); |
| 55 if (thread_name.empty()) |
| 56 thread_name = "mojo:app_thread"; |
| 57 thread_.reset(new base::DelegateSimpleThread(this, thread_name)); |
| 54 thread_->Start(); | 58 thread_->Start(); |
| 55 pid_available_callback.Run(base::kNullProcessId); | 59 pid_available_callback.Run(base::kNullProcessId); |
| 56 } | 60 } |
| 57 | 61 |
| 58 void InProcessNativeRunner::InitHost( | 62 void InProcessNativeRunner::InitHost( |
| 59 ScopedHandle channel, | 63 ScopedHandle channel, |
| 60 InterfaceRequest<mojom::ShellClient> request) { | 64 InterfaceRequest<mojom::ShellClient> request) { |
| 61 NOTREACHED(); // Can't host another process in this runner. | 65 NOTREACHED(); // Can't host another process in this runner. |
| 62 } | 66 } |
| 63 | 67 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 // Non-Mojo apps are always run in a new process. | 88 // Non-Mojo apps are always run in a new process. |
| 85 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { | 89 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { |
| 86 return make_scoped_ptr( | 90 return make_scoped_ptr( |
| 87 new OutOfProcessNativeRunner(launch_process_runner_, nullptr)); | 91 new OutOfProcessNativeRunner(launch_process_runner_, nullptr)); |
| 88 } | 92 } |
| 89 return make_scoped_ptr(new InProcessNativeRunner); | 93 return make_scoped_ptr(new InProcessNativeRunner); |
| 90 } | 94 } |
| 91 | 95 |
| 92 } // namespace shell | 96 } // namespace shell |
| 93 } // namespace mojo | 97 } // namespace mojo |
| OLD | NEW |