OLD | NEW |
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 RUNTIME_INCLUDE_DART_API_H_ | 7 #ifndef RUNTIME_INCLUDE_DART_API_H_ |
8 #define RUNTIME_INCLUDE_DART_API_H_ | 8 #define RUNTIME_INCLUDE_DART_API_H_ |
9 | 9 |
10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 DART_EXPORT Dart_WeakPersistentHandle | 521 DART_EXPORT Dart_WeakPersistentHandle |
522 Dart_NewWeakPersistentHandle(Dart_Handle object, | 522 Dart_NewWeakPersistentHandle(Dart_Handle object, |
523 void* peer, | 523 void* peer, |
524 intptr_t external_allocation_size, | 524 intptr_t external_allocation_size, |
525 Dart_WeakPersistentHandleFinalizer callback); | 525 Dart_WeakPersistentHandleFinalizer callback); |
526 | 526 |
527 DART_EXPORT void Dart_DeleteWeakPersistentHandle( | 527 DART_EXPORT void Dart_DeleteWeakPersistentHandle( |
528 Dart_Isolate isolate, | 528 Dart_Isolate isolate, |
529 Dart_WeakPersistentHandle object); | 529 Dart_WeakPersistentHandle object); |
530 | 530 |
531 | |
532 /* | 531 /* |
533 * ============================ | 532 * ============================ |
534 * Garbage Collection Callbacks | 533 * Garbage Collection Callbacks |
535 * ============================ | 534 * ============================ |
536 */ | 535 */ |
537 | 536 |
538 /** | 537 /** |
539 * Callbacks signal the beginning and end of a garbage collection. | 538 * Callbacks signal the beginning and end of a garbage collection. |
540 * | 539 * |
541 * These signals are intended to be used by the embedder to manage the | 540 * These signals are intended to be used by the embedder to manage the |
(...skipping 23 matching lines...) Expand all Loading... |
565 * is called. A NULL value removes the existing epilogue callback function | 564 * is called. A NULL value removes the existing epilogue callback function |
566 * if any. | 565 * if any. |
567 * | 566 * |
568 * \return Success if the callbacks were added. Otherwise, returns an | 567 * \return Success if the callbacks were added. Otherwise, returns an |
569 * error handle. | 568 * error handle. |
570 */ | 569 */ |
571 DART_EXPORT Dart_Handle | 570 DART_EXPORT Dart_Handle |
572 Dart_SetGcCallbacks(Dart_GcPrologueCallback prologue_callback, | 571 Dart_SetGcCallbacks(Dart_GcPrologueCallback prologue_callback, |
573 Dart_GcEpilogueCallback epilogue_callback); | 572 Dart_GcEpilogueCallback epilogue_callback); |
574 | 573 |
575 | |
576 /* | 574 /* |
577 * ========================== | 575 * ========================== |
578 * Initialization and Globals | 576 * Initialization and Globals |
579 * ========================== | 577 * ========================== |
580 */ | 578 */ |
581 | 579 |
582 /** | 580 /** |
583 * Gets the version string for the Dart VM. | 581 * Gets the version string for the Dart VM. |
584 * | 582 * |
585 * The version of the Dart VM can be accessed without initializing the VM. | 583 * The version of the Dart VM can be accessed without initializing the VM. |
586 * | 584 * |
587 * \return The version string for the embedded Dart VM. | 585 * \return The version string for the embedded Dart VM. |
588 */ | 586 */ |
589 DART_EXPORT const char* Dart_VersionString(); | 587 DART_EXPORT const char* Dart_VersionString(); |
590 | 588 |
591 | |
592 /** | 589 /** |
593 * Isolate specific flags are set when creating a new isolate using the | 590 * Isolate specific flags are set when creating a new isolate using the |
594 * Dart_IsolateFlags structure. | 591 * Dart_IsolateFlags structure. |
595 * | 592 * |
596 * Current version of flags is encoded in a 32-bit integer with 16 bits used | 593 * Current version of flags is encoded in a 32-bit integer with 16 bits used |
597 * for each part. | 594 * for each part. |
598 */ | 595 */ |
599 | 596 |
600 #define DART_FLAGS_CURRENT_VERSION (0x00000002) | 597 #define DART_FLAGS_CURRENT_VERSION (0x00000002) |
601 | 598 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 * | 838 * |
842 * \return True if VM flags set successfully. | 839 * \return True if VM flags set successfully. |
843 */ | 840 */ |
844 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); | 841 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); |
845 | 842 |
846 /** | 843 /** |
847 * Returns true if the named VM flag is set. | 844 * Returns true if the named VM flag is set. |
848 */ | 845 */ |
849 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); | 846 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); |
850 | 847 |
851 | |
852 /* | 848 /* |
853 * ======== | 849 * ======== |
854 * Isolates | 850 * Isolates |
855 * ======== | 851 * ======== |
856 */ | 852 */ |
857 | 853 |
858 /** | 854 /** |
859 * Creates a new isolate. The new isolate becomes the current isolate. | 855 * Creates a new isolate. The new isolate becomes the current isolate. |
860 * | 856 * |
861 * A snapshot can be used to restore the VM quickly to a saved state | 857 * A snapshot can be used to restore the VM quickly to a saved state |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 * | 1055 * |
1060 * When isolates are spawned this function is used to indicate that | 1056 * When isolates are spawned this function is used to indicate that |
1061 * the creation and initialization (including script loading) of the | 1057 * the creation and initialization (including script loading) of the |
1062 * isolate is complete and the isolate can start. | 1058 * isolate is complete and the isolate can start. |
1063 * This function does not expect there to be a current isolate. | 1059 * This function does not expect there to be a current isolate. |
1064 * | 1060 * |
1065 * \param isolate The isolate to be made runnable. | 1061 * \param isolate The isolate to be made runnable. |
1066 */ | 1062 */ |
1067 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate); | 1063 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate); |
1068 | 1064 |
1069 | |
1070 /* | 1065 /* |
1071 * ================== | 1066 * ================== |
1072 * Messages and Ports | 1067 * Messages and Ports |
1073 * ================== | 1068 * ================== |
1074 */ | 1069 */ |
1075 | 1070 |
1076 /** | 1071 /** |
1077 * A port is used to send or receive inter-isolate messages | 1072 * A port is used to send or receive inter-isolate messages |
1078 */ | 1073 */ |
1079 typedef int64_t Dart_Port; | 1074 typedef int64_t Dart_Port; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 DART_EXPORT bool Dart_IsPausedOnExit(); | 1183 DART_EXPORT bool Dart_IsPausedOnExit(); |
1189 | 1184 |
1190 /** | 1185 /** |
1191 * Called when the embedder has paused the current isolate on exit and when | 1186 * Called when the embedder has paused the current isolate on exit and when |
1192 * the embedder has resumed the isolate. | 1187 * the embedder has resumed the isolate. |
1193 * | 1188 * |
1194 * \param paused Is the isolate paused on exit? | 1189 * \param paused Is the isolate paused on exit? |
1195 */ | 1190 */ |
1196 DART_EXPORT void Dart_SetPausedOnExit(bool paused); | 1191 DART_EXPORT void Dart_SetPausedOnExit(bool paused); |
1197 | 1192 |
1198 | |
1199 /** | 1193 /** |
1200 * Called when the embedder has caught a top level unhandled exception error | 1194 * Called when the embedder has caught a top level unhandled exception error |
1201 * in the current isolate. | 1195 * in the current isolate. |
1202 * | 1196 * |
1203 * NOTE: It is illegal to call this twice on the same isolate without first | 1197 * NOTE: It is illegal to call this twice on the same isolate without first |
1204 * clearing the sticky error to null. | 1198 * clearing the sticky error to null. |
1205 * | 1199 * |
1206 * \param error The unhandled exception error. | 1200 * \param error The unhandled exception error. |
1207 */ | 1201 */ |
1208 DART_EXPORT void Dart_SetStickyError(Dart_Handle error); | 1202 DART_EXPORT void Dart_SetStickyError(Dart_Handle error); |
1209 | 1203 |
1210 | |
1211 /** | 1204 /** |
1212 * Does the current isolate have a sticky error? | 1205 * Does the current isolate have a sticky error? |
1213 */ | 1206 */ |
1214 DART_EXPORT bool Dart_HasStickyError(); | 1207 DART_EXPORT bool Dart_HasStickyError(); |
1215 | 1208 |
1216 | |
1217 /** | 1209 /** |
1218 * Gets the sticky error for the current isolate. | 1210 * Gets the sticky error for the current isolate. |
1219 * | 1211 * |
1220 * \return A handle to the sticky error object or null. | 1212 * \return A handle to the sticky error object or null. |
1221 */ | 1213 */ |
1222 DART_EXPORT Dart_Handle Dart_GetStickyError(); | 1214 DART_EXPORT Dart_Handle Dart_GetStickyError(); |
1223 | 1215 |
1224 | |
1225 /** | 1216 /** |
1226 * Handles the next pending message for the current isolate. | 1217 * Handles the next pending message for the current isolate. |
1227 * | 1218 * |
1228 * May generate an unhandled exception error. | 1219 * May generate an unhandled exception error. |
1229 * | 1220 * |
1230 * \return A valid handle if no error occurs during the operation. | 1221 * \return A valid handle if no error occurs during the operation. |
1231 */ | 1222 */ |
1232 DART_EXPORT Dart_Handle Dart_HandleMessage(); | 1223 DART_EXPORT Dart_Handle Dart_HandleMessage(); |
1233 | 1224 |
1234 /** | 1225 /** |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 /** | 1310 /** |
1320 * Gets the SendPort id for the provided SendPort. | 1311 * Gets the SendPort id for the provided SendPort. |
1321 * \param port A SendPort object whose id is desired. | 1312 * \param port A SendPort object whose id is desired. |
1322 * \param port_id Returns the id of the SendPort. | 1313 * \param port_id Returns the id of the SendPort. |
1323 * \return Success if no error occurs. Otherwise returns | 1314 * \return Success if no error occurs. Otherwise returns |
1324 * an error handle. | 1315 * an error handle. |
1325 */ | 1316 */ |
1326 DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, | 1317 DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, |
1327 Dart_Port* port_id); | 1318 Dart_Port* port_id); |
1328 | 1319 |
1329 | |
1330 /* | 1320 /* |
1331 * ====== | 1321 * ====== |
1332 * Scopes | 1322 * Scopes |
1333 * ====== | 1323 * ====== |
1334 */ | 1324 */ |
1335 | 1325 |
1336 /** | 1326 /** |
1337 * Enters a new scope. | 1327 * Enters a new scope. |
1338 * | 1328 * |
1339 * All new local handles will be created in this scope. Additionally, | 1329 * All new local handles will be created in this scope. Additionally, |
(...skipping 30 matching lines...) Expand all Loading... |
1370 * All the memory allocated this way will be reclaimed either on the | 1360 * All the memory allocated this way will be reclaimed either on the |
1371 * next call to Dart_ExitScope or when the native port handler exits. | 1361 * next call to Dart_ExitScope or when the native port handler exits. |
1372 * | 1362 * |
1373 * \param size Size of the memory to allocate. | 1363 * \param size Size of the memory to allocate. |
1374 * | 1364 * |
1375 * \return A pointer to the allocated memory. NULL if allocation | 1365 * \return A pointer to the allocated memory. NULL if allocation |
1376 * failed. Failure might due to is no current VM zone. | 1366 * failed. Failure might due to is no current VM zone. |
1377 */ | 1367 */ |
1378 DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size); | 1368 DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size); |
1379 | 1369 |
1380 | |
1381 /* | 1370 /* |
1382 * ======= | 1371 * ======= |
1383 * Objects | 1372 * Objects |
1384 * ======= | 1373 * ======= |
1385 */ | 1374 */ |
1386 | 1375 |
1387 /** | 1376 /** |
1388 * Returns the null object. | 1377 * Returns the null object. |
1389 * | 1378 * |
1390 * \return A handle to the null object. | 1379 * \return A handle to the null object. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 * \param object An object. | 1420 * \param object An object. |
1432 * \param type A type. | 1421 * \param type A type. |
1433 * \param instanceof Return true if 'object' is an instance of type 'type'. | 1422 * \param instanceof Return true if 'object' is an instance of type 'type'. |
1434 * | 1423 * |
1435 * \return A valid handle if no error occurs during the operation. | 1424 * \return A valid handle if no error occurs during the operation. |
1436 */ | 1425 */ |
1437 DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object, | 1426 DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object, |
1438 Dart_Handle type, | 1427 Dart_Handle type, |
1439 bool* instanceof); | 1428 bool* instanceof); |
1440 | 1429 |
1441 | |
1442 /** | 1430 /** |
1443 * Query object type. | 1431 * Query object type. |
1444 * | 1432 * |
1445 * \param object Some Object. | 1433 * \param object Some Object. |
1446 * | 1434 * |
1447 * \return true if Object is of the specified type. | 1435 * \return true if Object is of the specified type. |
1448 */ | 1436 */ |
1449 DART_EXPORT bool Dart_IsInstance(Dart_Handle object); | 1437 DART_EXPORT bool Dart_IsInstance(Dart_Handle object); |
1450 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); | 1438 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); |
1451 DART_EXPORT bool Dart_IsInteger(Dart_Handle object); | 1439 DART_EXPORT bool Dart_IsInteger(Dart_Handle object); |
1452 DART_EXPORT bool Dart_IsDouble(Dart_Handle object); | 1440 DART_EXPORT bool Dart_IsDouble(Dart_Handle object); |
1453 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object); | 1441 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object); |
1454 DART_EXPORT bool Dart_IsString(Dart_Handle object); | 1442 DART_EXPORT bool Dart_IsString(Dart_Handle object); |
1455 DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */ | 1443 DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */ |
1456 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object); | 1444 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object); |
1457 DART_EXPORT bool Dart_IsList(Dart_Handle object); | 1445 DART_EXPORT bool Dart_IsList(Dart_Handle object); |
1458 DART_EXPORT bool Dart_IsMap(Dart_Handle object); | 1446 DART_EXPORT bool Dart_IsMap(Dart_Handle object); |
1459 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object); | 1447 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object); |
1460 DART_EXPORT bool Dart_IsType(Dart_Handle handle); | 1448 DART_EXPORT bool Dart_IsType(Dart_Handle handle); |
1461 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle); | 1449 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle); |
1462 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle); | 1450 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle); |
1463 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle); | 1451 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle); |
1464 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); | 1452 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); |
1465 DART_EXPORT bool Dart_IsTypedData(Dart_Handle object); | 1453 DART_EXPORT bool Dart_IsTypedData(Dart_Handle object); |
1466 DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle object); | 1454 DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle object); |
1467 DART_EXPORT bool Dart_IsFuture(Dart_Handle object); | 1455 DART_EXPORT bool Dart_IsFuture(Dart_Handle object); |
1468 | 1456 |
1469 | |
1470 /* | 1457 /* |
1471 * ========= | 1458 * ========= |
1472 * Instances | 1459 * Instances |
1473 * ========= | 1460 * ========= |
1474 */ | 1461 */ |
1475 | 1462 |
1476 /* | 1463 /* |
1477 * For the purposes of the embedding api, not all objects returned are | 1464 * For the purposes of the embedding api, not all objects returned are |
1478 * Dart language objects. Within the api, we use the term 'Instance' | 1465 * Dart language objects. Within the api, we use the term 'Instance' |
1479 * to indicate handles which refer to true Dart language objects. | 1466 * to indicate handles which refer to true Dart language objects. |
1480 * | 1467 * |
1481 * TODO(turnidge): Reorganize the "Object" section above, pulling down | 1468 * TODO(turnidge): Reorganize the "Object" section above, pulling down |
1482 * any functions that more properly belong here. */ | 1469 * any functions that more properly belong here. */ |
1483 | 1470 |
1484 /** | 1471 /** |
1485 * Gets the type of a Dart language object. | 1472 * Gets the type of a Dart language object. |
1486 * | 1473 * |
1487 * \param instance Some Dart object. | 1474 * \param instance Some Dart object. |
1488 * | 1475 * |
1489 * \return If no error occurs, the type is returned. Otherwise an | 1476 * \return If no error occurs, the type is returned. Otherwise an |
1490 * error handle is returned. | 1477 * error handle is returned. |
1491 */ | 1478 */ |
1492 DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance); | 1479 DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance); |
1493 | 1480 |
1494 | |
1495 /* | 1481 /* |
1496 * ============================= | 1482 * ============================= |
1497 * Numbers, Integers and Doubles | 1483 * Numbers, Integers and Doubles |
1498 * ============================= | 1484 * ============================= |
1499 */ | 1485 */ |
1500 | 1486 |
1501 /** | 1487 /** |
1502 * Does this Integer fit into a 64-bit signed integer? | 1488 * Does this Integer fit into a 64-bit signed integer? |
1503 * | 1489 * |
1504 * \param integer An integer. | 1490 * \param integer An integer. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 * it and returns the object returned by the getter. | 1604 * it and returns the object returned by the getter. |
1619 * | 1605 * |
1620 * \param library Library object | 1606 * \param library Library object |
1621 * \param function_name Name of the top level function | 1607 * \param function_name Name of the top level function |
1622 * | 1608 * |
1623 * \return A valid Dart instance if no error occurs during the operation. | 1609 * \return A valid Dart instance if no error occurs during the operation. |
1624 */ | 1610 */ |
1625 DART_EXPORT Dart_Handle Dart_GetClosure(Dart_Handle library, | 1611 DART_EXPORT Dart_Handle Dart_GetClosure(Dart_Handle library, |
1626 Dart_Handle function_name); | 1612 Dart_Handle function_name); |
1627 | 1613 |
1628 | |
1629 /* | 1614 /* |
1630 * ======== | 1615 * ======== |
1631 * Booleans | 1616 * Booleans |
1632 * ======== | 1617 * ======== |
1633 */ | 1618 */ |
1634 | 1619 |
1635 /** | 1620 /** |
1636 * Returns the True object. | 1621 * Returns the True object. |
1637 * | 1622 * |
1638 * Requires there to be a current isolate. | 1623 * Requires there to be a current isolate. |
(...skipping 24 matching lines...) Expand all Loading... |
1663 /** | 1648 /** |
1664 * Gets the value of a Boolean | 1649 * Gets the value of a Boolean |
1665 * | 1650 * |
1666 * \param boolean_obj A Boolean | 1651 * \param boolean_obj A Boolean |
1667 * \param value Returns the value of the Boolean. | 1652 * \param value Returns the value of the Boolean. |
1668 * | 1653 * |
1669 * \return A valid handle if no error occurs during the operation. | 1654 * \return A valid handle if no error occurs during the operation. |
1670 */ | 1655 */ |
1671 DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool* value); | 1656 DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool* value); |
1672 | 1657 |
1673 | |
1674 /* | 1658 /* |
1675 * ======= | 1659 * ======= |
1676 * Strings | 1660 * Strings |
1677 * ======= | 1661 * ======= |
1678 */ | 1662 */ |
1679 | 1663 |
1680 /** | 1664 /** |
1681 * Gets the length of a String. | 1665 * Gets the length of a String. |
1682 * | 1666 * |
1683 * \param str A String. | 1667 * \param str A String. |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 intptr_t length); | 1970 intptr_t length); |
1987 | 1971 |
1988 /** | 1972 /** |
1989 * May generate an unhandled exception error. | 1973 * May generate an unhandled exception error. |
1990 */ | 1974 */ |
1991 DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, | 1975 DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, |
1992 intptr_t offset, | 1976 intptr_t offset, |
1993 const uint8_t* native_array, | 1977 const uint8_t* native_array, |
1994 intptr_t length); | 1978 intptr_t length); |
1995 | 1979 |
1996 | |
1997 /* | 1980 /* |
1998 * ==== | 1981 * ==== |
1999 * Maps | 1982 * Maps |
2000 * ==== | 1983 * ==== |
2001 */ | 1984 */ |
2002 | 1985 |
2003 /** | 1986 /** |
2004 * Gets the Object at some key of a Map. | 1987 * Gets the Object at some key of a Map. |
2005 * | 1988 * |
2006 * May generate an unhandled exception error. | 1989 * May generate an unhandled exception error. |
(...skipping 23 matching lines...) Expand all Loading... |
2030 * | 2013 * |
2031 * May generate an unhandled exception error. | 2014 * May generate an unhandled exception error. |
2032 * | 2015 * |
2033 * \param map A Map. | 2016 * \param map A Map. |
2034 * | 2017 * |
2035 * \return The list of key Objects if no error occurs. Otherwise returns an | 2018 * \return The list of key Objects if no error occurs. Otherwise returns an |
2036 * error handle. | 2019 * error handle. |
2037 */ | 2020 */ |
2038 DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map); | 2021 DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map); |
2039 | 2022 |
2040 | |
2041 /* | 2023 /* |
2042 * ========== | 2024 * ========== |
2043 * Typed Data | 2025 * Typed Data |
2044 * ========== | 2026 * ========== |
2045 */ | 2027 */ |
2046 | 2028 |
2047 typedef enum { | 2029 typedef enum { |
2048 Dart_TypedData_kByteData = 0, | 2030 Dart_TypedData_kByteData = 0, |
2049 Dart_TypedData_kInt8, | 2031 Dart_TypedData_kInt8, |
2050 Dart_TypedData_kUint8, | 2032 Dart_TypedData_kUint8, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 /** | 2139 /** |
2158 * Returns the TypedData object associated with the ByteBuffer object. | 2140 * Returns the TypedData object associated with the ByteBuffer object. |
2159 * | 2141 * |
2160 * \param byte_buffer The ByteBuffer object. | 2142 * \param byte_buffer The ByteBuffer object. |
2161 * | 2143 * |
2162 * \return The TypedData object if no error occurs. Otherwise returns | 2144 * \return The TypedData object if no error occurs. Otherwise returns |
2163 * an error handle. | 2145 * an error handle. |
2164 */ | 2146 */ |
2165 DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle byte_buffer); | 2147 DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle byte_buffer); |
2166 | 2148 |
2167 | |
2168 /* | 2149 /* |
2169 * ============================================================ | 2150 * ============================================================ |
2170 * Invoking Constructors, Methods, Closures and Field accessors | 2151 * Invoking Constructors, Methods, Closures and Field accessors |
2171 * ============================================================ | 2152 * ============================================================ |
2172 */ | 2153 */ |
2173 | 2154 |
2174 /** | 2155 /** |
2175 * Invokes a constructor, creating a new object. | 2156 * Invokes a constructor, creating a new object. |
2176 * | 2157 * |
2177 * This function allows hidden constructors (constructors with leading | 2158 * This function allows hidden constructors (constructors with leading |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 * \param container An object, type, or library. | 2306 * \param container An object, type, or library. |
2326 * \param name A field name. | 2307 * \param name A field name. |
2327 * \param value The new field value. | 2308 * \param value The new field value. |
2328 * | 2309 * |
2329 * \return A valid handle if no error occurs. | 2310 * \return A valid handle if no error occurs. |
2330 */ | 2311 */ |
2331 DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, | 2312 DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, |
2332 Dart_Handle name, | 2313 Dart_Handle name, |
2333 Dart_Handle value); | 2314 Dart_Handle value); |
2334 | 2315 |
2335 | |
2336 /* | 2316 /* |
2337 * ========== | 2317 * ========== |
2338 * Exceptions | 2318 * Exceptions |
2339 * ========== | 2319 * ========== |
2340 */ | 2320 */ |
2341 | 2321 |
2342 /* | 2322 /* |
2343 * TODO(turnidge): Remove these functions from the api and replace all | 2323 * TODO(turnidge): Remove these functions from the api and replace all |
2344 * uses with Dart_NewUnhandledExceptionError. */ | 2324 * uses with Dart_NewUnhandledExceptionError. */ |
2345 | 2325 |
(...skipping 25 matching lines...) Expand all Loading... |
2371 * successful, this function does not return. Note that this means | 2351 * successful, this function does not return. Note that this means |
2372 * that the destructors of any stack-allocated C++ objects will not be | 2352 * that the destructors of any stack-allocated C++ objects will not be |
2373 * called. If there are no Dart frames on the stack, an error occurs. | 2353 * called. If there are no Dart frames on the stack, an error occurs. |
2374 * | 2354 * |
2375 * \return An error handle if the exception was not thrown. | 2355 * \return An error handle if the exception was not thrown. |
2376 * Otherwise the function does not return. | 2356 * Otherwise the function does not return. |
2377 */ | 2357 */ |
2378 DART_EXPORT Dart_Handle Dart_RethrowException(Dart_Handle exception, | 2358 DART_EXPORT Dart_Handle Dart_RethrowException(Dart_Handle exception, |
2379 Dart_Handle stacktrace); | 2359 Dart_Handle stacktrace); |
2380 | 2360 |
2381 | |
2382 /* | 2361 /* |
2383 * =========================== | 2362 * =========================== |
2384 * Native fields and functions | 2363 * Native fields and functions |
2385 * =========================== | 2364 * =========================== |
2386 */ | 2365 */ |
2387 | 2366 |
2388 /** | 2367 /** |
2389 * Creates a native wrapper class. | 2368 * Creates a native wrapper class. |
2390 * | 2369 * |
2391 * TODO(turnidge): Document. | 2370 * TODO(turnidge): Document. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 * \return Success if all the arguments could be extracted correctly, | 2479 * \return Success if all the arguments could be extracted correctly, |
2501 * returns an error handle if there were any errors while extracting the | 2480 * returns an error handle if there were any errors while extracting the |
2502 * arguments (mismatched number of arguments, incorrect types, etc.). | 2481 * arguments (mismatched number of arguments, incorrect types, etc.). |
2503 */ | 2482 */ |
2504 DART_EXPORT Dart_Handle | 2483 DART_EXPORT Dart_Handle |
2505 Dart_GetNativeArguments(Dart_NativeArguments args, | 2484 Dart_GetNativeArguments(Dart_NativeArguments args, |
2506 int num_arguments, | 2485 int num_arguments, |
2507 const Dart_NativeArgument_Descriptor* arg_descriptors, | 2486 const Dart_NativeArgument_Descriptor* arg_descriptors, |
2508 Dart_NativeArgument_Value* arg_values); | 2487 Dart_NativeArgument_Value* arg_values); |
2509 | 2488 |
2510 | |
2511 /** | 2489 /** |
2512 * Gets the native argument at some index. | 2490 * Gets the native argument at some index. |
2513 */ | 2491 */ |
2514 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, | 2492 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, |
2515 int index); | 2493 int index); |
2516 /* TODO(turnidge): Specify the behavior of an out-of-bounds access. */ | 2494 /* TODO(turnidge): Specify the behavior of an out-of-bounds access. */ |
2517 | 2495 |
2518 /** | 2496 /** |
2519 * Gets the number of native arguments. | 2497 * Gets the number of native arguments. |
2520 */ | 2498 */ |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2658 * | 2636 * |
2659 * The parameters to the native reverse resolver function are: | 2637 * The parameters to the native reverse resolver function are: |
2660 * \param nf A Dart_NativeFunction. | 2638 * \param nf A Dart_NativeFunction. |
2661 * | 2639 * |
2662 * \return A const UTF-8 string containing the symbol name or NULL. | 2640 * \return A const UTF-8 string containing the symbol name or NULL. |
2663 * | 2641 * |
2664 * See Dart_SetNativeResolver. | 2642 * See Dart_SetNativeResolver. |
2665 */ | 2643 */ |
2666 typedef const uint8_t* (*Dart_NativeEntrySymbol)(Dart_NativeFunction nf); | 2644 typedef const uint8_t* (*Dart_NativeEntrySymbol)(Dart_NativeFunction nf); |
2667 | 2645 |
2668 | |
2669 /* | 2646 /* |
2670 * =========== | 2647 * =========== |
2671 * Environment | 2648 * Environment |
2672 * =========== | 2649 * =========== |
2673 */ | 2650 */ |
2674 | 2651 |
2675 /** | 2652 /** |
2676 * An environment lookup callback function. | 2653 * An environment lookup callback function. |
2677 * | 2654 * |
2678 * \param name The name of the value to lookup in the environment. | 2655 * \param name The name of the value to lookup in the environment. |
(...skipping 20 matching lines...) Expand all Loading... |
2699 * \param resolver A native entry resolver. | 2676 * \param resolver A native entry resolver. |
2700 * | 2677 * |
2701 * \return A valid handle if the native resolver was set successfully. | 2678 * \return A valid handle if the native resolver was set successfully. |
2702 */ | 2679 */ |
2703 DART_EXPORT Dart_Handle | 2680 DART_EXPORT Dart_Handle |
2704 Dart_SetNativeResolver(Dart_Handle library, | 2681 Dart_SetNativeResolver(Dart_Handle library, |
2705 Dart_NativeEntryResolver resolver, | 2682 Dart_NativeEntryResolver resolver, |
2706 Dart_NativeEntrySymbol symbol); | 2683 Dart_NativeEntrySymbol symbol); |
2707 /* TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? */ | 2684 /* TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? */ |
2708 | 2685 |
2709 | |
2710 /** | 2686 /** |
2711 * Returns the callback used to resolve native functions for a library. | 2687 * Returns the callback used to resolve native functions for a library. |
2712 * | 2688 * |
2713 * \param library A library. | 2689 * \param library A library. |
2714 * \param resolver a pointer to a Dart_NativeEntryResolver | 2690 * \param resolver a pointer to a Dart_NativeEntryResolver |
2715 * | 2691 * |
2716 * \return A valid handle if the library was found. | 2692 * \return A valid handle if the library was found. |
2717 */ | 2693 */ |
2718 DART_EXPORT Dart_Handle | 2694 DART_EXPORT Dart_Handle |
2719 Dart_GetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver* resolver); | 2695 Dart_GetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver* resolver); |
2720 | 2696 |
2721 | |
2722 /** | 2697 /** |
2723 * Returns the callback used to resolve native function symbols for a library. | 2698 * Returns the callback used to resolve native function symbols for a library. |
2724 * | 2699 * |
2725 * \param library A library. | 2700 * \param library A library. |
2726 * \param resolver a pointer to a Dart_NativeEntrySymbol. | 2701 * \param resolver a pointer to a Dart_NativeEntrySymbol. |
2727 * | 2702 * |
2728 * \return A valid handle if the library was found. | 2703 * \return A valid handle if the library was found. |
2729 */ | 2704 */ |
2730 DART_EXPORT Dart_Handle Dart_GetNativeSymbol(Dart_Handle library, | 2705 DART_EXPORT Dart_Handle Dart_GetNativeSymbol(Dart_Handle library, |
2731 Dart_NativeEntrySymbol* resolver); | 2706 Dart_NativeEntrySymbol* resolver); |
2732 | 2707 |
2733 | |
2734 /* | 2708 /* |
2735 * ===================== | 2709 * ===================== |
2736 * Scripts and Libraries | 2710 * Scripts and Libraries |
2737 * ===================== | 2711 * ===================== |
2738 */ | 2712 */ |
2739 | 2713 |
2740 typedef enum { | 2714 typedef enum { |
2741 Dart_kCanonicalizeUrl = 0, | 2715 Dart_kCanonicalizeUrl = 0, |
2742 Dart_kScriptTag, | 2716 Dart_kScriptTag, |
2743 Dart_kSourceTag, | 2717 Dart_kSourceTag, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2873 * \param kernel_program The kernel program obtained via | 2847 * \param kernel_program The kernel program obtained via |
2874 * `Dart_ReadKernelBinary`. | 2848 * `Dart_ReadKernelBinary`. |
2875 * | 2849 * |
2876 * The VM will take ownership of the `kernel_program` object. | 2850 * The VM will take ownership of the `kernel_program` object. |
2877 * | 2851 * |
2878 * \return If no error occurs, the Library object corresponding to the root | 2852 * \return If no error occurs, the Library object corresponding to the root |
2879 * script is returned. Otherwise an error handle is returned. | 2853 * script is returned. Otherwise an error handle is returned. |
2880 */ | 2854 */ |
2881 DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program); | 2855 DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program); |
2882 | 2856 |
2883 | |
2884 /** | 2857 /** |
2885 * Constructs an in-memory kernel program form a binary. | 2858 * Constructs an in-memory kernel program form a binary. |
2886 * | 2859 * |
2887 * \param buffer The start of a memory buffer containing the binary format. | 2860 * \param buffer The start of a memory buffer containing the binary format. |
2888 * \param buffer_len The length of the memory buffer. | 2861 * \param buffer_len The length of the memory buffer. |
2889 * | 2862 * |
2890 * \return kernel_program The `dart::kernel::Program` object. | 2863 * \return kernel_program The `dart::kernel::Program` object. |
2891 */ | 2864 */ |
2892 DART_EXPORT void* Dart_ReadKernelBinary(const uint8_t* buffer, | 2865 DART_EXPORT void* Dart_ReadKernelBinary(const uint8_t* buffer, |
2893 intptr_t buffer_len); | 2866 intptr_t buffer_len); |
2894 | 2867 |
2895 /** | 2868 /** |
2896 * Gets the library for the root script for the current isolate. | 2869 * Gets the library for the root script for the current isolate. |
2897 * | 2870 * |
2898 * If the root script has not yet been set for the current isolate, | 2871 * If the root script has not yet been set for the current isolate, |
2899 * this function returns Dart_Null(). This function never returns an | 2872 * this function returns Dart_Null(). This function never returns an |
2900 * error handle. | 2873 * error handle. |
2901 * | 2874 * |
2902 * \return Returns the root Library for the current isolate or Dart_Null(). | 2875 * \return Returns the root Library for the current isolate or Dart_Null(). |
2903 */ | 2876 */ |
2904 DART_EXPORT Dart_Handle Dart_RootLibrary(); | 2877 DART_EXPORT Dart_Handle Dart_RootLibrary(); |
2905 | 2878 |
2906 | |
2907 /** | 2879 /** |
2908 * Sets the root library for the current isolate. | 2880 * Sets the root library for the current isolate. |
2909 * | 2881 * |
2910 * \return Returns an error handle if `library` is not a library handle. | 2882 * \return Returns an error handle if `library` is not a library handle. |
2911 */ | 2883 */ |
2912 DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library); | 2884 DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library); |
2913 | 2885 |
2914 | |
2915 /** | 2886 /** |
2916 * Lookup or instantiate a type by name and type arguments from a Library. | 2887 * Lookup or instantiate a type by name and type arguments from a Library. |
2917 * | 2888 * |
2918 * \param library The library containing the class or interface. | 2889 * \param library The library containing the class or interface. |
2919 * \param class_name The class name for the type. | 2890 * \param class_name The class name for the type. |
2920 * \param number_of_type_arguments Number of type arguments. | 2891 * \param number_of_type_arguments Number of type arguments. |
2921 * For non parametric types the number of type arguments would be 0. | 2892 * For non parametric types the number of type arguments would be 0. |
2922 * \param type_arguments Pointer to an array of type arguments. | 2893 * \param type_arguments Pointer to an array of type arguments. |
2923 * For non parameteric types a NULL would be passed in for this argument. | 2894 * For non parameteric types a NULL would be passed in for this argument. |
2924 * | 2895 * |
(...skipping 17 matching lines...) Expand all Loading... |
2942 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, | 2913 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, |
2943 Dart_Handle class_name); | 2914 Dart_Handle class_name); |
2944 /* TODO(asiva): The above method needs to be removed once all uses | 2915 /* TODO(asiva): The above method needs to be removed once all uses |
2945 * of it are removed from the embedder code. */ | 2916 * of it are removed from the embedder code. */ |
2946 | 2917 |
2947 /** | 2918 /** |
2948 * Returns the url from which a library was loaded. | 2919 * Returns the url from which a library was loaded. |
2949 */ | 2920 */ |
2950 DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library); | 2921 DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library); |
2951 | 2922 |
2952 | |
2953 /** | 2923 /** |
2954 * \return An array of libraries. | 2924 * \return An array of libraries. |
2955 */ | 2925 */ |
2956 DART_EXPORT Dart_Handle Dart_GetLoadedLibraries(); | 2926 DART_EXPORT Dart_Handle Dart_GetLoadedLibraries(); |
2957 | 2927 |
2958 | |
2959 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url); | 2928 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url); |
2960 /* TODO(turnidge): Consider returning Dart_Null() when the library is | 2929 /* TODO(turnidge): Consider returning Dart_Null() when the library is |
2961 * not found to distinguish that from a true error case. */ | 2930 * not found to distinguish that from a true error case. */ |
2962 | 2931 |
2963 | |
2964 /** | 2932 /** |
2965 * Report an loading error for the library. | 2933 * Report an loading error for the library. |
2966 * | 2934 * |
2967 * \param library The library that failed to load. | 2935 * \param library The library that failed to load. |
2968 * \param error The Dart error instance containing the load error. | 2936 * \param error The Dart error instance containing the load error. |
2969 * | 2937 * |
2970 * \return If the VM handles the error, the return value is | 2938 * \return If the VM handles the error, the return value is |
2971 * a null handle. If it doesn't handle the error, the error | 2939 * a null handle. If it doesn't handle the error, the error |
2972 * object is returned. | 2940 * object is returned. |
2973 */ | 2941 */ |
2974 DART_EXPORT Dart_Handle Dart_LibraryHandleError(Dart_Handle library, | 2942 DART_EXPORT Dart_Handle Dart_LibraryHandleError(Dart_Handle library, |
2975 Dart_Handle error); | 2943 Dart_Handle error); |
2976 | 2944 |
2977 | |
2978 /** | 2945 /** |
2979 * Called by the embedder to provide the source for an "import" | 2946 * Called by the embedder to provide the source for an "import" |
2980 * directive. This function should be called in response to a | 2947 * directive. This function should be called in response to a |
2981 * Dart_kImportTag tag handler request (See Dart_LibraryTagHandler, | 2948 * Dart_kImportTag tag handler request (See Dart_LibraryTagHandler, |
2982 * above). | 2949 * above). |
2983 * | 2950 * |
2984 * \param library The library where the "import" directive occurs. | 2951 * \param library The library where the "import" directive occurs. |
2985 * | 2952 * |
2986 * \param url The original url requested for the import. | 2953 * \param url The original url requested for the import. |
2987 * | 2954 * |
(...skipping 26 matching lines...) Expand all Loading... |
3014 * \param library The library into which to import another library. | 2981 * \param library The library into which to import another library. |
3015 * \param import The library to import. | 2982 * \param import The library to import. |
3016 * \param prefix The prefix under which to import. | 2983 * \param prefix The prefix under which to import. |
3017 * | 2984 * |
3018 * \return A valid handle if no error occurs during the operation. | 2985 * \return A valid handle if no error occurs during the operation. |
3019 */ | 2986 */ |
3020 DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library, | 2987 DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library, |
3021 Dart_Handle import, | 2988 Dart_Handle import, |
3022 Dart_Handle prefix); | 2989 Dart_Handle prefix); |
3023 | 2990 |
3024 | |
3025 /** | 2991 /** |
3026 * Returns a flattened list of pairs. The first element in each pair is the | 2992 * Returns a flattened list of pairs. The first element in each pair is the |
3027 * importing library and and the second element is the imported library for each | 2993 * importing library and and the second element is the imported library for each |
3028 * import in the isolate of a library whose URI's scheme is [scheme]. | 2994 * import in the isolate of a library whose URI's scheme is [scheme]. |
3029 * | 2995 * |
3030 * Requires there to be a current isolate. | 2996 * Requires there to be a current isolate. |
3031 * | 2997 * |
3032 * \return A handle to a list of flattened pairs of importer-importee. | 2998 * \return A handle to a list of flattened pairs of importer-importee. |
3033 */ | 2999 */ |
3034 DART_EXPORT Dart_Handle Dart_GetImportsOfScheme(Dart_Handle scheme); | 3000 DART_EXPORT Dart_Handle Dart_GetImportsOfScheme(Dart_Handle scheme); |
3035 | 3001 |
3036 | |
3037 /** | 3002 /** |
3038 * Called by the embedder to provide the source for a "part of" | 3003 * Called by the embedder to provide the source for a "part of" |
3039 * directive. This function should be called in response to a | 3004 * directive. This function should be called in response to a |
3040 * Dart_kSourceTag tag handler request (See Dart_LibraryTagHandler, | 3005 * Dart_kSourceTag tag handler request (See Dart_LibraryTagHandler, |
3041 * above). | 3006 * above). |
3042 * | 3007 * |
3043 * \param library The library where the "part of" directive occurs. | 3008 * \param library The library where the "part of" directive occurs. |
3044 * | 3009 * |
3045 * \param url The original url requested for the part. | 3010 * \param url The original url requested for the part. |
3046 * | 3011 * |
(...skipping 13 matching lines...) Expand all Loading... |
3060 * \return A valid handle if no error occurs during the operation. | 3025 * \return A valid handle if no error occurs during the operation. |
3061 */ | 3026 */ |
3062 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, | 3027 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, |
3063 Dart_Handle url, | 3028 Dart_Handle url, |
3064 Dart_Handle resolved_url, | 3029 Dart_Handle resolved_url, |
3065 Dart_Handle source, | 3030 Dart_Handle source, |
3066 intptr_t line_offset, | 3031 intptr_t line_offset, |
3067 intptr_t column_offset); | 3032 intptr_t column_offset); |
3068 /* TODO(turnidge): Rename to Dart_LibraryLoadSource? */ | 3033 /* TODO(turnidge): Rename to Dart_LibraryLoadSource? */ |
3069 | 3034 |
3070 | |
3071 /** | 3035 /** |
3072 * Loads a patch source string into a library. | 3036 * Loads a patch source string into a library. |
3073 * | 3037 * |
3074 * \param library A library | 3038 * \param library A library |
3075 * \param url A url identifying the origin of the patch source | 3039 * \param url A url identifying the origin of the patch source |
3076 * \param source A string of Dart patch source | 3040 * \param source A string of Dart patch source |
3077 */ | 3041 */ |
3078 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, | 3042 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, |
3079 Dart_Handle url, | 3043 Dart_Handle url, |
3080 Dart_Handle patch_source); | 3044 Dart_Handle patch_source); |
3081 | 3045 |
3082 | |
3083 /** | 3046 /** |
3084 * Indicates that all outstanding load requests have been satisfied. | 3047 * Indicates that all outstanding load requests have been satisfied. |
3085 * This finalizes all the new classes loaded and optionally completes | 3048 * This finalizes all the new classes loaded and optionally completes |
3086 * deferred library futures. | 3049 * deferred library futures. |
3087 * | 3050 * |
3088 * Requires there to be a current isolate. | 3051 * Requires there to be a current isolate. |
3089 * | 3052 * |
3090 * \param complete_futures Specify true if all deferred library | 3053 * \param complete_futures Specify true if all deferred library |
3091 * futures should be completed, false otherwise. | 3054 * futures should be completed, false otherwise. |
3092 * | 3055 * |
3093 * \return Success if all classes have been finalized and deferred library | 3056 * \return Success if all classes have been finalized and deferred library |
3094 * futures are completed. Otherwise, returns an error. | 3057 * futures are completed. Otherwise, returns an error. |
3095 */ | 3058 */ |
3096 DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures); | 3059 DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures); |
3097 | 3060 |
3098 | |
3099 /* | 3061 /* |
3100 * ===== | 3062 * ===== |
3101 * Peers | 3063 * Peers |
3102 * ===== | 3064 * ===== |
3103 */ | 3065 */ |
3104 | 3066 |
3105 /** | 3067 /** |
3106 * The peer field is a lazily allocated field intended for storage of | 3068 * The peer field is a lazily allocated field intended for storage of |
3107 * an uncommonly used values. Most instances types can have a peer | 3069 * an uncommonly used values. Most instances types can have a peer |
3108 * field allocated. The exceptions are subtypes of Null, num, and | 3070 * field allocated. The exceptions are subtypes of Null, num, and |
(...skipping 17 matching lines...) Expand all Loading... |
3126 * 'peer'. | 3088 * 'peer'. |
3127 * | 3089 * |
3128 * \param object An object. | 3090 * \param object An object. |
3129 * \param peer A value to store in the peer field. | 3091 * \param peer A value to store in the peer field. |
3130 * | 3092 * |
3131 * \return Returns an error if 'object' is a subtype of Null, num, or | 3093 * \return Returns an error if 'object' is a subtype of Null, num, or |
3132 * bool. | 3094 * bool. |
3133 */ | 3095 */ |
3134 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 3096 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
3135 | 3097 |
3136 | |
3137 /* | 3098 /* |
3138 * ====== | 3099 * ====== |
3139 * Kernel | 3100 * Kernel |
3140 * ====== | 3101 * ====== |
3141 */ | 3102 */ |
3142 | 3103 |
3143 | |
3144 /** | 3104 /** |
3145 * Experimental support for Dart to Kernel parser isolate. | 3105 * Experimental support for Dart to Kernel parser isolate. |
3146 * | 3106 * |
3147 * TODO(hausner): Document finalized interface. | 3107 * TODO(hausner): Document finalized interface. |
3148 * | 3108 * |
3149 */ | 3109 */ |
3150 | 3110 |
3151 typedef enum { | 3111 typedef enum { |
3152 Dart_KernelCompilationStatus_Unknown = -1, | 3112 Dart_KernelCompilationStatus_Unknown = -1, |
3153 Dart_KernelCompilationStatus_Ok = 0, | 3113 Dart_KernelCompilationStatus_Ok = 0, |
(...skipping 25 matching lines...) Expand all Loading... |
3179 Dart_SourceFile source_files[]); | 3139 Dart_SourceFile source_files[]); |
3180 | 3140 |
3181 #define DART_KERNEL_ISOLATE_NAME "kernel-service" | 3141 #define DART_KERNEL_ISOLATE_NAME "kernel-service" |
3182 | 3142 |
3183 /* | 3143 /* |
3184 * ======= | 3144 * ======= |
3185 * Service | 3145 * Service |
3186 * ======= | 3146 * ======= |
3187 */ | 3147 */ |
3188 | 3148 |
3189 | |
3190 #define DART_VM_SERVICE_ISOLATE_NAME "vm-service" | 3149 #define DART_VM_SERVICE_ISOLATE_NAME "vm-service" |
3191 | 3150 |
3192 /** | 3151 /** |
3193 * Returns true if isolate is the service isolate. | 3152 * Returns true if isolate is the service isolate. |
3194 * | 3153 * |
3195 * \param isolate An isolate | 3154 * \param isolate An isolate |
3196 * | 3155 * |
3197 * \return Returns true if 'isolate' is the service isolate. | 3156 * \return Returns true if 'isolate' is the service isolate. |
3198 */ | 3157 */ |
3199 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate); | 3158 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate); |
3200 | 3159 |
3201 | |
3202 /** | 3160 /** |
3203 * Returns the port that script load requests should be sent on. | 3161 * Returns the port that script load requests should be sent on. |
3204 * | 3162 * |
3205 * \return Returns the port for load requests or ILLEGAL_PORT if the service | 3163 * \return Returns the port for load requests or ILLEGAL_PORT if the service |
3206 * isolate failed to startup or does not support load requests. | 3164 * isolate failed to startup or does not support load requests. |
3207 */ | 3165 */ |
3208 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); | 3166 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); |
3209 | 3167 |
3210 | |
3211 /** | 3168 /** |
3212 * Record all functions which have been compiled in the current isolate. | 3169 * Record all functions which have been compiled in the current isolate. |
3213 * | 3170 * |
3214 * \param buffer Returns a pointer to a buffer containing the trace. | 3171 * \param buffer Returns a pointer to a buffer containing the trace. |
3215 * This buffer is scope allocated and is only valid until the next call to | 3172 * This buffer is scope allocated and is only valid until the next call to |
3216 * Dart_ExitScope. | 3173 * Dart_ExitScope. |
3217 * \param size Returns the size of the buffer. | 3174 * \param size Returns the size of the buffer. |
3218 * \return Returns an valid handle upon success. | 3175 * \return Returns an valid handle upon success. |
3219 */ | 3176 */ |
3220 DART_EXPORT Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer, | 3177 DART_EXPORT Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer, |
3221 intptr_t* buffer_length); | 3178 intptr_t* buffer_length); |
3222 | 3179 |
3223 | |
3224 /** | 3180 /** |
3225 * Compile all functions from data from Dart_SaveCompilationTrace. Unlike JIT | 3181 * Compile all functions from data from Dart_SaveCompilationTrace. Unlike JIT |
3226 * feedback, this data is fuzzy: loading does not need to happen in the exact | 3182 * feedback, this data is fuzzy: loading does not need to happen in the exact |
3227 * program that was saved, the saver and loader do not need to agree on checked | 3183 * program that was saved, the saver and loader do not need to agree on checked |
3228 * mode versus production mode or debug/release/product. | 3184 * mode versus production mode or debug/release/product. |
3229 * | 3185 * |
3230 * \return Returns an error handle if a compilation error was encountered. | 3186 * \return Returns an error handle if a compilation error was encountered. |
3231 */ | 3187 */ |
3232 DART_EXPORT Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, | 3188 DART_EXPORT Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, |
3233 intptr_t buffer_length); | 3189 intptr_t buffer_length); |
3234 | 3190 |
3235 | |
3236 /* | 3191 /* |
3237 * ============== | 3192 * ============== |
3238 * Precompilation | 3193 * Precompilation |
3239 * ============== | 3194 * ============== |
3240 */ | 3195 */ |
3241 | 3196 |
3242 /** | 3197 /** |
3243 * Saves a serialized version of the information collected for use by the | 3198 * Saves a serialized version of the information collected for use by the |
3244 * optimizing compiler, such as type feedback and usage counters. When this | 3199 * optimizing compiler, such as type feedback and usage counters. When this |
3245 * information is passed to Dart_Precompile, the AOT compiler may use it to | 3200 * information is passed to Dart_Precompile, the AOT compiler may use it to |
3246 * produce faster and smaller code. The feedback is only used if the JIT that | 3201 * produce faster and smaller code. The feedback is only used if the JIT that |
3247 * created it and the AOT compiler consuming it | 3202 * created it and the AOT compiler consuming it |
3248 * - are running the same Dart program | 3203 * - are running the same Dart program |
3249 * - are built from the same version of the VM | 3204 * - are built from the same version of the VM |
3250 * - agree on whether type checks and assertions are enabled | 3205 * - agree on whether type checks and assertions are enabled |
3251 * | 3206 * |
3252 * \return Returns an error handler if the VM was built in a mode that does not | 3207 * \return Returns an error handler if the VM was built in a mode that does not |
3253 * support saving JIT feedback. | 3208 * support saving JIT feedback. |
3254 */ | 3209 */ |
3255 DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, | 3210 DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, |
3256 intptr_t* buffer_length); | 3211 intptr_t* buffer_length); |
3257 | 3212 |
3258 | |
3259 typedef struct { | 3213 typedef struct { |
3260 const char* library_uri; | 3214 const char* library_uri; |
3261 const char* class_name; | 3215 const char* class_name; |
3262 const char* function_name; | 3216 const char* function_name; |
3263 } Dart_QualifiedFunctionName; | 3217 } Dart_QualifiedFunctionName; |
3264 | 3218 |
3265 | |
3266 /** | 3219 /** |
3267 * Compiles all functions reachable from the provided entry points and marks | 3220 * Compiles all functions reachable from the provided entry points and marks |
3268 * the isolate to disallow future compilation. | 3221 * the isolate to disallow future compilation. |
3269 * | 3222 * |
3270 * \param entry_points A list of functions that may be invoked through the | 3223 * \param entry_points A list of functions that may be invoked through the |
3271 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. | 3224 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. |
3272 * | 3225 * |
3273 * \param reset_fields Controls whether static fields are reset. Fields without | 3226 * \param reset_fields Controls whether static fields are reset. Fields without |
3274 * an initializer will be set to null, and fields with an initializer will have | 3227 * an initializer will be set to null, and fields with an initializer will have |
3275 * their initializer run the next time they are accessed. | 3228 * their initializer run the next time they are accessed. |
3276 * | 3229 * |
3277 * reset_fields is true when we are about to create a precompilated snapshot. | 3230 * reset_fields is true when we are about to create a precompilated snapshot. |
3278 * Some fields are already been initialized as part of the loading logic, and | 3231 * Some fields are already been initialized as part of the loading logic, and |
3279 * we want them to be reinitialized in the new process that will load the | 3232 * we want them to be reinitialized in the new process that will load the |
3280 * snapshot. | 3233 * snapshot. |
3281 * | 3234 * |
3282 * \return An error handle if a compilation error or runtime error running const | 3235 * \return An error handle if a compilation error or runtime error running const |
3283 * constructors was encountered. | 3236 * constructors was encountered. |
3284 */ | 3237 */ |
3285 DART_EXPORT Dart_Handle | 3238 DART_EXPORT Dart_Handle |
3286 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], | 3239 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], |
3287 uint8_t* jit_feedback, | 3240 uint8_t* jit_feedback, |
3288 intptr_t jit_feedback_length); | 3241 intptr_t jit_feedback_length); |
3289 | 3242 |
3290 | |
3291 /** | 3243 /** |
3292 * Creates a precompiled snapshot. | 3244 * Creates a precompiled snapshot. |
3293 * - A root library must have been loaded. | 3245 * - A root library must have been loaded. |
3294 * - Dart_Precompile must have been called. | 3246 * - Dart_Precompile must have been called. |
3295 * | 3247 * |
3296 * Outputs an assembly file defining the symbols | 3248 * Outputs an assembly file defining the symbols |
3297 * - kDartVmSnapshotData | 3249 * - kDartVmSnapshotData |
3298 * - kDartVmSnapshotInstructions | 3250 * - kDartVmSnapshotInstructions |
3299 * - kDartIsolateSnapshotData | 3251 * - kDartIsolateSnapshotData |
3300 * - kDartIsolateSnapshotInstructions | 3252 * - kDartIsolateSnapshotInstructions |
3301 * | 3253 * |
3302 * The assembly should be compiled as a static or shared library and linked or | 3254 * The assembly should be compiled as a static or shared library and linked or |
3303 * loaded by the embedder. | 3255 * loaded by the embedder. |
3304 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. | 3256 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. |
3305 * The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to | 3257 * The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to |
3306 * Dart_Initialize. The kDartIsolateSnapshotData and | 3258 * Dart_Initialize. The kDartIsolateSnapshotData and |
3307 * kDartIsoalteSnapshotInstructions should be passed to Dart_CreateIsolate. | 3259 * kDartIsoalteSnapshotInstructions should be passed to Dart_CreateIsolate. |
3308 * | 3260 * |
3309 * The buffers are scope allocated and are only valid until the next call to | 3261 * The buffers are scope allocated and are only valid until the next call to |
3310 * Dart_ExitScope. | 3262 * Dart_ExitScope. |
3311 * | 3263 * |
3312 * \return A valid handle if no error occurs during the operation. | 3264 * \return A valid handle if no error occurs during the operation. |
3313 */ | 3265 */ |
3314 DART_EXPORT Dart_Handle | 3266 DART_EXPORT Dart_Handle |
3315 Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer, | 3267 Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer, |
3316 intptr_t* assembly_size); | 3268 intptr_t* assembly_size); |
3317 | 3269 |
3318 | |
3319 /** | 3270 /** |
3320 * Same as Dart_CreateAppAOTSnapshotAsAssembly, except all the pieces are | 3271 * Same as Dart_CreateAppAOTSnapshotAsAssembly, except all the pieces are |
3321 * provided directly as bytes that the embedder can load with mmap. The | 3272 * provided directly as bytes that the embedder can load with mmap. The |
3322 * instructions pieces must be loaded with read and execute permissions; the | 3273 * instructions pieces must be loaded with read and execute permissions; the |
3323 * other pieces may be loaded as read-only. | 3274 * other pieces may be loaded as read-only. |
3324 */ | 3275 */ |
3325 DART_EXPORT Dart_Handle | 3276 DART_EXPORT Dart_Handle |
3326 Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer, | 3277 Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer, |
3327 intptr_t* vm_snapshot_data_size, | 3278 intptr_t* vm_snapshot_data_size, |
3328 uint8_t** vm_snapshot_instructions_buffer, | 3279 uint8_t** vm_snapshot_instructions_buffer, |
3329 intptr_t* vm_snapshot_instructions_size, | 3280 intptr_t* vm_snapshot_instructions_size, |
3330 uint8_t** isolate_snapshot_data_buffer, | 3281 uint8_t** isolate_snapshot_data_buffer, |
3331 intptr_t* isolate_snapshot_data_size, | 3282 intptr_t* isolate_snapshot_data_size, |
3332 uint8_t** isolate_snapshot_instructions_buffer, | 3283 uint8_t** isolate_snapshot_instructions_buffer, |
3333 intptr_t* isolate_snapshot_instructions_size); | 3284 intptr_t* isolate_snapshot_instructions_size); |
3334 | 3285 |
3335 /** | 3286 /** |
3336 * Sorts the class-ids in depth first traversal order of the inheritance | 3287 * Sorts the class-ids in depth first traversal order of the inheritance |
3337 * tree. This is a costly operation, but it can make method dispatch | 3288 * tree. This is a costly operation, but it can make method dispatch |
3338 * more efficient and is done before writing snapshots. | 3289 * more efficient and is done before writing snapshots. |
3339 * | 3290 * |
3340 * \return A valid handle if no error occurs during the operation. | 3291 * \return A valid handle if no error occurs during the operation. |
3341 */ | 3292 */ |
3342 DART_EXPORT Dart_Handle Dart_SortClasses(); | 3293 DART_EXPORT Dart_Handle Dart_SortClasses(); |
3343 | 3294 |
3344 | |
3345 /** | 3295 /** |
3346 * Creates a snapshot that caches compiled code and type feedback for faster | 3296 * Creates a snapshot that caches compiled code and type feedback for faster |
3347 * startup and quicker warmup in a subsequent process. | 3297 * startup and quicker warmup in a subsequent process. |
3348 * | 3298 * |
3349 * Outputs a snapshot in two pieces. The pieces should be passed to | 3299 * Outputs a snapshot in two pieces. The pieces should be passed to |
3350 * Dart_CreateIsolate in a VM using the same VM snapshot pieces used in the | 3300 * Dart_CreateIsolate in a VM using the same VM snapshot pieces used in the |
3351 * current VM. The instructions piece must be loaded with read and execute | 3301 * current VM. The instructions piece must be loaded with read and execute |
3352 * permissions; the data piece may be loaded as read-only. | 3302 * permissions; the data piece may be loaded as read-only. |
3353 * | 3303 * |
3354 * - Requires the VM to have been started with --load-deferred-eagerly. | 3304 * - Requires the VM to have been started with --load-deferred-eagerly. |
3355 * - Requires the VM to have not been started with --precompilation. | 3305 * - Requires the VM to have not been started with --precompilation. |
3356 * - Not supported when targeting IA32 or DBC. | 3306 * - Not supported when targeting IA32 or DBC. |
3357 * - The VM writing the snapshot and the VM reading the snapshot must be the | 3307 * - The VM writing the snapshot and the VM reading the snapshot must be the |
3358 * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must | 3308 * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must |
3359 * be targeting the same architecture, and must both be in checked mode or | 3309 * be targeting the same architecture, and must both be in checked mode or |
3360 * both in unchecked mode. | 3310 * both in unchecked mode. |
3361 * | 3311 * |
3362 * The buffers are scope allocated and are only valid until the next call to | 3312 * The buffers are scope allocated and are only valid until the next call to |
3363 * Dart_ExitScope. | 3313 * Dart_ExitScope. |
3364 * | 3314 * |
3365 * \return A valid handle if no error occurs during the operation. | 3315 * \return A valid handle if no error occurs during the operation. |
3366 */ | 3316 */ |
3367 DART_EXPORT Dart_Handle | 3317 DART_EXPORT Dart_Handle |
3368 Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer, | 3318 Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer, |
3369 intptr_t* isolate_snapshot_data_size, | 3319 intptr_t* isolate_snapshot_data_size, |
3370 uint8_t** isolate_snapshot_instructions_buffer, | 3320 uint8_t** isolate_snapshot_instructions_buffer, |
3371 intptr_t* isolate_snapshot_instructions_size); | 3321 intptr_t* isolate_snapshot_instructions_size); |
3372 | 3322 |
3373 | |
3374 /** | 3323 /** |
3375 * Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot. | 3324 * Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot. |
3376 */ | 3325 */ |
3377 DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs( | 3326 DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs( |
3378 uint8_t** vm_snapshot_data_buffer, | 3327 uint8_t** vm_snapshot_data_buffer, |
3379 intptr_t* vm_snapshot_data_size, | 3328 intptr_t* vm_snapshot_data_size, |
3380 uint8_t** vm_snapshot_instructions_buffer, | 3329 uint8_t** vm_snapshot_instructions_buffer, |
3381 intptr_t* vm_snapshot_instructions_size, | 3330 intptr_t* vm_snapshot_instructions_size, |
3382 uint8_t** isolate_snapshot_data_buffer, | 3331 uint8_t** isolate_snapshot_data_buffer, |
3383 intptr_t* isolate_snapshot_data_size, | 3332 intptr_t* isolate_snapshot_data_size, |
3384 uint8_t** isolate_snapshot_instructions_buffer, | 3333 uint8_t** isolate_snapshot_instructions_buffer, |
3385 intptr_t* isolate_snapshot_instructions_size); | 3334 intptr_t* isolate_snapshot_instructions_size); |
3386 | 3335 |
3387 | |
3388 /** | 3336 /** |
3389 * Returns whether the VM only supports running from precompiled snapshots and | 3337 * Returns whether the VM only supports running from precompiled snapshots and |
3390 * not from any other kind of snapshot or from source (that is, the VM was | 3338 * not from any other kind of snapshot or from source (that is, the VM was |
3391 * compiled with DART_PRECOMPILED_RUNTIME). | 3339 * compiled with DART_PRECOMPILED_RUNTIME). |
3392 */ | 3340 */ |
3393 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3341 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
3394 | 3342 |
3395 | |
3396 /** | 3343 /** |
3397 * Print a native stack trace. Used for crash handling. | 3344 * Print a native stack trace. Used for crash handling. |
3398 */ | 3345 */ |
3399 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); | 3346 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); |
3400 | 3347 |
3401 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3348 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |