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

Side by Side Diff: runtime/include/dart_api.h

Issue 8297004: Allow embedders to provide custom message delivery for an isolate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « no previous file | runtime/lib/isolate.cc » ('j') | runtime/vm/isolate.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef INCLUDE_DART_API_H_ 5 #ifndef INCLUDE_DART_API_H_
6 #define INCLUDE_DART_API_H_ 6 #define INCLUDE_DART_API_H_
7 7
8 #ifdef __cplusplus 8 #ifdef __cplusplus
9 #define DART_EXTERN_C extern "C" 9 #define DART_EXTERN_C extern "C"
10 #else 10 #else
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 typedef enum { 72 typedef enum {
73 kLibraryTag = 0, 73 kLibraryTag = 0,
74 kImportTag, 74 kImportTag,
75 kSourceTag, 75 kSourceTag,
76 kCanonicalizeUrl, 76 kCanonicalizeUrl,
77 } Dart_LibraryTag; 77 } Dart_LibraryTag;
78 78
79 typedef void Dart_Snapshot; 79 typedef void Dart_Snapshot;
80 80
81 typedef int64_t Dart_Port; 81 typedef int64_t Dart_Port;
82 typedef void* Dart_Message;
82 83
83 // Allow the embedder to intercept isolate creation. Both at startup and when 84 // Allow the embedder to intercept isolate creation. Both at startup
84 // spawning new isolates from Dart code. 85 // and when spawning new isolates from Dart code. The result returned
siva 2011/10/14 21:01:52 extra space between . and The
turnidge 2011/10/14 23:08:02 Done.
85 // The result returned from this callback is handed to all isolates spawned 86 // from this callback is handed to all isolates spawned from the
86 // from the isolate currently being initialized. 87 // isolate currently being initialized.
87 // Return NULL if an error is encountered. The isolate being initialized will 88 //
88 // be shutdown. No Dart code will execute in before it is shutdown. 89 // Return NULL if an error is encountered. The isolate being
90 // initialized will be shutdown. No Dart code will execute before it
91 // is shutdown.
92 //
89 // TODO(iposva): Pass a specification of the app file being spawned. 93 // TODO(iposva): Pass a specification of the app file being spawned.
90 typedef void* (*Dart_IsolateInitCallback)(void* data); 94 typedef void* (*Dart_IsolateInitCallback)(void* data);
91 95
92 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); 96 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments);
93 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, 97 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name,
94 int num_of_arguments); 98 int num_of_arguments);
95 typedef Dart_Result (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, 99 typedef Dart_Result (*Dart_LibraryTagHandler)(Dart_LibraryTag tag,
96 Dart_Handle library, 100 Dart_Handle library,
97 Dart_Handle url); 101 Dart_Handle url);
98 102
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 187
184 // Isolate handling. 188 // Isolate handling.
185 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, 189 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot,
186 void* data); 190 void* data);
187 DART_EXPORT void Dart_ShutdownIsolate(); 191 DART_EXPORT void Dart_ShutdownIsolate();
188 192
189 DART_EXPORT Dart_Isolate Dart_CurrentIsolate(); 193 DART_EXPORT Dart_Isolate Dart_CurrentIsolate();
190 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate); 194 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
191 DART_EXPORT void Dart_ExitIsolate(); 195 DART_EXPORT void Dart_ExitIsolate();
192 196
193 DART_EXPORT Dart_Result Dart_RunLoop(); 197 DART_EXPORT Dart_Result Dart_RunLoop();
siva 2011/10/14 21:01:52 I am wondering if we should add a comment to this
turnidge 2011/10/14 23:08:02 Done.
194 198
199 // Messages/ports
200
201 // A post message callback allows the embedder to provide an alternate
202 // delivery mechanism for inter-isolate messages. The callback is
203 // must eventually cause Dart_HandleMessage to be called to process
siva 2011/10/14 21:01:52 "callback is must eventually" seems incorrect.
turnidge 2011/10/14 23:08:02 Done.
204 // the message.
205 typedef bool (*Dart_PostMessageCallback)(Dart_Isolate dest_isolate,
206 Dart_Port dest_port,
207 Dart_Port reply_port,
208 Dart_Message message);
209
210 // Allow embedders to provide an alternate delivery mechanism for
211 // inter-isolate messages. This setting only applies to the current
212 // isolate.
213 DART_EXPORT void Dart_SetPostMessageCallback(Dart_PostMessageCallback callback);
214
215 // A close port callback allows the embedder to receive notification
216 // when a port is closed. The constant 'kCloseAllPorts' is passed
217 // when all active ports are being closed at once.
218 typedef void (*Dart_ClosePortCallback)(Dart_Isolate isolate,
219 Dart_Port port);
220 const Dart_Port kCloseAllPorts = 0;
221
222 // Allow embedder to receive notification when a port is closed. This
223 // settign only applies to the current isolate.
siva 2011/10/14 21:01:52 *settign*setting
turnidge 2011/10/14 23:08:02 Done.
224 DART_EXPORT void Dart_SetClosePortCallback(Dart_ClosePortCallback callback);
225
226 // Directly handle a message on the current isolate.
siva 2011/10/14 21:01:52 "Handle a message.."? not sure what Directly handl
turnidge 2011/10/14 23:08:02 "Directly" meant "immediately", as opposed to queu
227 DART_EXPORT void Dart_HandleMessage(Dart_Port dest_port,
228 Dart_Port reply_port,
229 Dart_Message dart_message);
230
195 231
196 // Object. 232 // Object.
197 DART_EXPORT Dart_Result Dart_ObjectToString(Dart_Handle object); 233 DART_EXPORT Dart_Result Dart_ObjectToString(Dart_Handle object);
198 DART_EXPORT bool Dart_IsNull(Dart_Handle object); 234 DART_EXPORT bool Dart_IsNull(Dart_Handle object);
199 235
200 236
201 // Returns true if the two objects are equal. 237 // Returns true if the two objects are equal.
202 DART_EXPORT Dart_Result Dart_Objects_Equal(Dart_Handle obj1, Dart_Handle obj2); 238 DART_EXPORT Dart_Result Dart_Objects_Equal(Dart_Handle obj1, Dart_Handle obj2);
203 239
204 240
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // External pprof support for gathering and dumping symbolic information 422 // External pprof support for gathering and dumping symbolic information
387 // that can be used for better profile reports for dynamically generated 423 // that can be used for better profile reports for dynamically generated
388 // code. 424 // code.
389 DART_EXPORT void Dart_InitPprofSupport(); 425 DART_EXPORT void Dart_InitPprofSupport();
390 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); 426 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size);
391 427
392 // Check set vm flags. 428 // Check set vm flags.
393 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); 429 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name);
394 430
395 #endif // INCLUDE_DART_API_H_ 431 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/isolate.cc » ('j') | runtime/vm/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698