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

Unified Diff: runtime/include/dart_api.h

Issue 1130753006: Hide Isolate pointer from embedder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 | « runtime/bin/vmservice_impl.cc ('k') | runtime/include/dart_debugger_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/include/dart_api.h
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 7094b4be438cf137201308a8bb68600ad593f5d3..fcd8c2528b4b6e7d7e86857300effcbc092ba30e 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -65,25 +65,45 @@ typedef unsigned __int64 uint64_t;
#include <assert.h>
+
/*
- * =======
- * Handles
- * =======
+ * ========
+ * Isolates
+ * ========
*/
/**
+ * A port is used to send or receive inter-isolate messages. It is also used
+ * to identify an isolate (see Dart_Isolate).
+ */
+typedef int64_t Dart_Port;
+
+
+/**
* An isolate is the unit of concurrency in Dart. Each isolate has
* its own memory and thread of control. No state is shared between
* isolates. Instead, isolates communicate by message passing.
*
* Each thread keeps track of its current isolate, which is the
* isolate which is ready to execute on the current thread. The
- * current isolate may be NULL, in which case no isolate is ready to
- * execute. Most of the Dart apis require there to be a current
+ * current isolate may be DART_ILLEGAL_ISOLATE, in which case no isolate is
+ * ready to execute. Most of the Dart apis require there to be a current
* isolate in order to function without error. The current isolate is
* set by any call to Dart_CreateIsolate or Dart_EnterIsolate.
*/
-typedef struct _Dart_Isolate* Dart_Isolate;
+typedef Dart_Port Dart_Isolate;
+
+/**
+ * DART_ILLEGAL_ISOLATE is an isolate id that is guaranteed never to be associated
+ * with a valid isolate.
+ */
+#define DART_ILLEGAL_ISOLATE ((Dart_Isolate) 0)
+
+/*
+ * =======
+ * Handles
+ * =======
+ */
/**
* An object reference managed by the Dart VM garbage collector.
@@ -937,6 +957,8 @@ DART_EXPORT void* Dart_CurrentIsolateData();
* was passed to the isolate when it was created.
* The embedder is responsible for ensuring the consistency of this data
* with respect to the lifecycle of an Isolate.
+ *
+ * \return pointer to data or NULL if the isolate could not be found.
*/
DART_EXPORT void* Dart_IsolateData(Dart_Isolate isolate);
@@ -954,8 +976,10 @@ DART_EXPORT Dart_Handle Dart_DebugName();
*
* Requires there to be no current isolate. Multiple threads may not be in
* the same isolate at once.
+ *
+ * \return true if isolate was entered, false otherwise.
*/
-DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
+DART_EXPORT bool Dart_EnterIsolate(Dart_Isolate isolate);
/**
* Notifies the VM that the current isolate is about to make a blocking call.
@@ -1040,8 +1064,10 @@ DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer,
* Dart_IsolateInterruptCallback).
*
* \param isolate The isolate to be interrupted.
+ *
+ * \return true if isolate is scheduled to be be interrupted, false otherwise.
*/
-DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate);
+DART_EXPORT bool Dart_InterruptIsolate(Dart_Isolate isolate);
/**
* Make isolate runnable.
@@ -1052,6 +1078,8 @@ DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate);
* This function does not expect there to be a current isolate.
*
* \param isolate The isolate to be made runnable.
+ *
+ * \return true if isolate was made runnable, false otherwise.
*/
DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate);
@@ -1063,15 +1091,10 @@ DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate);
*/
/**
- * A port is used to send or receive inter-isolate messages
- */
-typedef int64_t Dart_Port;
-
-/**
- * ILLEGAL_PORT is a port number guaranteed never to be associated with a valid
- * port.
+ * DART_ILLEGAL_PORT is a port number guaranteed never to be associated with a
+ * valid port.
*/
-#define ILLEGAL_PORT ((Dart_Port) 0)
+#define DART_ILLEGAL_PORT ((Dart_Port) 0)
/**
* A message notification callback.
@@ -2786,8 +2809,8 @@ DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate);
/**
* Returns the port that script load requests should be sent on.
*
- * \return Returns the port for load requests or ILLEGAL_PORT if the service
- * isolate failed to startup or does not support load requests.
+ * \return Returns the port for load requests or DART_ILLEGAL_PORT if the
+ * service isolate failed to startup or does not support load requests.
*/
DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort();
« no previous file with comments | « runtime/bin/vmservice_impl.cc ('k') | runtime/include/dart_debugger_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698