OLD | NEW |
---|---|
(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()); | |
qsr
2015/01/30 15:04:11
For obvious reason this will fail on Android.
Nick Bray (chromium)
2015/01/31 02:47:10
Yes. ARM and x86-32 support will require multipro
| |
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 | |
OLD | NEW |