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

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

Issue 1761153002: Replace ChildController with ShellClientFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@29binding
Patch Set: . Created 4 years, 9 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 19 matching lines...) Expand all
30 DCHECK(thread_->HasBeenStarted()); 30 DCHECK(thread_->HasBeenStarted());
31 DCHECK(!thread_->HasBeenJoined()); 31 DCHECK(!thread_->HasBeenJoined());
32 thread_->Join(); 32 thread_->Join();
33 } 33 }
34 } 34 }
35 35
36 void InProcessNativeRunner::Start( 36 void InProcessNativeRunner::Start(
37 const base::FilePath& app_path, 37 const base::FilePath& app_path,
38 const Identity& target, 38 const Identity& target,
39 bool start_sandboxed, 39 bool start_sandboxed,
40 InterfaceRequest<mojom::ShellClient> request, 40 mojom::ShellClientRequest request,
41 const base::Callback<void(base::ProcessId)>& pid_available_callback, 41 const base::Callback<void(base::ProcessId)>& pid_available_callback,
42 const base::Closure& app_completed_callback) { 42 const base::Closure& app_completed_callback) {
43 app_path_ = app_path; 43 app_path_ = app_path;
44 44
45 DCHECK(!request_.is_pending()); 45 DCHECK(!request_.is_pending());
46 request_ = std::move(request); 46 request_ = std::move(request);
47 47
48 DCHECK(app_completed_callback_runner_.is_null()); 48 DCHECK(app_completed_callback_runner_.is_null());
49 app_completed_callback_runner_ = base::Bind( 49 app_completed_callback_runner_ = base::Bind(
50 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), 50 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(),
51 FROM_HERE, app_completed_callback); 51 FROM_HERE, app_completed_callback);
52 52
53 DCHECK(!thread_); 53 DCHECK(!thread_);
54 std::string thread_name = "mojo:app_thread"; 54 std::string thread_name = "mojo:app_thread";
55 #if defined(OS_WIN) 55 #if defined(OS_WIN)
56 thread_name = base::WideToUTF8(app_path_.BaseName().value()); 56 thread_name = base::WideToUTF8(app_path_.BaseName().value());
57 #endif 57 #endif
58 thread_.reset(new base::DelegateSimpleThread(this, thread_name)); 58 thread_.reset(new base::DelegateSimpleThread(this, thread_name));
59 thread_->Start(); 59 thread_->Start();
60 pid_available_callback.Run(base::kNullProcessId); 60 pid_available_callback.Run(base::kNullProcessId);
61 } 61 }
62 62
63 void InProcessNativeRunner::InitHost( 63 void InProcessNativeRunner::InitHost(mojom::ShellClientFactoryPtr factory,
64 ScopedHandle channel, 64 const String& name,
65 InterfaceRequest<mojom::ShellClient> request) { 65 mojom::ShellClientRequest request) {
66 NOTREACHED(); // Can't host another process in this runner. 66 NOTREACHED(); // Can't host another process in this runner.
67 } 67 }
68 68
69 void InProcessNativeRunner::Run() { 69 void InProcessNativeRunner::Run() {
70 DVLOG(2) << "Loading/running Mojo app in process from library: " 70 DVLOG(2) << "Loading/running Mojo app in process from library: "
71 << app_path_.value() 71 << app_path_.value()
72 << " thread id=" << base::PlatformThread::CurrentId(); 72 << " thread id=" << base::PlatformThread::CurrentId();
73 73
74 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method! 74 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method!
75 base::NativeLibrary app_library = LoadNativeApplication(app_path_); 75 base::NativeLibrary app_library = LoadNativeApplication(app_path_);
(...skipping 13 matching lines...) Expand all
89 // Non-Mojo apps are always run in a new process. 89 // Non-Mojo apps are always run in a new process.
90 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { 90 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) {
91 return make_scoped_ptr( 91 return make_scoped_ptr(
92 new OutOfProcessNativeRunner(launch_process_runner_, nullptr)); 92 new OutOfProcessNativeRunner(launch_process_runner_, nullptr));
93 } 93 }
94 return make_scoped_ptr(new InProcessNativeRunner); 94 return make_scoped_ptr(new InProcessNativeRunner);
95 } 95 }
96 96
97 } // namespace shell 97 } // namespace shell
98 } // namespace mojo 98 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/runner/host/in_process_native_runner.h ('k') | mojo/shell/runner/host/out_of_process_native_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698