Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: services/nacl/nonsfi/content_handler_main_pexe.cc

Issue 1660403003: Mojo C++ bindings: Rename InterfaceInfoPtr -> InterfaceHandle (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: using {{InterfaceName}}Handle = InterfaceHandle<{{InterfaceName}}> Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <fcntl.h> 5 #include <fcntl.h>
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "mojo/application/application_runner_chromium.h" 10 #include "mojo/application/application_runner_chromium.h"
(...skipping 10 matching lines...) Expand all
21 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" 21 #include "services/nacl/nonsfi/pnacl_compile.mojom.h"
22 #include "services/nacl/nonsfi/pnacl_link.mojom.h" 22 #include "services/nacl/nonsfi/pnacl_link.mojom.h"
23 23
24 namespace nacl { 24 namespace nacl {
25 namespace content_handler { 25 namespace content_handler {
26 namespace { 26 namespace {
27 27
28 class CompilerUI { 28 class CompilerUI {
29 public: 29 public:
30 explicit CompilerUI(mojo::ScopedMessagePipeHandle handle) { 30 explicit CompilerUI(mojo::ScopedMessagePipeHandle handle) {
31 compiler_.Bind(mojo::InterfacePtrInfo<mojo::nacl::PexeCompiler>( 31 compiler_.Bind(
32 handle.Pass(), 0u)); 32 mojo::InterfaceHandle<mojo::nacl::PexeCompiler>(handle.Pass(), 0u));
33 } 33 }
34 34
35 // Synchronous method to compile pexe into object file. 35 // Synchronous method to compile pexe into object file.
36 mojo::Array<mojo::String> CompilePexe(mojo::String pexe_file_path) { 36 mojo::Array<mojo::String> CompilePexe(mojo::String pexe_file_path) {
37 mojo::Array<mojo::String> output; 37 mojo::Array<mojo::String> output;
38 compiler_->PexeCompile( 38 compiler_->PexeCompile(
39 pexe_file_path, 39 pexe_file_path,
40 [&output](mojo::Array<mojo::String> o) { output = o.Pass(); }); 40 [&output](mojo::Array<mojo::String> o) { output = o.Pass(); });
41 CHECK(compiler_.WaitForIncomingResponse()) 41 CHECK(compiler_.WaitForIncomingResponse())
42 << "Waiting for pexe compiler failed"; 42 << "Waiting for pexe compiler failed";
43 return output; 43 return output;
44 } 44 }
45 45
46 private: 46 private:
47 mojo::nacl::PexeCompilerPtr compiler_; 47 mojo::nacl::PexeCompilerPtr compiler_;
48 }; 48 };
49 49
50 class LinkerUI { 50 class LinkerUI {
51 public: 51 public:
52 explicit LinkerUI(mojo::ScopedMessagePipeHandle handle) { 52 explicit LinkerUI(mojo::ScopedMessagePipeHandle handle) {
53 linker_.Bind(mojo::InterfacePtrInfo<mojo::nacl::PexeLinker>( 53 linker_.Bind(
54 handle.Pass(), 0u)); 54 mojo::InterfaceHandle<mojo::nacl::PexeLinker>(handle.Pass(), 0u));
55 } 55 }
56 56
57 // Synchronous method to link object file into nexe. 57 // Synchronous method to link object file into nexe.
58 mojo::String LinkPexe(mojo::Array<mojo::String> object_file_paths) { 58 mojo::String LinkPexe(mojo::Array<mojo::String> object_file_paths) {
59 mojo::String output; 59 mojo::String output;
60 linker_->PexeLink(std::move(object_file_paths), 60 linker_->PexeLink(std::move(object_file_paths),
61 [&output](mojo::String o) { output = o; }); 61 [&output](mojo::String o) { output = o; });
62 CHECK(linker_.WaitForIncomingResponse()) 62 CHECK(linker_.WaitForIncomingResponse())
63 << "Waiting for pexe linker failed"; 63 << "Waiting for pexe linker failed";
64 return output; 64 return output;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 }; 210 };
211 211
212 } // namespace content_handler 212 } // namespace content_handler
213 } // namespace nacl 213 } // namespace nacl
214 214
215 MojoResult MojoMain(MojoHandle application_request) { 215 MojoResult MojoMain(MojoHandle application_request) {
216 mojo::ApplicationRunnerChromium runner( 216 mojo::ApplicationRunnerChromium runner(
217 new nacl::content_handler::PexeContentHandler()); 217 new nacl::content_handler::PexeContentHandler());
218 return runner.Run(application_request); 218 return runner.Run(application_request);
219 } 219 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698