OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/nacl/nonsfi/file_util.h" | 8 #include "mojo/nacl/nonsfi/file_util.h" |
9 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" | 9 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" |
10 #include "mojo/public/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
11 #include "mojo/public/cpp/application/application_connection.h" | 11 #include "mojo/public/cpp/application/application_connection.h" |
12 #include "mojo/public/cpp/application/application_delegate.h" | 12 #include "mojo/public/cpp/application/application_delegate.h" |
13 #include "mojo/public/cpp/application/application_runner.h" | 13 #include "mojo/public/cpp/application/application_runner.h" |
14 #include "mojo/public/cpp/application/interface_factory.h" | 14 #include "mojo/public/cpp/application/interface_factory.h" |
15 #include "mojo/public/cpp/bindings/strong_binding.h" | 15 #include "mojo/public/cpp/bindings/strong_binding.h" |
16 #include "services/nacl/nonsfi/kLdNexe.h" | 16 #include "services/nacl/nonsfi/kLdNexe.h" |
17 #include "services/nacl/nonsfi/pnacl_link.mojom.h" | 17 #include "services/nacl/nonsfi/pnacl_link.mojom.h" |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 namespace nacl { | 20 namespace nacl { |
21 | 21 |
22 class PexeLinkerImpl : public PexeLinkerInit { | 22 class PexeLinkerImpl : public PexeLinkerInit { |
23 public: | 23 public: |
24 void PexeLinkerStart(ScopedMessagePipeHandle handle) override { | 24 void PexeLinkerStart(InterfaceRequest<PexeLinker> linker_request) override { |
25 int nexe_fd = ::nacl::DataToTempFileDescriptor(::nacl::kLdNexe); | 25 int nexe_fd = ::nacl::DataToTempFileDescriptor(::nacl::kLdNexe); |
26 CHECK(nexe_fd >= 0) << "Could not open linker nexe"; | 26 CHECK(nexe_fd >= 0) << "Could not open linker nexe"; |
27 ::nacl::MojoLaunchNexeNonsfi(nexe_fd, | 27 ::nacl::MojoLaunchNexeNonsfi( |
28 handle.release().value(), | 28 nexe_fd, linker_request.PassMessagePipe().release().value(), |
29 true /* enable_translate_irt */); | 29 true /* enable_translate_irt */); |
30 } | 30 } |
31 }; | 31 }; |
32 | 32 |
33 class StrongBindingPexeLinkerImpl : public PexeLinkerImpl { | 33 class StrongBindingPexeLinkerImpl : public PexeLinkerImpl { |
34 public: | 34 public: |
35 explicit StrongBindingPexeLinkerImpl(InterfaceRequest<PexeLinkerInit> request) | 35 explicit StrongBindingPexeLinkerImpl(InterfaceRequest<PexeLinkerInit> request) |
36 : strong_binding_(this, request.Pass()) {} | 36 : strong_binding_(this, request.Pass()) {} |
37 | 37 |
38 private: | 38 private: |
39 StrongBinding<PexeLinkerInit> strong_binding_; | 39 StrongBinding<PexeLinkerInit> strong_binding_; |
(...skipping 18 matching lines...) Expand all Loading... |
58 }; | 58 }; |
59 | 59 |
60 } // namespace nacl | 60 } // namespace nacl |
61 } // namespace mojo | 61 } // namespace mojo |
62 | 62 |
63 MojoResult MojoMain(MojoHandle application_request) { | 63 MojoResult MojoMain(MojoHandle application_request) { |
64 mojo::ApplicationRunner runner(std::unique_ptr<mojo::nacl::MultiPexeLinker>( | 64 mojo::ApplicationRunner runner(std::unique_ptr<mojo::nacl::MultiPexeLinker>( |
65 new mojo::nacl::MultiPexeLinker())); | 65 new mojo::nacl::MultiPexeLinker())); |
66 return runner.Run(application_request); | 66 return runner.Run(application_request); |
67 } | 67 } |
OLD | NEW |