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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 3524d71d498f9b03b90ad9e54ed790521a0450b5..93b658fe576412e5acf8b13fdb3b59d1625e6f7e 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -3672,22 +3672,24 @@ TEST_CASE(NegativeNativeFieldInIsolateMessage) {
const char* kScriptChars =
"import 'dart:isolate';\n"
"import 'dart:nativewrappers';\n"
- "echo() {\n"
- " port.receive((msg, reply) {\n"
- " reply.send('echoing ${msg(1)}}');\n"
- " });\n"
+ "echo(msg) {\n"
+ " var data = msg[0];\n"
+ " var reply = msg[1];\n"
+ " reply.send('echoing ${data(1)}}');\n"
"}\n"
"class Test extends NativeFieldWrapperClass2 {\n"
" Test(this.i, this.j);\n"
" int i, j;\n"
"}\n"
"main() {\n"
- " var snd = spawnFunction(echo);\n"
+ " var port = new RawReceivePort();\n"
" var obj = new Test(1,2);\n"
- " snd.send(obj, port.toSendPort());\n"
- " port.receive((msg, reply) {\n"
+ " var msg = [obj, port.sendPort];\n"
+ " var snd = Isolate.spawn(echo, msg);\n"
+ " port.handler = (msg) {\n"
+ " port.close();\n"
" print('from worker ${msg}');\n"
- " });\n"
+ " };\n"
"}\n";
DARTSCOPE(Isolate::Current());
@@ -5780,12 +5782,12 @@ UNIT_TEST_CASE(NewNativePort) {
const char* kScriptChars =
"import 'dart:isolate';\n"
"void callPort(SendPort port) {\n"
- " var receivePort = new ReceivePort();\n"
- " port.send(null, receivePort.toSendPort());\n"
- " receivePort.receive((message, _) {\n"
+ " var receivePort = new RawReceivePort();\n"
+ " port.send(null, receivePort.sendPort);\n"
+ " receivePort.handler = (message) {\n"
" receivePort.close();\n"
" throw new Exception(message);\n"
- " });\n"
+ " };\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
Dart_EnterScope();
@@ -5834,26 +5836,24 @@ static Dart_Isolate RunLoopTestCallback(const char* script_name,
const char* kScriptChars =
"import 'builtin';\n"
"import 'dart:isolate';\n"
- "void entry() {\n"
- " port.receive((message, replyTo) {\n"
- " if (message) {\n"
- " throw new Exception('MakeChildExit');\n"
- " } else {\n"
- " replyTo.call('hello');\n"
- " port.close();\n"
- " }\n"
- " });\n"
+ "void entry(message) {\n"
+ " var data = message[0];\n"
+ " var replyTo = message[1];\n"
+ " if (data) {\n"
+ " throw new Exception('MakeChildExit');\n"
+ " } else {\n"
+ " replyTo.send('hello');\n"
+ " }\n"
"}\n"
"\n"
"void main(exc_child, exc_parent) {\n"
- " var port = spawnFunction(entry);\n"
- " var receivePort = new ReceivePort();\n"
- " port.send(exc_child, receivePort.toSendPort());\n"
- " receivePort.receive((message, _) {\n"
+ " var receivePort = new RawReceivePort();\n"
+ " Isolate.spawn(entry, [exc_child, receivePort.sendPort]);\n"
+ " receivePort.handler = (message) {\n"
" receivePort.close();\n"
" if (message != 'hello') throw new Exception('ShouldNotHappen');\n"
" if (exc_parent) throw new Exception('MakeParentExit');\n"
- " });\n"
+ " };\n"
"}\n";
if (Dart_CurrentIsolate() != NULL) {
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698