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

Unified Diff: mojo/public/c/system/thunks.h

Issue 2750373002: Revert of Mojo: Armed Watchers (Closed)
Patch Set: Created 3 years, 9 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/public/c/system/functions.h ('k') | mojo/public/c/system/thunks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/c/system/thunks.h
diff --git a/mojo/public/c/system/thunks.h b/mojo/public/c/system/thunks.h
index 31d22890ff820b824b8285df51e91b43d87ee365..161faf135097ec2973943bf0a85c01d4f5d0d487 100644
--- a/mojo/public/c/system/thunks.h
+++ b/mojo/public/c/system/thunks.h
@@ -13,10 +13,28 @@
#include "mojo/public/c/system/core.h"
#include "mojo/public/c/system/system_export.h"
-// Structure used to bind the basic Mojo Core functions to an embedder
-// implementation. This is intended to eventually be used as a stable ABI
-// between a Mojo embedder and some loaded application code, but for now it is
-// still effectively safe to rearrange entries as needed.
+// The embedder needs to bind the basic Mojo Core functions of a DSO to those of
+// the embedder when loading a DSO that is dependent on mojo_system.
+// The typical usage would look like:
+// base::ScopedNativeLibrary app_library(
+// base::LoadNativeLibrary(app_path_, &error));
+// typedef MojoResult (*MojoSetSystemThunksFn)(MojoSystemThunks*);
+// MojoSetSystemThunksFn mojo_set_system_thunks_fn =
+// reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
+// "MojoSetSystemThunks"));
+// MojoSystemThunks system_thunks = MojoMakeSystemThunks();
+// size_t expected_size = mojo_set_system_thunks_fn(&system_thunks);
+// if (expected_size > sizeof(MojoSystemThunks)) {
+// LOG(ERROR)
+// << "Invalid DSO. Expected MojoSystemThunks size: "
+// << expected_size;
+// break;
+// }
+
+// Structure used to bind the basic Mojo Core functions of a DSO to those of
+// the embedder.
+// This is the ABI between the embedder and the DSO. It can only have new
+// functions added to the end. No other changes are supported.
#pragma pack(push, 8)
struct MojoSystemThunks {
size_t size; // Should be set to sizeof(MojoSystemThunks).
@@ -97,18 +115,11 @@
MojoHandle* handles,
MojoResult* results,
struct MojoHandleSignalsState* signals_states);
- MojoResult (*CreateWatcher)(MojoWatcherCallback callback,
- MojoHandle* watcher_handle);
- MojoResult (*Watch)(MojoHandle watcher_handle,
- MojoHandle handle,
+ MojoResult (*Watch)(MojoHandle handle,
MojoHandleSignals signals,
+ MojoWatchCallback callback,
uintptr_t context);
- MojoResult (*CancelWatch)(MojoHandle watcher_handle, uintptr_t context);
- MojoResult (*ArmWatcher)(MojoHandle watcher_handle,
- uint32_t* num_ready_contexts,
- uintptr_t* ready_contexts,
- MojoResult* ready_results,
- MojoHandleSignalsState* ready_signals_states);
+ MojoResult (*CancelWatch)(MojoHandle handle, uintptr_t context);
MojoResult (*FuseMessagePipes)(MojoHandle handle0, MojoHandle handle1);
MojoResult (*WriteMessageNew)(MojoHandle message_pipe_handle,
MojoMessageHandle message,
« no previous file with comments | « mojo/public/c/system/functions.h ('k') | mojo/public/c/system/thunks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698