Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: mojo/shell/runner/host/in_process_native_runner.cc

Issue 1877753003: Move mojo\shell to services\shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@62scan
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/shell/runner/host/in_process_native_runner.cc
diff --git a/mojo/shell/runner/host/in_process_native_runner.cc b/mojo/shell/runner/host/in_process_native_runner.cc
deleted file mode 100644
index 823cf5f3b45198ca3ae153f76feeb9fa4e9dc3b1..0000000000000000000000000000000000000000
--- a/mojo/shell/runner/host/in_process_native_runner.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/shell/runner/host/in_process_native_runner.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/location.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/task_runner.h"
-#include "base/thread_task_runner_handle.h"
-#include "base/threading/platform_thread.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/shell/runner/host/native_application_support.h"
-#include "mojo/shell/runner/host/out_of_process_native_runner.h"
-#include "mojo/shell/runner/init.h"
-
-namespace mojo {
-namespace shell {
-
-InProcessNativeRunner::InProcessNativeRunner() : app_library_(nullptr) {}
-
-InProcessNativeRunner::~InProcessNativeRunner() {
- // It is important to let the thread exit before unloading the DSO (when
- // app_library_ is destructed), because the library may have registered
- // thread-local data and destructors to run on thread termination.
- if (thread_) {
- DCHECK(thread_->HasBeenStarted());
- DCHECK(!thread_->HasBeenJoined());
- thread_->Join();
- }
-}
-
-mojom::ShellClientPtr InProcessNativeRunner::Start(
- const base::FilePath& app_path,
- const Identity& target,
- bool start_sandboxed,
- const base::Callback<void(base::ProcessId)>& pid_available_callback,
- const base::Closure& app_completed_callback) {
- app_path_ = app_path;
-
- DCHECK(!request_.is_pending());
- mojom::ShellClientPtr client;
- request_ = GetProxy(&client);
-
- DCHECK(app_completed_callback_runner_.is_null());
- app_completed_callback_runner_ = base::Bind(
- &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(),
- FROM_HERE, app_completed_callback);
-
- DCHECK(!thread_);
- std::string thread_name = "mojo:app_thread";
-#if defined(OS_WIN)
- thread_name = base::WideToUTF8(app_path_.BaseName().value());
-#endif
- thread_.reset(new base::DelegateSimpleThread(this, thread_name));
- thread_->Start();
- pid_available_callback.Run(base::kNullProcessId);
-
- return client;
-}
-
-void InProcessNativeRunner::Run() {
- DVLOG(2) << "Loading/running Mojo app in process from library: "
- << app_path_.value()
- << " thread id=" << base::PlatformThread::CurrentId();
-
- // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method!
- base::NativeLibrary app_library = LoadNativeApplication(app_path_);
- app_library_.Reset(app_library);
- // This hangs on Windows in the component build, so skip it since it's
- // unnecessary.
-#if !(defined(COMPONENT_BUILD) && defined(OS_WIN))
- CallLibraryEarlyInitialization(app_library);
-#endif
- RunNativeApplication(app_library, std::move(request_));
- app_completed_callback_runner_.Run();
- app_completed_callback_runner_.Reset();
-}
-
-scoped_ptr<NativeRunner> InProcessNativeRunnerFactory::Create(
- const base::FilePath& app_path) {
- // Non-Mojo apps are always run in a new process.
- if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) {
- return make_scoped_ptr(
- new OutOfProcessNativeRunner(launch_process_runner_, nullptr));
- }
- return make_scoped_ptr(new InProcessNativeRunner);
-}
-
-} // namespace shell
-} // namespace mojo
« no previous file with comments | « mojo/shell/runner/host/in_process_native_runner.h ('k') | mojo/shell/runner/host/in_process_native_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698