OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 * | 527 * |
528 * \return Success if the callback was removed. Otherwise, returns an | 528 * \return Success if the callback was removed. Otherwise, returns an |
529 * error handle. | 529 * error handle. |
530 */ | 530 */ |
531 DART_EXPORT Dart_Handle Dart_RemoveGcEpilogueCallback( | 531 DART_EXPORT Dart_Handle Dart_RemoveGcEpilogueCallback( |
532 Dart_GcEpilogueCallback callback); | 532 Dart_GcEpilogueCallback callback); |
533 | 533 |
534 // --- Heap Profiler --- | 534 // --- Heap Profiler --- |
535 | 535 |
536 /** | 536 /** |
537 * A callback invoked by the heap profiler during profiling to write | 537 * A callback invoked by the VM to write to a specified stream. |
538 * data. | 538 * Used by the heap profiler and gc trace. |
539 */ | 539 */ |
540 typedef void (*Dart_HeapProfileWriteCallback)(const void* data, | 540 typedef void (*Dart_FileWriteCallback)(const void* data, |
541 intptr_t length, | 541 intptr_t length, |
542 void* stream); | 542 void* stream); |
543 | |
544 typedef void* (*Dart_FileOpenCallback)(const char* name); | |
545 | |
546 typedef void (*Dart_FileCloseCallback)(void* stream); | |
547 | |
543 | 548 |
544 /** | 549 /** |
545 * Generates a heap profile. | 550 * Generates a heap profile. |
546 * | 551 * |
547 * \param callback A function pointer that will be repeatedly invoked | 552 * \param callback A function pointer that will be repeatedly invoked |
548 * with heap profile data. | 553 * with heap profile data. |
549 * \param stream A pointer that will be passed to the callback. This | 554 * \param stream A pointer that will be passed to the callback. This |
550 * is a convenient way to provide an open stream to the callback. | 555 * is a convenient way to provide an open stream to the callback. |
551 * | 556 * |
552 * \return Success if the heap profile is successful. | 557 * \return Success if the heap profile is successful. |
553 */ | 558 */ |
554 DART_EXPORT Dart_Handle Dart_HeapProfile(Dart_HeapProfileWriteCallback callback, | 559 DART_EXPORT Dart_Handle Dart_HeapProfile(Dart_FileWriteCallback callback, |
555 void* stream); | 560 void* stream); |
556 | 561 |
557 // --- Initialization and Globals --- | 562 // --- Initialization and Globals --- |
558 | 563 |
559 /** | 564 /** |
560 * Gets the version string for the Dart VM. | 565 * Gets the version string for the Dart VM. |
561 * | 566 * |
562 * The version of the Dart VM can be accessed without initializing the VM. | 567 * The version of the Dart VM can be accessed without initializing the VM. |
563 * | 568 * |
564 * \return The version string for the embedded Dart VM. | 569 * \return The version string for the embedded Dart VM. |
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2733 * \param library A library. | 2738 * \param library A library. |
2734 * \param resolver A native entry resolver. | 2739 * \param resolver A native entry resolver. |
2735 * | 2740 * |
2736 * \return A valid handle if the native resolver was set successfully. | 2741 * \return A valid handle if the native resolver was set successfully. |
2737 */ | 2742 */ |
2738 DART_EXPORT Dart_Handle Dart_SetNativeResolver( | 2743 DART_EXPORT Dart_Handle Dart_SetNativeResolver( |
2739 Dart_Handle library, | 2744 Dart_Handle library, |
2740 Dart_NativeEntryResolver resolver); | 2745 Dart_NativeEntryResolver resolver); |
2741 // TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? | 2746 // TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? |
2742 | 2747 |
2743 // --- Profiling support ---- | 2748 // --- Profiling support --- |
2744 | 2749 |
2745 // External pprof support for gathering and dumping symbolic | 2750 // External pprof support for gathering and dumping symbolic |
2746 // information that can be used for better profile reports for | 2751 // information that can be used for better profile reports for |
2747 // dynamically generated code. | 2752 // dynamically generated code. |
2748 DART_EXPORT void Dart_InitPprofSupport(); | 2753 DART_EXPORT void Dart_InitPprofSupport(); |
2749 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 2754 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
2750 | 2755 |
2751 typedef void (*Dart_FileWriterFunction)(const char* buffer, int64_t num_bytes); | 2756 typedef void (*Dart_FileWriterFunction)(const char* buffer, int64_t num_bytes); |
2752 | 2757 |
2753 // Support for generating symbol maps for use by the Linux perf tool. | 2758 // Support for generating symbol maps for use by the Linux perf tool. |
2754 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function); | 2759 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function); |
2755 | 2760 |
2761 // --- Heap tracing support --- | |
2762 | |
2763 DART_EXPORT void Dart_InitHeapTrace(Dart_FileOpenCallback open_function, | |
Ivan Posva
2012/12/04 16:32:52
Shouldn't we just register a general open, write a
cshapiro
2012/12/04 21:13:33
Sure, I can do that. I would like the streams for
| |
2764 Dart_FileWriteCallback write_function, | |
2765 Dart_FileCloseCallback close_function, | |
2766 const char* prefix); | |
2767 | |
2756 // --- Peers --- | 2768 // --- Peers --- |
2757 | 2769 |
2758 /** | 2770 /** |
2759 * The peer field is a lazily allocated field intendend for storage of | 2771 * The peer field is a lazily allocated field intendend for storage of |
2760 * an uncommonly used values. Most instances types can have a peer | 2772 * an uncommonly used values. Most instances types can have a peer |
2761 * field allocated. The exceptions are subtypes of Null, num, and | 2773 * field allocated. The exceptions are subtypes of Null, num, and |
2762 * bool. | 2774 * bool. |
2763 */ | 2775 */ |
2764 | 2776 |
2765 /** | 2777 /** |
(...skipping 14 matching lines...) Expand all Loading... | |
2780 * | 2792 * |
2781 * \param object An object. | 2793 * \param object An object. |
2782 * \param peer A value to store in the peer field. | 2794 * \param peer A value to store in the peer field. |
2783 * | 2795 * |
2784 * \return Returns an error if 'object' is a subtype of Null, num, or | 2796 * \return Returns an error if 'object' is a subtype of Null, num, or |
2785 * bool. | 2797 * bool. |
2786 */ | 2798 */ |
2787 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2799 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
2788 | 2800 |
2789 #endif // INCLUDE_DART_API_H_ | 2801 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |