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

Side by Side Diff: shell/nacl/nacl_service_runner.cc

Issue 884303002: Launch nexes from mojo_shell. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Formatting error Created 5 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "shell/nacl/nacl_service_runner.h"
6
7 #include "mojo/nacl/monacl_sel_main.h"
8 #include "shell/context.h"
9
10 namespace mojo {
11 namespace shell {
12
13 NaClServiceRunner::NaClServiceRunner(Context* context) : context_(context) {
14 }
15
16 NaClServiceRunner::~NaClServiceRunner() {
17 if (thread_) {
18 DCHECK(thread_->HasBeenStarted());
19 DCHECK(!thread_->HasBeenJoined());
20 thread_->Join();
21 }
22 }
23
24 void NaClServiceRunner::Start(
25 const base::FilePath& app_path,
26 InterfaceRequest<Application> application_request) {
27 // TODO(ncbray) be more principled about finding the IRT.
28 irt_path_ = base::FilePath(
29 context_->ResolveShellFileURL("irt_x64/irt_core.nexe").GetContent());
30
31 app_path_ = app_path;
32
33 DCHECK(!application_request_.is_pending());
34 application_request_ = application_request.Pass();
35
36 DCHECK(!thread_);
37 thread_.reset(new base::DelegateSimpleThread(this, "app_thread"));
38 thread_->Start();
39 }
40
41 void NaClServiceRunner::Run() {
42 MojoHandle handle = application_request_.PassMessagePipe().release().value();
43
44 // This function will never return - it will take the process down instead.
45 LaunchNaCl(app_path_.AsUTF8Unsafe().c_str(), irt_path_.AsUTF8Unsafe().c_str(),
46 0, nullptr, handle);
47 NOTREACHED();
48 }
49
50 } // namespace shell
51 } // namespace mojo
OLDNEW
« shell/nacl/nacl_service_runner.h ('K') | « shell/nacl/nacl_service_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698