| 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> | |
| 6 | |
| 7 #include "base/logging.h" | 5 #include "base/logging.h" |
| 8 #include "mojo/nacl/nonsfi/file_util.h" | 6 #include "mojo/nacl/nonsfi/file_util.h" |
| 9 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" | 7 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" |
| 10 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
| 11 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_impl_base.h" |
| 12 #include "mojo/public/cpp/application/application_runner.h" | 10 #include "mojo/public/cpp/application/run_application.h" |
| 13 #include "mojo/public/cpp/application/service_provider_impl.h" | 11 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 14 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 15 #include "services/nacl/nonsfi/kPnaclTranslatorCompile.h" | 13 #include "services/nacl/nonsfi/kPnaclTranslatorCompile.h" |
| 16 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" | 14 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" |
| 17 | 15 |
| 18 namespace mojo { | 16 namespace mojo { |
| 19 namespace nacl { | 17 namespace nacl { |
| 20 | 18 |
| 21 class PexeCompilerImpl : public PexeCompilerInit { | 19 class PexeCompilerImpl : public PexeCompilerInit { |
| 22 public: | 20 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 class StrongBindingPexeCompilerImpl : public PexeCompilerImpl { | 32 class StrongBindingPexeCompilerImpl : public PexeCompilerImpl { |
| 35 public: | 33 public: |
| 36 explicit StrongBindingPexeCompilerImpl(InterfaceRequest<PexeCompilerInit> | 34 explicit StrongBindingPexeCompilerImpl(InterfaceRequest<PexeCompilerInit> |
| 37 request) | 35 request) |
| 38 : strong_binding_(this, request.Pass()) {} | 36 : strong_binding_(this, request.Pass()) {} |
| 39 | 37 |
| 40 private: | 38 private: |
| 41 StrongBinding<PexeCompilerInit> strong_binding_; | 39 StrongBinding<PexeCompilerInit> strong_binding_; |
| 42 }; | 40 }; |
| 43 | 41 |
| 44 class MultiPexeCompiler : public ApplicationDelegate { | 42 class MultiPexeCompiler : public ApplicationImplBase { |
| 45 public: | 43 public: |
| 46 MultiPexeCompiler() {} | 44 MultiPexeCompiler() {} |
| 47 | 45 |
| 48 // From ApplicationDelegate | 46 // From ApplicationImplBase |
| 49 bool ConfigureIncomingConnection( | 47 bool OnAcceptConnection(ServiceProviderImpl* service_provider_impl) override { |
| 50 ServiceProviderImpl* service_provider_impl) override { | |
| 51 service_provider_impl->AddService<PexeCompilerInit>( | 48 service_provider_impl->AddService<PexeCompilerInit>( |
| 52 [](const ConnectionContext& connection_context, | 49 [](const ConnectionContext& connection_context, |
| 53 InterfaceRequest<PexeCompilerInit> request) { | 50 InterfaceRequest<PexeCompilerInit> request) { |
| 54 new StrongBindingPexeCompilerImpl(request.Pass()); | 51 new StrongBindingPexeCompilerImpl(request.Pass()); |
| 55 }); | 52 }); |
| 56 return true; | 53 return true; |
| 57 } | 54 } |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 } // namespace nacl | 57 } // namespace nacl |
| 61 } // namespace mojo | 58 } // namespace mojo |
| 62 | 59 |
| 63 MojoResult MojoMain(MojoHandle application_request) { | 60 MojoResult MojoMain(MojoHandle application_request) { |
| 64 mojo::ApplicationRunner runner(std::unique_ptr<mojo::nacl::MultiPexeCompiler>( | 61 mojo::nacl::MultiPexeCompiler multi_pexe_compiler; |
| 65 new mojo::nacl::MultiPexeCompiler())); | 62 return mojo::RunMainApplication(application_request, &multi_pexe_compiler); |
| 66 return runner.Run(application_request); | |
| 67 } | 63 } |
| OLD | NEW |