| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 " completer.complete(port);\n" | 44 " completer.complete(port);\n" |
| 45 " return completer.future;\n" | 45 " return completer.future;\n" |
| 46 " }\n" | 46 " }\n" |
| 47 "\n" | 47 "\n" |
| 48 " static SendPort _start(entry)\n" | 48 " static SendPort _start(entry)\n" |
| 49 " native \"CustomIsolateImpl_start\";\n" | 49 " native \"CustomIsolateImpl_start\";\n" |
| 50 "\n" | 50 "\n" |
| 51 " String _entry;\n" | 51 " String _entry;\n" |
| 52 "}\n" | 52 "}\n" |
| 53 "\n" | 53 "\n" |
| 54 "interface CustomIsolate factory CustomIsolateImpl {\n" | 54 "interface CustomIsolate default CustomIsolateImpl {\n" |
| 55 " CustomIsolate(String entry);\n" | 55 " CustomIsolate(String entry);\n" |
| 56 "\n" | 56 "\n" |
| 57 " Future<SendPort> spawn();\n" | 57 " Future<SendPort> spawn();\n" |
| 58 "}\n" | 58 "}\n" |
| 59 "\n" | 59 "\n" |
| 60 "isolateMain() {\n" | 60 "isolateMain() {\n" |
| 61 " echo('Running isolateMain');\n" | 61 " echo('Running isolateMain');\n" |
| 62 " receivePort.receive((message, SendPort replyTo) {\n" | 62 " receivePort.receive((message, SendPort replyTo) {\n" |
| 63 " echo('Received: ' + message);\n" | 63 " echo('Received: ' + message);\n" |
| 64 " replyTo.send((message + 1), null);\n" | 64 " replyTo.send((message + 1), null);\n" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 OS::Print("-- Finished event loop --\n"); | 420 OS::Print("-- Finished event loop --\n"); |
| 421 EXPECT_STREQ("Received: 43", saved_echo); | 421 EXPECT_STREQ("Received: 43", saved_echo); |
| 422 free(const_cast<char*>(saved_echo)); | 422 free(const_cast<char*>(saved_echo)); |
| 423 | 423 |
| 424 delete event_queue; | 424 delete event_queue; |
| 425 } | 425 } |
| 426 | 426 |
| 427 #endif // TARGET_ARCH_IA32. | 427 #endif // TARGET_ARCH_IA32. |
| 428 | 428 |
| 429 } // namespace dart | 429 } // namespace dart |
| OLD | NEW |