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( | |
14 Context* context) | |
jamesr
2015/01/28 23:11:30
looks oddly wrapped - did you 'git cl format' ?
Nick Bray (chromium)
2015/01/29 22:31:35
Done.
The code in the NaCl repo is too far gone t
| |
15 : context_(context) { | |
16 } | |
17 | |
18 NaClServiceRunner::~NaClServiceRunner() { | |
19 if (thread_) { | |
20 DCHECK(thread_->HasBeenStarted()); | |
21 DCHECK(!thread_->HasBeenJoined()); | |
22 thread_->Join(); | |
23 } | |
24 } | |
25 | |
26 void NaClServiceRunner::Start( | |
27 const base::FilePath& app_path, | |
28 InterfaceRequest<Application> application_request) { | |
29 // TODO(ncbray) be more principled about finding the IRT. | |
30 irt_path_ = base::FilePath( | |
31 context_->ResolveShellFileURL("irt_x64/irt_core.nexe").GetContent()); | |
32 | |
33 app_path_ = app_path; | |
34 | |
35 DCHECK(!application_request_.is_pending()); | |
36 application_request_ = application_request.Pass(); | |
37 | |
38 DCHECK(!thread_); | |
39 thread_.reset(new base::DelegateSimpleThread(this, "app_thread")); | |
40 thread_->Start(); | |
41 } | |
42 | |
43 void NaClServiceRunner::Run() { | |
44 MojoHandle handle = application_request_.PassMessagePipe().release().value(); | |
45 | |
46 // This function will never return - it will take the process down instead. | |
47 LaunchNaCl(app_path_.AsUTF8Unsafe().c_str(), irt_path_.AsUTF8Unsafe().c_str(), | |
48 0, NULL, handle); | |
jamesr
2015/01/28 23:11:30
nullptr ?
Nick Bray (chromium)
2015/01/29 22:31:35
Done.
| |
49 NOTREACHED(); | |
50 } | |
51 | |
52 } // namespace shell | |
53 } // namespace mojo | |
OLD | NEW |