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 #include "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "include/dart_tools_api.h" | 9 #include "include/dart_tools_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 7545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7556 | 7556 |
7557 // Delete the native ports. | 7557 // Delete the native ports. |
7558 EXPECT(Dart_CloseNativePort(port_id1)); | 7558 EXPECT(Dart_CloseNativePort(port_id1)); |
7559 EXPECT(Dart_CloseNativePort(port_id2)); | 7559 EXPECT(Dart_CloseNativePort(port_id2)); |
7560 } | 7560 } |
7561 | 7561 |
7562 | 7562 |
7563 static Dart_Isolate RunLoopTestCallback(const char* script_name, | 7563 static Dart_Isolate RunLoopTestCallback(const char* script_name, |
7564 const char* main, | 7564 const char* main, |
7565 const char* package_root, | 7565 const char* package_root, |
| 7566 const char** package_map, |
7566 Dart_IsolateFlags* flags, | 7567 Dart_IsolateFlags* flags, |
7567 void* data, | 7568 void* data, |
7568 char** error) { | 7569 char** error) { |
7569 const char* kScriptChars = | 7570 const char* kScriptChars = |
7570 "import 'builtin';\n" | 7571 "import 'builtin';\n" |
7571 "import 'dart:isolate';\n" | 7572 "import 'dart:isolate';\n" |
7572 "void entry(message) {\n" | 7573 "void entry(message) {\n" |
7573 " var data = message[0];\n" | 7574 " var data = message[0];\n" |
7574 " var replyTo = message[1];\n" | 7575 " var replyTo = message[1];\n" |
7575 " if (data) {\n" | 7576 " if (data) {\n" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7630 } | 7631 } |
7631 | 7632 |
7632 | 7633 |
7633 // Common code for RunLoop_Success/RunLoop_Failure. | 7634 // Common code for RunLoop_Success/RunLoop_Failure. |
7634 static void RunLoopTest(bool throw_exception_child, | 7635 static void RunLoopTest(bool throw_exception_child, |
7635 bool throw_exception_parent) { | 7636 bool throw_exception_parent) { |
7636 Dart_IsolateCreateCallback saved = Isolate::CreateCallback(); | 7637 Dart_IsolateCreateCallback saved = Isolate::CreateCallback(); |
7637 Isolate::SetCreateCallback(RunLoopTestCallback); | 7638 Isolate::SetCreateCallback(RunLoopTestCallback); |
7638 Isolate::SetUnhandledExceptionCallback(RunLoopUnhandledExceptionCallback); | 7639 Isolate::SetUnhandledExceptionCallback(RunLoopUnhandledExceptionCallback); |
7639 Dart_Isolate isolate = RunLoopTestCallback( | 7640 Dart_Isolate isolate = RunLoopTestCallback( |
7640 NULL, NULL, NULL, NULL, NULL, NULL); | 7641 NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
7641 | 7642 |
7642 Dart_EnterIsolate(isolate); | 7643 Dart_EnterIsolate(isolate); |
7643 Dart_EnterScope(); | 7644 Dart_EnterScope(); |
7644 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url())); | 7645 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url())); |
7645 EXPECT_VALID(lib); | 7646 EXPECT_VALID(lib); |
7646 | 7647 |
7647 Dart_Handle result; | 7648 Dart_Handle result; |
7648 Dart_Handle args[2]; | 7649 Dart_Handle args[2]; |
7649 args[0] = (throw_exception_child ? Dart_True() : Dart_False()); | 7650 args[0] = (throw_exception_child ? Dart_True() : Dart_False()); |
7650 args[1] = (throw_exception_parent ? Dart_True() : Dart_False()); | 7651 args[1] = (throw_exception_parent ? Dart_True() : Dart_False()); |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9778 | 9779 |
9779 // Heartbeat test for new events. | 9780 // Heartbeat test for new events. |
9780 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer); | 9781 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer); |
9781 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer); | 9782 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer); |
9782 | 9783 |
9783 // Free buffer allocated by AppendStreamConsumer | 9784 // Free buffer allocated by AppendStreamConsumer |
9784 free(data.buffer); | 9785 free(data.buffer); |
9785 } | 9786 } |
9786 | 9787 |
9787 } // namespace dart | 9788 } // namespace dart |
OLD | NEW |