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

Unified Diff: mojo/nacl/monacl_sel_main.cc

Issue 385983008: Mojo + NaCl prototype. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FinalEdits Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/nacl/monacl_sel_main.h ('k') | mojo/nacl/monacl_shell.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/nacl/monacl_sel_main.cc
diff --git a/mojo/nacl/monacl_sel_main.cc b/mojo/nacl/monacl_sel_main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4fbc5757b6992004b27587f64c6cdfd5ac6a658b
--- /dev/null
+++ b/mojo/nacl/monacl_sel_main.cc
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/nacl/monacl_sel_main.h"
+
+#include <stdio.h>
+
+#include "mojo/nacl/mojo_syscall.h"
+#include "native_client/src/public/chrome_main.h"
+#include "native_client/src/public/nacl_app.h"
+#include "native_client/src/trusted/desc/nacl_desc_io.h"
+#include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
+
+namespace mojo {
+
+void LaunchNaCl(const char* nexe_file, const char* irt_file,
+ int app_argc, char* app_argv[]) {
+ NaClChromeMainInit();
+
+ // Open the IRT.
+ struct NaClDesc* irt_desc = (struct NaClDesc*) NaClDescIoDescOpen(
+ irt_file, NACL_ABI_O_RDONLY, 0);
+ if (NULL == irt_desc) {
+ perror(irt_file);
+ exit(1);
+ }
+
+ // Open the main executable.
+ struct NaClDesc* nexe_desc = (struct NaClDesc*) NaClDescIoDescOpen(
+ nexe_file, NACL_ABI_O_RDONLY, 0);
+ if (NULL == nexe_desc) {
+ perror(nexe_file);
+ exit(1);
+ }
+
+ struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate();
+ args->nexe_desc = nexe_desc;
+ args->irt_desc = irt_desc;
+
+ args->argc = app_argc;
+ args->argv = app_argv;
+
+ struct NaClApp* nap = NaClAppCreate();
+ InjectMojo(nap);
+
+ int exit_status = 1;
+ NaClChromeMainStart(nap, args, &exit_status);
+ NaClExit(exit_status);
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/nacl/monacl_sel_main.h ('k') | mojo/nacl/monacl_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698