| 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/kPnaclTranslatorCompile.h" | 16 #include "services/nacl/nonsfi/kPnaclTranslatorCompile.h" |
| 17 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" | 17 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 namespace nacl { | 20 namespace nacl { |
| 21 | 21 |
| 22 class PexeCompilerImpl : public PexeCompilerInit { | 22 class PexeCompilerImpl : public PexeCompilerInit { |
| 23 public: | 23 public: |
| 24 void PexeCompilerStart(ScopedMessagePipeHandle handle) override { | 24 void PexeCompilerStart( |
| 25 InterfaceRequest<PexeCompiler> compiler_request) override { |
| 25 int nexe_fd = | 26 int nexe_fd = |
| 26 ::nacl::DataToTempFileDescriptor(::nacl::kPnaclTranslatorCompile); | 27 ::nacl::DataToTempFileDescriptor(::nacl::kPnaclTranslatorCompile); |
| 27 CHECK(nexe_fd >= 0) << "Could not open compiler nexe"; | 28 CHECK(nexe_fd >= 0) << "Could not open compiler nexe"; |
| 28 ::nacl::MojoLaunchNexeNonsfi(nexe_fd, | 29 ::nacl::MojoLaunchNexeNonsfi( |
| 29 handle.release().value(), | 30 nexe_fd, compiler_request.PassMessagePipe().release().value(), |
| 30 true /* enable_translate_irt */); | 31 true /* enable_translate_irt */); |
| 31 } | 32 } |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 class StrongBindingPexeCompilerImpl : public PexeCompilerImpl { | 35 class StrongBindingPexeCompilerImpl : public PexeCompilerImpl { |
| 35 public: | 36 public: |
| 36 explicit StrongBindingPexeCompilerImpl(InterfaceRequest<PexeCompilerInit> | 37 explicit StrongBindingPexeCompilerImpl(InterfaceRequest<PexeCompilerInit> |
| 37 request) | 38 request) |
| 38 : strong_binding_(this, request.Pass()) {} | 39 : strong_binding_(this, request.Pass()) {} |
| 39 | 40 |
| 40 private: | 41 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace nacl | 63 } // namespace nacl |
| 63 } // namespace mojo | 64 } // namespace mojo |
| 64 | 65 |
| 65 MojoResult MojoMain(MojoHandle application_request) { | 66 MojoResult MojoMain(MojoHandle application_request) { |
| 66 mojo::ApplicationRunner runner(std::unique_ptr<mojo::nacl::MultiPexeCompiler>( | 67 mojo::ApplicationRunner runner(std::unique_ptr<mojo::nacl::MultiPexeCompiler>( |
| 67 new mojo::nacl::MultiPexeCompiler())); | 68 new mojo::nacl::MultiPexeCompiler())); |
| 68 return runner.Run(application_request); | 69 return runner.Run(application_request); |
| 69 } | 70 } |
| OLD | NEW |