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

Unified Diff: runtime/include/dart_api.h

Issue 9169063: Add support for native ports in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Patch Set Four Rules Created 8 years, 11 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 | « no previous file | runtime/lib/isolate.cc » ('j') | runtime/lib/isolate.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/include/dart_api.h
===================================================================
--- runtime/include/dart_api.h (revision 3603)
+++ runtime/include/dart_api.h (working copy)
@@ -522,6 +522,45 @@
DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object);
/**
+ * A native message handling funciton.
siva 2012/01/28 00:21:05 function.
turnidge 2012/01/31 20:04:31 Done.
+ *
+ * This function is associated with a native port by calling
+ * Dart_NewNativePort.
siva 2012/01/28 00:21:05 Should we say: /** * A native message handler. *
turnidge 2012/01/31 20:04:31 Done.
+ */
+typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id,
+ Dart_Port reply_port_id,
+ uint8_t* data);
+// TODO(turnidge): Make this function take more appropriate arguments.
+
+/**
+ * Creates a new native port. When messages are received on this
+ * native port, then they will be dispatched to the provided native
+ * message handler.
+ *
+ * \param name The name of this port in debugging messags.
Søren Gjesse 2012/01/27 13:33:14 messags -> messages
turnidge 2012/01/31 20:04:31 Done.
+ * \param handler The C handler to run when messages arrive on the port.
+ * \param allow_concurrent Is it okay to process requests on this
+ * native port concurrently?
siva 2012/01/28 00:21:05 Would handle_concurrently be more readable than al
turnidge 2012/01/31 20:04:31 Changed.
+ *
+ * \return A port id for the native port.
+ */
+DART_EXPORT Dart_Port Dart_NewNativePort(const char* name,
+ Dart_NativeMessageHandler func,
siva 2012/01/28 00:21:05 handler instead of func?
turnidge 2012/01/31 20:04:31 Done.
+ bool allow_concurrent);
+// TODO(turnidge): Currently allow_concurrent is ignored.
+
+/**
+ * Closes the native port with the given id.
+ *
+ * The port must have been allocated by a call to Dart_NewNativePort.
+ *
+ * \param native_port_id The id of the native port to close.
siva 2012/01/28 00:21:05 s/The id/Id/
turnidge 2012/01/31 20:04:31 What's wrong with "The id"?
siva 2012/02/01 00:38:56 "The id of the native port" sounds weird, I could
turnidge 2012/02/01 18:51:26 It sounds okay to my ears. My guess is that this
+ *
+ * \return Returns true if the port was closed successfully.
+ */
+DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id);
+
+/**
* Returns a new SendPort with the provided port id.
*/
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id);
« no previous file with comments | « no previous file | runtime/lib/isolate.cc » ('j') | runtime/lib/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698