| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 // Custom Isolate Test. | 9 // Custom Isolate Test. |
| 10 // | 10 // |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 " completer.complete(port);\n" | 41 " completer.complete(port);\n" |
| 42 " return completer.future;\n" | 42 " return completer.future;\n" |
| 43 " }\n" | 43 " }\n" |
| 44 "\n" | 44 "\n" |
| 45 " static SendPort _start(entry)\n" | 45 " static SendPort _start(entry)\n" |
| 46 " native \"CustomIsolateImpl_start\";\n" | 46 " native \"CustomIsolateImpl_start\";\n" |
| 47 "\n" | 47 "\n" |
| 48 " String _entry;\n" | 48 " String _entry;\n" |
| 49 "}\n" | 49 "}\n" |
| 50 "\n" | 50 "\n" |
| 51 "interface CustomIsolate default CustomIsolateImpl {\n" | 51 "abstract class CustomIsolate {\n" |
| 52 " CustomIsolate(String entry);\n" | 52 " factory CustomIsolate(String entry) = CustomIsolateImpl;\n" |
| 53 "\n" | 53 "\n" |
| 54 " Future<SendPort> spawn();\n" | 54 " Future<SendPort> spawn();\n" |
| 55 "}\n" | 55 "}\n" |
| 56 "\n" | 56 "\n" |
| 57 "isolateMain() {\n" | 57 "isolateMain() {\n" |
| 58 " echo('Running isolateMain');\n" | 58 " echo('Running isolateMain');\n" |
| 59 " mainPort.receive((message, SendPort replyTo) {\n" | 59 " mainPort.receive((message, SendPort replyTo) {\n" |
| 60 " echo('Received: $message');\n" | 60 " echo('Received: $message');\n" |
| 61 " replyTo.send((message + 1), null);\n" | 61 " replyTo.send((message + 1), null);\n" |
| 62 " });\n" | 62 " });\n" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 OS::Print("-- Finished event loop --\n"); | 337 OS::Print("-- Finished event loop --\n"); |
| 338 EXPECT_STREQ("Received: 43", saved_echo); | 338 EXPECT_STREQ("Received: 43", saved_echo); |
| 339 free(const_cast<char*>(saved_echo)); | 339 free(const_cast<char*>(saved_echo)); |
| 340 | 340 |
| 341 delete event_queue; | 341 delete event_queue; |
| 342 } | 342 } |
| 343 | 343 |
| 344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 345 | 345 |
| 346 } // namespace dart | 346 } // namespace dart |
| OLD | NEW |