Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 /** \mainpage Dart Embedding API Reference | 8 /** \mainpage Dart Embedding API Reference |
| 9 * | 9 * |
| 10 * Dart is a class-based programming language for creating structured | 10 * Dart is a class-based programming language for creating structured |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 * otherwise indicated, callers should assume that all functions in | 88 * otherwise indicated, callers should assume that all functions in |
| 89 * the Dart embedding api return local handles. | 89 * the Dart embedding api return local handles. |
| 90 * | 90 * |
| 91 * Persistent handles are allocated within the current isolate. They | 91 * Persistent handles are allocated within the current isolate. They |
| 92 * can be used to store objects across scopes. Persistent handles have | 92 * can be used to store objects across scopes. Persistent handles have |
| 93 * the lifetime of the current isolate unless they are explicitly | 93 * the lifetime of the current isolate unless they are explicitly |
| 94 * deallocated (see Dart_DeletePersistentHandle). | 94 * deallocated (see Dart_DeletePersistentHandle). |
| 95 */ | 95 */ |
| 96 typedef struct _Dart_Handle* Dart_Handle; | 96 typedef struct _Dart_Handle* Dart_Handle; |
| 97 | 97 |
| 98 typedef void (*Dart_PeerFinalizer)(void* peer); | |
|
Ivan Posva
2011/12/20 01:32:34
As discussed we should add the Dart_Handle to this
| |
| 99 | |
| 98 /** | 100 /** |
| 99 * Is this an error handle? | 101 * Is this an error handle? |
| 100 * | 102 * |
| 101 * Requires there to be a current isolate. | 103 * Requires there to be a current isolate. |
| 102 */ | 104 */ |
| 103 DART_EXPORT bool Dart_IsError(const Dart_Handle& handle); | 105 DART_EXPORT bool Dart_IsError(const Dart_Handle& handle); |
| 104 | 106 |
| 105 /** | 107 /** |
| 106 * Gets the error message from an error handle. | 108 * Gets the error message from an error handle. |
| 107 * | 109 * |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object); | 199 DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object); |
| 198 | 200 |
| 199 /** | 201 /** |
| 200 * Deallocates a persistent handle. | 202 * Deallocates a persistent handle. |
| 201 * | 203 * |
| 202 * Requires there to be a current isolate. | 204 * Requires there to be a current isolate. |
| 203 */ | 205 */ |
| 204 DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object); | 206 DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object); |
| 205 | 207 |
| 206 /** | 208 /** |
| 207 * Takes a persistent handle and makes it weak. | 209 * Allocates a weak persistent handle for an object. |
| 208 * | 210 * |
| 209 * UNIMPLEMENTED. | 211 * This handle has the lifetime of the current isolate unless it is |
| 212 * explicitly deallocated by calling Dart_DeletePersistentHandle. | |
| 210 * | 213 * |
| 211 * Requires there to be a current isolate. | 214 * Requires there to be a current isolate. |
| 212 */ | 215 */ |
| 213 DART_EXPORT Dart_Handle Dart_MakeWeakPersistentHandle(Dart_Handle object); | 216 DART_EXPORT Dart_Handle Dart_NewWeakPersistentHandle( |
| 214 // TODO(turnidge): Needs a "near death" callback here. | 217 Dart_Handle object, |
| 215 // TODO(turnidge): Add IsWeak, Clear, etc. | 218 void* peer, |
| 219 Dart_PeerFinalizer callback); | |
| 216 | 220 |
| 217 /** | 221 /** |
| 218 * Takes a weak persistent handle and makes it non-weak. | 222 * Is this object a weak persistent handle? |
| 219 * | |
| 220 * UNIMPLEMENTED. | |
| 221 * | 223 * |
| 222 * Requires there to be a current isolate. | 224 * Requires there to be a current isolate. |
| 223 */ | 225 */ |
| 224 DART_EXPORT Dart_Handle Dart_MakePersistentHandle(Dart_Handle object); | 226 DART_EXPORT bool Dart_IsWeakPersistentHandle(Dart_Handle object); |
| 225 | 227 |
| 226 // --- Initialization and Globals --- | 228 // --- Initialization and Globals --- |
| 227 | 229 |
| 228 /** | 230 /** |
| 229 * An isolate creation and initialization callback function. | 231 * An isolate creation and initialization callback function. |
| 230 * | 232 * |
| 231 * This callback, provided by the embedder, is called when an isolate needs | 233 * This callback, provided by the embedder, is called when an isolate needs |
| 232 * to be created. The callback should create an isolate and load the | 234 * to be created. The callback should create an isolate and load the |
| 233 * required scripts for execution. | 235 * required scripts for execution. |
| 234 * | 236 * |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 * | 880 * |
| 879 * \param value An array of 32-bit codepoints. | 881 * \param value An array of 32-bit codepoints. |
| 880 * \param length The length of the codepoints array. | 882 * \param length The length of the codepoints array. |
| 881 * | 883 * |
| 882 * \return The String object if no error occurs. Otherwise returns | 884 * \return The String object if no error occurs. Otherwise returns |
| 883 * an error handle. | 885 * an error handle. |
| 884 */ | 886 */ |
| 885 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints, | 887 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints, |
| 886 intptr_t length); | 888 intptr_t length); |
| 887 | 889 |
| 888 | |
| 889 typedef void (*Dart_PeerFinalizer)(void* peer); | |
| 890 | |
| 891 /** | 890 /** |
| 892 * Is this object an external String? | 891 * Is this object an external String? |
| 893 * | 892 * |
| 894 * An external String is a String which references a fixed array of | 893 * An external String is a String which references a fixed array of |
| 895 * codepoints which is external to the Dart heap. | 894 * codepoints which is external to the Dart heap. |
| 896 */ | 895 */ |
| 897 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object); | 896 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object); |
| 898 | 897 |
| 899 /** | 898 /** |
| 900 * Retrieves the peer pointer associated with an external String. | 899 * Retrieves the peer pointer associated with an external String. |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 | 1384 |
| 1386 // --- Profiling support ---- | 1385 // --- Profiling support ---- |
| 1387 | 1386 |
| 1388 // External pprof support for gathering and dumping symbolic | 1387 // External pprof support for gathering and dumping symbolic |
| 1389 // information that can be used for better profile reports for | 1388 // information that can be used for better profile reports for |
| 1390 // dynamically generated code. | 1389 // dynamically generated code. |
| 1391 DART_EXPORT void Dart_InitPprofSupport(); | 1390 DART_EXPORT void Dart_InitPprofSupport(); |
| 1392 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 1391 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 1393 | 1392 |
| 1394 #endif // INCLUDE_DART_API_H_ | 1393 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |