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

Side by Side Diff: mojo/nacl/monacl_sel_main.cc

Issue 884303002: Launch nexes from mojo_shell. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Whitepace Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/nacl/monacl_sel_main.h" 5 #include "mojo/nacl/monacl_sel_main.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "mojo/nacl/mojo_syscall.h" 9 #include "mojo/nacl/mojo_syscall.h"
10 #include "native_client/src/public/chrome_main.h" 10 #include "native_client/src/public/chrome_main.h"
11 #include "native_client/src/public/nacl_app.h" 11 #include "native_client/src/public/nacl_app.h"
12 #include "native_client/src/trusted/desc/nacl_desc_io.h" 12 #include "native_client/src/trusted/desc/nacl_desc_io.h"
13 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" 13 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 16
17 void LaunchNaCl(const char* nexe_file, const char* irt_file, 17 void LaunchNaCl(const char* nexe_file, const char* irt_file,
18 int app_argc, char* app_argv[]) { 18 int app_argc, char* app_argv[], MojoHandle handle) {
19 NaClChromeMainInit(); 19 NaClChromeMainInit();
20 20
21 // Open the IRT. 21 // Open the IRT.
22 struct NaClDesc* irt_desc = (struct NaClDesc*) NaClDescIoDescOpen( 22 struct NaClDesc* irt_desc = (struct NaClDesc*) NaClDescIoDescOpen(
23 irt_file, NACL_ABI_O_RDONLY, 0); 23 irt_file, NACL_ABI_O_RDONLY, 0);
24 if (NULL == irt_desc) { 24 if (NULL == irt_desc) {
25 perror(irt_file); 25 perror(irt_file);
26 exit(1); 26 exit(1);
27 } 27 }
28 28
29 // Open the main executable. 29 // Open the main executable.
30 struct NaClDesc* nexe_desc = (struct NaClDesc*) NaClDescIoDescOpen( 30 struct NaClDesc* nexe_desc = (struct NaClDesc*) NaClDescIoDescOpen(
31 nexe_file, NACL_ABI_O_RDONLY, 0); 31 nexe_file, NACL_ABI_O_RDONLY, 0);
32 if (NULL == nexe_desc) { 32 if (NULL == nexe_desc) {
33 perror(nexe_file); 33 perror(nexe_file);
34 exit(1); 34 exit(1);
35 } 35 }
36 36
37 struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate(); 37 struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate();
38 args->nexe_desc = nexe_desc; 38 args->nexe_desc = nexe_desc;
39 args->irt_desc = irt_desc; 39 args->irt_desc = irt_desc;
40 40
41 args->argc = app_argc; 41 args->argc = app_argc;
42 args->argv = app_argv; 42 args->argv = app_argv;
43 43
44 struct NaClApp* nap = NaClAppCreate(); 44 struct NaClApp* nap = NaClAppCreate();
45 InjectMojo(nap); 45 InjectMojo(nap, handle);
46 46
47 int exit_status = 1; 47 int exit_status = 1;
48 NaClChromeMainStart(nap, args, &exit_status); 48 NaClChromeMainStart(nap, args, &exit_status);
49 NaClExit(exit_status); 49 NaClExit(exit_status);
50 } 50 }
51 51
52 } // namespace mojo 52 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698