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

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

Issue 889443002: Service isolate rework take 2 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « runtime/bin/vmservice_impl.cc ('k') | runtime/lib/isolate.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 /* 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 INCLUDE_DART_API_H_ 7 #ifndef INCLUDE_DART_API_H_
8 #define INCLUDE_DART_API_H_ 8 #define INCLUDE_DART_API_H_
9 9
10 /** \mainpage Dart Embedding API Reference 10 /** \mainpage Dart Embedding API Reference
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 * 730 *
731 * \return The embedder returns NULL if the creation and 731 * \return The embedder returns NULL if the creation and
732 * initialization was not successful and the isolate if successful. 732 * initialization was not successful and the isolate if successful.
733 */ 733 */
734 typedef Dart_Isolate (*Dart_IsolateCreateCallback)(const char* script_uri, 734 typedef Dart_Isolate (*Dart_IsolateCreateCallback)(const char* script_uri,
735 const char* main, 735 const char* main,
736 const char* package_root, 736 const char* package_root,
737 void* callback_data, 737 void* callback_data,
738 char** error); 738 char** error);
739 739
740
741 /**
742 * The service isolate creation and initialization callback function.
743 *
744 * This callback, provided by the embedder, is called when the vm
745 * needs to create the service isolate. The callback should create an isolate
746 * by calling Dart_CreateIsolate and prepare the isolate to be used as
747 * the service isolate.
748 *
749 * When the function returns NULL, it is the responsibility of this
750 * function to ensure that Dart_ShutdownIsolate has been called if
751 * required.
752 *
753 * When the function returns NULL, the function should set *error to
754 * a malloc-allocated buffer containing a useful error message. The
755 * caller of this function (the vm) will make sure that the buffer is
756 * freed.
757 *
758 *
759 * \param error A structure into which the embedder can place a
760 * C string containing an error message in the case of failures.
761 *
762 * \return The embedder returns NULL if the creation and
763 * initialization was not successful and the isolate if successful.
764 */
765 typedef Dart_Isolate (*Dart_ServiceIsolateCreateCalback)(void* callback_data,
766 char** error);
767
768 /** 740 /**
769 * An isolate interrupt callback function. 741 * An isolate interrupt callback function.
770 * 742 *
771 * This callback, provided by the embedder, is called when an isolate 743 * This callback, provided by the embedder, is called when an isolate
772 * is interrupted as a result of a call to Dart_InterruptIsolate(). 744 * is interrupted as a result of a call to Dart_InterruptIsolate().
773 * When the callback is called, Dart_CurrentIsolate can be used to 745 * When the callback is called, Dart_CurrentIsolate can be used to
774 * figure out which isolate is being interrupted. 746 * figure out which isolate is being interrupted.
775 * 747 *
776 * \return The embedder returns true if the isolate should continue 748 * \return The embedder returns true if the isolate should continue
777 * execution. If the embedder returns false, the isolate will be 749 * execution. If the embedder returns false, the isolate will be
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 */ 838 */
867 DART_EXPORT bool Dart_Initialize( 839 DART_EXPORT bool Dart_Initialize(
868 Dart_IsolateCreateCallback create, 840 Dart_IsolateCreateCallback create,
869 Dart_IsolateInterruptCallback interrupt, 841 Dart_IsolateInterruptCallback interrupt,
870 Dart_IsolateUnhandledExceptionCallback unhandled_exception, 842 Dart_IsolateUnhandledExceptionCallback unhandled_exception,
871 Dart_IsolateShutdownCallback shutdown, 843 Dart_IsolateShutdownCallback shutdown,
872 Dart_FileOpenCallback file_open, 844 Dart_FileOpenCallback file_open,
873 Dart_FileReadCallback file_read, 845 Dart_FileReadCallback file_read,
874 Dart_FileWriteCallback file_write, 846 Dart_FileWriteCallback file_write,
875 Dart_FileCloseCallback file_close, 847 Dart_FileCloseCallback file_close,
876 Dart_EntropySource entropy_source, 848 Dart_EntropySource entropy_source);
877 Dart_ServiceIsolateCreateCalback service_create);
878 849
879 /** 850 /**
880 * Cleanup state in the VM before process termination. 851 * Cleanup state in the VM before process termination.
881 * 852 *
882 * \return True if cleanup is successful. 853 * \return True if cleanup is successful.
883 */ 854 */
884 DART_EXPORT bool Dart_Cleanup(); 855 DART_EXPORT bool Dart_Cleanup();
885 856
886 /** 857 /**
887 * Sets command line flags. Should be called before Dart_Initialize. 858 * Sets command line flags. Should be called before Dart_Initialize.
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 */ 2721 */
2751 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2722 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2752 2723
2753 2724
2754 /* 2725 /*
2755 * ======= 2726 * =======
2756 * Service 2727 * Service
2757 * ======= 2728 * =======
2758 */ 2729 */
2759 2730
2731
2732 #define DART_VM_SERVICE_ISOLATE_NAME "vm-service"
2733
2760 /** 2734 /**
2761 * Returns the Service isolate initialized and with the dart:vmservice library 2735 * Returns true if isolate is the service isolate.
2762 * loaded and booted.
2763 * 2736 *
2764 * This will call the embedder provided Dart_ServiceIsolateCreateCalback to 2737 * \param isolate An isolate
2765 * create the isolate.
2766 * 2738 *
2767 * After obtaining the service isolate the embedder specific glue code can 2739 * \return Returns true if 'isolate' is the service isolate.
2768 * be loaded in and the isolate can be run by the embedder.
2769 *
2770 * NOTE: It is not safe to call this from multiple threads concurrently.
2771 *
2772 * \return Returns NULL if an error occurred.
2773 */ 2740 */
2774 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data); 2741 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate);
2775 2742
2776 2743
2777 /** 2744 /**
2778 * Returns true if the service is enabled. False otherwise. 2745 * Returns the port that script load requests should be sent on.
2779 * 2746 *
2780 * \return Returns true if service is running. 2747 * \return Returns the port for load requests or ILLEGAL_PORT if the service
2748 * isolate failed to startup or does not support load requests.
2781 */ 2749 */
2782 DART_EXPORT bool Dart_IsServiceRunning(); 2750 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort();
2783 2751
2784 2752
2785 /** 2753 /**
2786 * A service request callback function. 2754 * A service request callback function.
2787 * 2755 *
2788 * These callbacks, registered by the embedder, are called when the VM receives 2756 * These callbacks, registered by the embedder, are called when the VM receives
2789 * a service request it can't handle and the service request command name 2757 * a service request it can't handle and the service request command name
2790 * matches one of the embedder registered handlers. 2758 * matches one of the embedder registered handlers.
2791 * 2759 *
2792 * \param name The service request command name. Always the first entry 2760 * \param name The service request command name. Always the first entry
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 * NOTE: If multiple callbacks with the same name are registered, only the 2810 * NOTE: If multiple callbacks with the same name are registered, only the
2843 * last callback registered will be remembered. 2811 * last callback registered will be remembered.
2844 */ 2812 */
2845 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 2813 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
2846 const char* name, 2814 const char* name,
2847 Dart_ServiceRequestCallback callback, 2815 Dart_ServiceRequestCallback callback,
2848 void* user_data); 2816 void* user_data);
2849 2817
2850 2818
2851 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2819 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « runtime/bin/vmservice_impl.cc ('k') | runtime/lib/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698