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

Unified Diff: mojo/nacl/irt_mojo_nonsfi.cc

Issue 1323823002: Adding nonsfi content handler (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Respond to code review, git cl format Created 5 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
Index: mojo/nacl/irt_mojo_nonsfi.cc
diff --git a/mojo/nacl/irt_mojo_nonsfi.cc b/mojo/nacl/irt_mojo_nonsfi.cc
new file mode 100644
index 0000000000000000000000000000000000000000..80039f1d0911170a60684e213d592faf43a2d685
--- /dev/null
+++ b/mojo/nacl/irt_mojo_nonsfi.cc
@@ -0,0 +1,63 @@
+// Copyright 2015 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/irt_mojo_nonsfi.h"
+
+#include "mojo/public/c/system/functions.h"
+#include "mojo/public/platform/nacl/mojo_irt.h"
+#include "native_client/src/public/irt_core.h"
+
+namespace {
+
+MojoHandle g_mojo_handle = MOJO_HANDLE_INVALID;
+
+MojoResult _MojoGetInitialHandle(MojoHandle* handle) {
+ *handle = g_mojo_handle;
+ return MOJO_RESULT_OK;
+}
+
+const struct nacl_irt_mojo kIrtMojo = {
+ MojoCreateSharedBuffer,
+ MojoDuplicateBufferHandle,
+ MojoMapBuffer,
+ MojoUnmapBuffer,
+ MojoCreateDataPipe,
+ MojoWriteData,
+ MojoBeginWriteData,
+ MojoEndWriteData,
+ MojoReadData,
+ MojoBeginReadData,
+ MojoEndReadData,
+ MojoGetTimeTicksNow,
+ MojoClose,
+ MojoWait,
+ MojoWaitMany,
+ MojoCreateMessagePipe,
+ MojoWriteMessage,
+ MojoReadMessage,
+ _MojoGetInitialHandle,
+};
+
+const struct nacl_irt_interface kIrtInterfaces[] = {
+ {NACL_IRT_MOJO_v0_1, &kIrtMojo, sizeof(kIrtMojo), nullptr}};
+
+} // namespace
+
+namespace irtNonsfi {
+
+void MojoSetInitialHandle(MojoHandle handle) {
+ g_mojo_handle = handle;
+}
+
+size_t MojoIrtNonsfiQuery(const char* interface_ident,
+ void* table,
+ size_t tablesize) {
+ size_t result = nacl_irt_query_list(interface_ident, table, tablesize,
+ kIrtInterfaces, sizeof(kIrtInterfaces));
+ if (result != 0)
+ return result;
+ return nacl_irt_query_core(interface_ident, table, tablesize);
+}
+
+} // namespace irtNonsfi

Powered by Google App Engine
This is Rietveld 408576698