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

Side by Side Diff: mojo/shell/runner/host/in_process_native_runner.cc

Issue 1679573002: Move shell interfaces into the shell.mojom namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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"
(...skipping 17 matching lines...) Expand all
28 if (thread_) { 28 if (thread_) {
29 DCHECK(thread_->HasBeenStarted()); 29 DCHECK(thread_->HasBeenStarted());
30 DCHECK(!thread_->HasBeenJoined()); 30 DCHECK(!thread_->HasBeenJoined());
31 thread_->Join(); 31 thread_->Join();
32 } 32 }
33 } 33 }
34 34
35 void InProcessNativeRunner::Start( 35 void InProcessNativeRunner::Start(
36 const base::FilePath& app_path, 36 const base::FilePath& app_path,
37 bool start_sandboxed, 37 bool start_sandboxed,
38 InterfaceRequest<Application> application_request, 38 InterfaceRequest<mojom::Application> application_request,
39 const base::Callback<void(base::ProcessId)>& pid_available_callback, 39 const base::Callback<void(base::ProcessId)>& pid_available_callback,
40 const base::Closure& app_completed_callback) { 40 const base::Closure& app_completed_callback) {
41 app_path_ = app_path; 41 app_path_ = app_path;
42 42
43 DCHECK(!application_request_.is_pending()); 43 DCHECK(!application_request_.is_pending());
44 application_request_ = std::move(application_request); 44 application_request_ = std::move(application_request);
45 45
46 DCHECK(app_completed_callback_runner_.is_null()); 46 DCHECK(app_completed_callback_runner_.is_null());
47 app_completed_callback_runner_ = base::Bind( 47 app_completed_callback_runner_ = base::Bind(
48 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), 48 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(),
49 FROM_HERE, app_completed_callback); 49 FROM_HERE, app_completed_callback);
50 50
51 DCHECK(!thread_); 51 DCHECK(!thread_);
52 thread_.reset(new base::DelegateSimpleThread(this, "app_thread")); 52 thread_.reset(new base::DelegateSimpleThread(this, "app_thread"));
53 thread_->Start(); 53 thread_->Start();
54 pid_available_callback.Run(base::kNullProcessId); 54 pid_available_callback.Run(base::kNullProcessId);
55 } 55 }
56 56
57 void InProcessNativeRunner::InitHost( 57 void InProcessNativeRunner::InitHost(
58 ScopedHandle channel, 58 ScopedHandle channel,
59 InterfaceRequest<Application> application_request) { 59 InterfaceRequest<mojom::Application> application_request) {
60 NOTREACHED(); // Can't host another process in this runner. 60 NOTREACHED(); // Can't host another process in this runner.
61 } 61 }
62 62
63 void InProcessNativeRunner::Run() { 63 void InProcessNativeRunner::Run() {
64 DVLOG(2) << "Loading/running Mojo app in process from library: " 64 DVLOG(2) << "Loading/running Mojo app in process from library: "
65 << app_path_.value() 65 << app_path_.value()
66 << " thread id=" << base::PlatformThread::CurrentId(); 66 << " thread id=" << base::PlatformThread::CurrentId();
67 67
68 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method! 68 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method!
69 base::NativeLibrary app_library = LoadNativeApplication(app_path_); 69 base::NativeLibrary app_library = LoadNativeApplication(app_path_);
(...skipping 13 matching lines...) Expand all
83 // Non-Mojo apps are always run in a new process. 83 // Non-Mojo apps are always run in a new process.
84 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { 84 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) {
85 return make_scoped_ptr( 85 return make_scoped_ptr(
86 new OutOfProcessNativeRunner(launch_process_runner_)); 86 new OutOfProcessNativeRunner(launch_process_runner_));
87 } 87 }
88 return make_scoped_ptr(new InProcessNativeRunner); 88 return make_scoped_ptr(new InProcessNativeRunner);
89 } 89 }
90 90
91 } // namespace shell 91 } // namespace shell
92 } // namespace mojo 92 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/runner/host/in_process_native_runner.h ('k') | mojo/shell/runner/host/native_application_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698