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 <fcntl.h> | |
6 | |
7 #include "base/files/file_util.h" | |
8 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" | |
9 #include "mojo/public/c/system/main.h" | |
10 #include "mojo/public/cpp/application/application_connection.h" | |
11 #include "mojo/public/cpp/application/application_delegate.h" | |
12 #include "mojo/public/cpp/application/application_runner.h" | |
13 #include "mojo/public/cpp/application/interface_factory.h" | |
14 #include "mojo/public/cpp/bindings/strong_binding.h" | |
15 #include "services/nacl/pexe_linker.mojom.h" | |
16 | |
17 namespace mojo { | |
18 namespace nacl { | |
19 | |
20 class PexeLinkerImpl : public PexeLinker { | |
21 public: | |
22 void PexeLink(ScopedMessagePipeHandle handle) override { | |
23 // int nexe_fd = open("native_client/toolchain/linux_x86/pnacl_translator" | |
24 // "/translator/x86-32-nonsfi/bin/ld.nexe", O_RDONLY); | |
25 int nexe_fd = open("sean_out/ld.nexe", O_RDONLY); | |
Mark Seaborn
2015/10/20 21:32:40
Needs fixing. :-)
Sean Klein
2015/10/22 21:50:00
No worries, the bots wouldn't let me get past this
| |
26 if (nexe_fd < 0) | |
27 LOG(FATAL) << "Could not open linker nexe"; | |
28 ::nacl::MojoLaunchNexeNonsfi(nexe_fd, handle.Pass().get().value()); | |
29 } | |
30 }; | |
31 | |
32 class StrongBindingPexeLinkerImpl : public PexeLinkerImpl { | |
33 public: | |
34 explicit StrongBindingPexeLinkerImpl(InterfaceRequest<PexeLinker> request) | |
35 : strong_binding_(this, request.Pass()) {} | |
36 | |
37 private: | |
38 StrongBinding<PexeLinker> strong_binding_; | |
39 }; | |
40 | |
41 class MultiPexeLinker : public mojo::ApplicationDelegate, | |
42 public mojo::InterfaceFactory<PexeLinker> { | |
43 public: | |
44 MultiPexeLinker() {} | |
45 | |
46 // From ApplicationDelegate | |
47 bool ConfigureIncomingConnection( | |
48 mojo::ApplicationConnection* connection) override { | |
49 connection->AddService<PexeLinker>(this); | |
50 return true; | |
51 } | |
52 | |
53 // From InterfaceFactory | |
54 void Create(mojo::ApplicationConnection* connection, | |
55 mojo::InterfaceRequest<PexeLinker> request) override { | |
56 new StrongBindingPexeLinkerImpl(request.Pass()); | |
57 } | |
58 }; | |
59 | |
60 } // namespace nacl | |
61 } // namespace mojo | |
62 | |
63 MojoResult MojoMain(MojoHandle application_request) { | |
64 mojo::ApplicationRunner runner(new mojo::nacl::MultiPexeLinker()); | |
65 return runner.Run(application_request); | |
66 } | |
OLD | NEW |