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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a 3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file. 4 * BSD-style license that can be found in the LICENSE file.
5 */ 5 */
6 6
7 #ifndef INCLUDE_DART_API_H_ 7 #ifndef INCLUDE_DART_API_H_
8 #define INCLUDE_DART_API_H_ 8 #define INCLUDE_DART_API_H_
9 9
10 /** \mainpage Dart Embedding API Reference 10 /** \mainpage Dart Embedding API Reference
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #else 58 #else
59 #define DART_EXPORT DART_EXTERN_C 59 #define DART_EXPORT DART_EXTERN_C
60 #endif 60 #endif
61 #else 61 #else
62 #error Tool chain not supported. 62 #error Tool chain not supported.
63 #endif 63 #endif
64 #endif 64 #endif
65 65
66 #include <assert.h> 66 #include <assert.h>
67 67
68
69 /*
70 * ========
71 * Isolates
72 * ========
73 */
74
75 /**
76 * A port is used to send or receive inter-isolate messages. It is also used
77 * to identify an isolate (see Dart_Isolate).
78 */
79 typedef int64_t Dart_Port;
80
81
82 /**
83 * An isolate is the unit of concurrency in Dart. Each isolate has
84 * its own memory and thread of control. No state is shared between
85 * isolates. Instead, isolates communicate by message passing.
86 *
87 * Each thread keeps track of its current isolate, which is the
88 * isolate which is ready to execute on the current thread. The
89 * current isolate may be ILLEGAL_ISOLATE, in which case no isolate is ready to
90 * execute. Most of the Dart apis require there to be a current
91 * isolate in order to function without error. The current isolate is
92 * set by any call to Dart_CreateIsolate or Dart_EnterIsolate.
93 */
94 typedef Dart_Port Dart_Isolate;
95
96 /**
97 * ILLEGAL_ISOLATE is an isolate id that is guaranteed never to be associated
98 * with a valid isolate.
99 */
100 #define ILLEGAL_ISOLATE ((Dart_Isolate) 0)
Ivan Posva 2015/05/11 04:50:15 Should probably be DART_ILLEGAL_ISOLATE to reduce
Cutch 2015/05/12 03:21:28 Done and done.
101
68 /* 102 /*
69 * ======= 103 * =======
70 * Handles 104 * Handles
71 * ======= 105 * =======
72 */ 106 */
73 107
74 /** 108 /**
75 * An isolate is the unit of concurrency in Dart. Each isolate has
76 * its own memory and thread of control. No state is shared between
77 * isolates. Instead, isolates communicate by message passing.
78 *
79 * Each thread keeps track of its current isolate, which is the
80 * isolate which is ready to execute on the current thread. The
81 * current isolate may be NULL, in which case no isolate is ready to
82 * execute. Most of the Dart apis require there to be a current
83 * isolate in order to function without error. The current isolate is
84 * set by any call to Dart_CreateIsolate or Dart_EnterIsolate.
85 */
86 typedef struct _Dart_Isolate* Dart_Isolate;
87
88 /**
89 * An object reference managed by the Dart VM garbage collector. 109 * An object reference managed by the Dart VM garbage collector.
90 * 110 *
91 * Because the garbage collector may move objects, it is unsafe to 111 * Because the garbage collector may move objects, it is unsafe to
92 * refer to objects directly. Instead, we refer to objects through 112 * refer to objects directly. Instead, we refer to objects through
93 * handles, which are known to the garbage collector and updated 113 * handles, which are known to the garbage collector and updated
94 * automatically when the object is moved. Handles should be passed 114 * automatically when the object is moved. Handles should be passed
95 * by value (except in cases like out-parameters) and should never be 115 * by value (except in cases like out-parameters) and should never be
96 * allocated on the heap. 116 * allocated on the heap.
97 * 117 *
98 * Most functions in the Dart Embedding API return a handle. When a 118 * Most functions in the Dart Embedding API return a handle. When a
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate); 1076 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate);
1057 1077
1058 1078
1059 /* 1079 /*
1060 * ================== 1080 * ==================
1061 * Messages and Ports 1081 * Messages and Ports
1062 * ================== 1082 * ==================
1063 */ 1083 */
1064 1084
1065 /** 1085 /**
1066 * A port is used to send or receive inter-isolate messages
1067 */
1068 typedef int64_t Dart_Port;
1069
1070 /**
1071 * ILLEGAL_PORT is a port number guaranteed never to be associated with a valid 1086 * ILLEGAL_PORT is a port number guaranteed never to be associated with a valid
1072 * port. 1087 * port.
1073 */ 1088 */
1074 #define ILLEGAL_PORT ((Dart_Port) 0) 1089 #define ILLEGAL_PORT ((Dart_Port) 0)
1075 1090
1076 /** 1091 /**
1077 * A message notification callback. 1092 * A message notification callback.
1078 * 1093 *
1079 * This callback allows the embedder to provide an alternate wakeup 1094 * This callback allows the embedder to provide an alternate wakeup
1080 * mechanism for the delivery of inter-isolate messages. It is the 1095 * mechanism for the delivery of inter-isolate messages. It is the
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
2844 * NOTE: If multiple callbacks with the same name are registered, only the 2859 * NOTE: If multiple callbacks with the same name are registered, only the
2845 * last callback registered will be remembered. 2860 * last callback registered will be remembered.
2846 */ 2861 */
2847 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 2862 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
2848 const char* name, 2863 const char* name,
2849 Dart_ServiceRequestCallback callback, 2864 Dart_ServiceRequestCallback callback,
2850 void* user_data); 2865 void* user_data);
2851 2866
2852 2867
2853 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2868 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698