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

Unified Diff: mojo/public/system/core_private.cc

Issue 106173003: Split mojo_system dylib into public and private (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win Created 7 years 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/public/system/core_private.cc
diff --git a/mojo/public/system/core_private.cc b/mojo/public/system/core_private.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c3c8823ced2815954c4862bc3a2b4e0ec8ad2d0f
--- /dev/null
+++ b/mojo/public/system/core_private.cc
@@ -0,0 +1,77 @@
+// Copyright 2013 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/public/system/core_private.h"
+
+#include <assert.h>
+
+static mojo::Core* g_core = 0;
viettrungluu 2013/12/09 22:04:25 Nit: We usually use NULL (which may necessitate in
abarth-chromium 2013/12/09 22:48:34 Done.
+
+extern "C" {
+
+MojoResult MojoClose(MojoHandle handle) {
viettrungluu 2013/12/09 19:25:59 Can't we just replace these with function pointers
abarth-chromium 2013/12/09 21:19:34 We could do that. What would we gain by doing tha
+ assert(g_core);
+ return g_core->Close(handle);
+}
+
+MojoResult MojoWait(MojoHandle handle,
+ MojoWaitFlags flags,
+ MojoDeadline deadline) {
+ assert(g_core);
+ return g_core->Wait(handle, flags, deadline);
+}
+
+MojoResult MojoWaitMany(const MojoHandle* handles,
+ const MojoWaitFlags* flags,
+ uint32_t num_handles,
+ MojoDeadline deadline) {
+ assert(g_core);
+ return g_core->WaitMany(handles, flags, num_handles, deadline);
+}
+
+MojoResult MojoCreateMessagePipe(MojoHandle* handle_0, MojoHandle* handle_1) {
+ assert(g_core);
+ return g_core->CreateMessagePipe(handle_0, handle_1);
+}
+
+MojoResult MojoWriteMessage(MojoHandle handle,
+ const void* bytes, uint32_t num_bytes,
+ const MojoHandle* handles, uint32_t num_handles,
+ MojoWriteMessageFlags flags) {
+ assert(g_core);
+ return g_core->WriteMessage(handle,
+ bytes, num_bytes,
+ handles, num_handles,
+ flags);
+}
+
+MojoResult MojoReadMessage(MojoHandle handle,
+ void* bytes, uint32_t* num_bytes,
+ MojoHandle* handles, uint32_t* num_handles,
+ MojoReadMessageFlags flags) {
+ assert(g_core);
+ return g_core->ReadMessage(handle,
+ bytes, num_bytes,
+ handles, num_handles,
+ flags);
+}
+
+MojoTimeTicks MojoGetTimeTicksNow() {
+ assert(g_core);
+ return g_core->GetTimeTicksNow();
+}
+
+} // extern "C"
+
+namespace mojo {
+
+Core::~Core() {
+}
+
+void Core::Init(Core* core) {
+ assert(!g_core);
+ g_core = core;
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698