25 bool* auto_setup_scope);
29 import 'dart:isolate';
31 final RawReceivePort mainPort = new RawReceivePort();
32 final SendPort mainSendPort = mainPort.sendPort;
34 @pragma('vm:external-name', 'native_echo')
35 external void echo(arg);
37 class CustomIsolateImpl implements CustomIsolate {
38 CustomIsolateImpl(String entry) : _entry = entry {
39 echo('Constructing isolate');
43 return _start(_entry);
46 @pragma('vm:external-name', 'CustomIsolateImpl_start')
47 external static SendPort _start(entry);
52 abstract class CustomIsolate {
53 factory CustomIsolate(String entry) = CustomIsolateImpl;
59 echo('Running isolateMain');
60 mainPort.handler = (message) {
61 var data = message[0];
62 var replyTo = message[1];
63 echo('Received: $data');
64 replyTo.send(data + 1);
70 var isolate = new CustomIsolate("isolateMain");
71 var receivePort = new RawReceivePort();
72 SendPort port = isolate.spawn();
73 port.send([42, receivePort.sendPort]);
74 receivePort.handler = (message) {
76 echo('Received: $message');
105 if (head_ ==
nullptr) {
109 tail_->next_ =
event;
115 if (head_ ==
nullptr) {
119 head_ = head_->next_;
120 if (head_ ==
nullptr) {
131 while (cur !=
nullptr) {
133 if (cur->
isolate() == isolate) {
135 if (
prev !=
nullptr) {
179 free(
const_cast<char*
>(main_));
219 OS::PrintErr(
"-- Notify isolate(%p) of pending message --\n", dest_isolate);
226 bool* auto_setup_scope) {
227 ASSERT(auto_setup_scope !=
nullptr);
228 *auto_setup_scope =
true;
229 const char* name_str =
nullptr;
232 if (strcmp(name_str,
"native_echo") == 0) {
234 }
else if (strcmp(name_str,
"CustomIsolateImpl_start") == 0) {
246 const char* c_str =
nullptr;
266 const char* isolate_main =
nullptr;
276 EXPECT(new_isolate !=
nullptr);
310 bool saved_flag = FLAG_trace_shutdown;
311 FLAG_trace_shutdown =
true;
315 EXPECT(dart_isolate !=
nullptr);
329 const char* result_str =
nullptr;
331 EXPECT_STREQ(
"success", result_str);
338 while (
event !=
nullptr) {
349 FLAG_trace_shutdown = saved_flag;
static float next(float f)
static float prev(float f)
void RemoveEventsForIsolate(Dart_Isolate isolate)
Event(Dart_Isolate isolate)
Dart_Isolate isolate() const
MessageEvent(Dart_Isolate isolate)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
StartEvent(Dart_Isolate isolate, const char *main)
static Dart_Handle LoadTestScript(const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri=RESOLVED_USER_TEST_URI, bool finalize=true, bool allow_compile_errors=false)
static const char * url()
static Dart_Isolate CreateTestIsolate(const char *name=nullptr, void *isolate_group_data=nullptr, void *isolate_data=nullptr)
static char * StrDup(const char *s)
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
struct _Dart_NativeArguments * Dart_NativeArguments
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
DART_EXPORT void Dart_EnterScope()
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
static void NotifyMessage(Dart_Isolate dest_isolate)
static void native_echo(Dart_NativeArguments args)
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name)
DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object)
DART_EXPORT Dart_Isolate Dart_CurrentIsolate()
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id)
static const char * kCustomIsolateScriptChars
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT void Dart_ExitIsolate()
Dart_Handle NewString(const char *str)
DART_EXPORT void Dart_ExitScope()
static Dart_NativeFunction NativeLookup(Dart_Handle name, int argc, bool *auto_setup_scope)
DART_EXPORT void Dart_SetMessageNotifyCallback(Dart_MessageNotifyCallback message_notify_callback)
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args)
DART_EXPORT bool Dart_IsString(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, const char **cstr)
DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, Dart_Port *port_id)
DART_EXPORT void Dart_ShutdownIsolate()
DART_EXPORT bool Dart_HasLivePorts()
static void CustomIsolateImpl_start(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_HandleMessage()
DECLARE_FLAG(bool, show_invisible_frames)
VM_UNIT_TEST_CASE(DirectoryCurrentNoScope)
#define EXPECT_VALID(handle)