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

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

Issue 11442024: Unify specification of file open, close, and write callbacks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « runtime/bin/run_vm_tests.cc ('k') | runtime/vm/code_observers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 * \param callback A function pointer to an epilogue callback 524 * \param callback A function pointer to an epilogue callback
525 * function. This function must have been added as an epilogue 525 * function. This function must have been added as an epilogue
526 * callback. 526 * callback.
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 ---
535
536 /**
537 * A callback invoked by the heap profiler during profiling to write
538 * data.
539 */
540 typedef void (*Dart_HeapProfileWriteCallback)(const void* data,
541 intptr_t length,
542 void* stream);
543
544 /**
545 * Generates a heap profile.
546 *
547 * \param callback A function pointer that will be repeatedly invoked
548 * with heap profile data.
549 * \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.
551 *
552 * \return Success if the heap profile is successful.
553 */
554 DART_EXPORT Dart_Handle Dart_HeapProfile(Dart_HeapProfileWriteCallback callback,
555 void* stream);
556
557 // --- Initialization and Globals --- 534 // --- Initialization and Globals ---
558 535
559 /** 536 /**
560 * Gets the version string for the Dart VM. 537 * Gets the version string for the Dart VM.
561 * 538 *
562 * The version of the Dart VM can be accessed without initializing the VM. 539 * The version of the Dart VM can be accessed without initializing the VM.
563 * 540 *
564 * \return The version string for the embedded Dart VM. 541 * \return The version string for the embedded Dart VM.
565 */ 542 */
566 DART_EXPORT const char* Dart_VersionString(); 543 DART_EXPORT const char* Dart_VersionString();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 * 620 *
644 * This function should be used to dispose of native resources that 621 * This function should be used to dispose of native resources that
645 * are allocated to an isolate in order to avoid leaks. 622 * are allocated to an isolate in order to avoid leaks.
646 * 623 *
647 * \param callback_data The same callback data which was passed to the 624 * \param callback_data The same callback data which was passed to the
648 * isolate when it was created. 625 * isolate when it was created.
649 * 626 *
650 */ 627 */
651 typedef void (*Dart_IsolateShutdownCallback)(void* callback_data); 628 typedef void (*Dart_IsolateShutdownCallback)(void* callback_data);
652 629
630 typedef void* (*Dart_FileOpenCallback)(const char* name);
631
632 typedef void (*Dart_FileWriteCallback)(const void* data,
633 intptr_t length,
634 void* stream);
635
636 typedef void (*Dart_FileCloseCallback)(void* stream);
637
638
653 /** 639 /**
654 * Initializes the VM. 640 * Initializes the VM.
655 * 641 *
656 * \param create A function to be called during isolate creation. 642 * \param create A function to be called during isolate creation.
657 * See Dart_IsolateCreateCallback. 643 * See Dart_IsolateCreateCallback.
658 * \param interrupt A function to be called when an isolate is interrupted. 644 * \param interrupt A function to be called when an isolate is interrupted.
659 * See Dart_IsolateInterruptCallback. 645 * See Dart_IsolateInterruptCallback.
660 * \param unhandled_exception A function to be called if an isolate has an 646 * \param unhandled_exception A function to be called if an isolate has an
661 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. 647 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback.
662 * \param shutdown A function to be called when an isolate is shutdown. 648 * \param shutdown A function to be called when an isolate is shutdown.
663 * See Dart_IsolateShutdownCallback. 649 * See Dart_IsolateShutdownCallback.
664 * 650 *
665 * \return True if initialization is successful. 651 * \return True if initialization is successful.
666 */ 652 */
667 DART_EXPORT bool Dart_Initialize( 653 DART_EXPORT bool Dart_Initialize(
668 Dart_IsolateCreateCallback create, 654 Dart_IsolateCreateCallback create,
669 Dart_IsolateInterruptCallback interrupt, 655 Dart_IsolateInterruptCallback interrupt,
670 Dart_IsolateUnhandledExceptionCallback unhandled_exception, 656 Dart_IsolateUnhandledExceptionCallback unhandled_exception,
671 Dart_IsolateShutdownCallback shutdown); 657 Dart_IsolateShutdownCallback shutdown,
658 Dart_FileOpenCallback file_open,
659 Dart_FileWriteCallback file_write,
660 Dart_FileCloseCallback file_close);
672 661
673 /** 662 /**
674 * Sets command line flags. Should be called before Dart_Initialize. 663 * Sets command line flags. Should be called before Dart_Initialize.
675 * 664 *
676 * \param argc The length of the arguments array. 665 * \param argc The length of the arguments array.
677 * \param argv An array of arguments. 666 * \param argv An array of arguments.
678 * 667 *
679 * \return True if VM flags set successfully. 668 * \return True if VM flags set successfully.
680 */ 669 */
681 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); 670 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv);
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 // TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? 2717 // TODO(turnidge): Rename to Dart_LibrarySetNativeResolver?
2729 2718
2730 // --- Profiling support ---- 2719 // --- Profiling support ----
2731 2720
2732 // External pprof support for gathering and dumping symbolic 2721 // External pprof support for gathering and dumping symbolic
2733 // information that can be used for better profile reports for 2722 // information that can be used for better profile reports for
2734 // dynamically generated code. 2723 // dynamically generated code.
2735 DART_EXPORT void Dart_InitPprofSupport(); 2724 DART_EXPORT void Dart_InitPprofSupport();
2736 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); 2725 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size);
2737 2726
2738 typedef void (*Dart_FileWriterFunction)(const char* buffer, int64_t num_bytes); 2727 // Support for generating symbol maps for use by the Linux perf tool.
2728 DART_EXPORT void Dart_InitPerfEventsSupport(void* perf_events_file);
2739 2729
2740 // Support for generating symbol maps for use by the Linux perf tool. 2730 // --- Heap Profiler ---
2741 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function); 2731
2732 /**
2733 * Generates a heap profile.
2734 *
2735 * \param callback A function pointer that will be repeatedly invoked
2736 * with heap profile data.
2737 * \param stream A pointer that will be passed to the callback. This
2738 * is a convenient way to provide an open stream to the callback.
2739 *
2740 * \return Success if the heap profile is successful.
2741 */
2742 DART_EXPORT Dart_Handle Dart_HeapProfile(Dart_FileWriteCallback callback,
2743 void* stream);
2742 2744
2743 // --- Peers --- 2745 // --- Peers ---
2744 2746
2745 /** 2747 /**
2746 * The peer field is a lazily allocated field intendend for storage of 2748 * The peer field is a lazily allocated field intendend for storage of
2747 * an uncommonly used values. Most instances types can have a peer 2749 * an uncommonly used values. Most instances types can have a peer
2748 * field allocated. The exceptions are subtypes of Null, num, and 2750 * field allocated. The exceptions are subtypes of Null, num, and
2749 * bool. 2751 * bool.
2750 */ 2752 */
2751 2753
(...skipping 15 matching lines...) Expand all
2767 * 2769 *
2768 * \param object An object. 2770 * \param object An object.
2769 * \param peer A value to store in the peer field. 2771 * \param peer A value to store in the peer field.
2770 * 2772 *
2771 * \return Returns an error if 'object' is a subtype of Null, num, or 2773 * \return Returns an error if 'object' is a subtype of Null, num, or
2772 * bool. 2774 * bool.
2773 */ 2775 */
2774 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2776 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2775 2777
2776 #endif // INCLUDE_DART_API_H_ 2778 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « runtime/bin/run_vm_tests.cc ('k') | runtime/vm/code_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698