| 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" | |
| 15 #include "mojo/public/cpp/bindings/strong_binding.h" | 14 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 16 #include "services/nacl/nonsfi/kPnaclTranslatorCompile.h" | 15 #include "services/nacl/nonsfi/kPnaclTranslatorCompile.h" |
| 17 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" | 16 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" |
| 18 | 17 |
| 19 namespace mojo { | 18 namespace mojo { |
| 20 namespace nacl { | 19 namespace nacl { |
| 21 | 20 |
| 22 class PexeCompilerImpl : public PexeCompilerInit { | 21 class PexeCompilerImpl : public PexeCompilerInit { |
| 23 public: | 22 public: |
| 24 void PexeCompilerStart( | 23 void PexeCompilerStart( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 class StrongBindingPexeCompilerImpl : public PexeCompilerImpl { | 34 class StrongBindingPexeCompilerImpl : public PexeCompilerImpl { |
| 36 public: | 35 public: |
| 37 explicit StrongBindingPexeCompilerImpl(InterfaceRequest<PexeCompilerInit> | 36 explicit StrongBindingPexeCompilerImpl(InterfaceRequest<PexeCompilerInit> |
| 38 request) | 37 request) |
| 39 : strong_binding_(this, request.Pass()) {} | 38 : strong_binding_(this, request.Pass()) {} |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 StrongBinding<PexeCompilerInit> strong_binding_; | 41 StrongBinding<PexeCompilerInit> strong_binding_; |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 class MultiPexeCompiler : public ApplicationDelegate, | 44 class MultiPexeCompiler : public ApplicationDelegate { |
| 46 public InterfaceFactory<PexeCompilerInit> { | |
| 47 public: | 45 public: |
| 48 MultiPexeCompiler() {} | 46 MultiPexeCompiler() {} |
| 49 | 47 |
| 50 // From ApplicationDelegate | 48 // From ApplicationDelegate |
| 51 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 49 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
| 52 connection->AddService<PexeCompilerInit>(this); | 50 connection->GetServiceProviderImpl().AddService<PexeCompilerInit>( |
| 51 [](const ConnectionContext& connection_context, |
| 52 InterfaceRequest<PexeCompilerInit> request) { |
| 53 new StrongBindingPexeCompilerImpl(request.Pass()); |
| 54 }); |
| 53 return true; | 55 return true; |
| 54 } | 56 } |
| 55 | |
| 56 // From InterfaceFactory | |
| 57 void Create(const ConnectionContext& connection_context, | |
| 58 InterfaceRequest<PexeCompilerInit> request) override { | |
| 59 new StrongBindingPexeCompilerImpl(request.Pass()); | |
| 60 } | |
| 61 }; | 57 }; |
| 62 | 58 |
| 63 } // namespace nacl | 59 } // namespace nacl |
| 64 } // namespace mojo | 60 } // namespace mojo |
| 65 | 61 |
| 66 MojoResult MojoMain(MojoHandle application_request) { | 62 MojoResult MojoMain(MojoHandle application_request) { |
| 67 mojo::ApplicationRunner runner(std::unique_ptr<mojo::nacl::MultiPexeCompiler>( | 63 mojo::ApplicationRunner runner(std::unique_ptr<mojo::nacl::MultiPexeCompiler>( |
| 68 new mojo::nacl::MultiPexeCompiler())); | 64 new mojo::nacl::MultiPexeCompiler())); |
| 69 return runner.Run(application_request); | 65 return runner.Run(application_request); |
| 70 } | 66 } |
| OLD | NEW |