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

Unified Diff: runtime/vm/custom_isolate_test.cc

Issue 9642003: Start using Dart_SetField and Dart_GetField in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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/bin/socket.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/custom_isolate_test.cc
===================================================================
--- runtime/vm/custom_isolate_test.cc (revision 5182)
+++ runtime/vm/custom_isolate_test.cc (working copy)
@@ -26,14 +26,8 @@
static const char* kCustomIsolateScriptChars =
"#import('dart:isolate');\n"
"\n"
- "class GlobalsHack {\n"
- " static ReceivePort _receivePort;\n"
- "}\n"
+ "ReceivePort mainPort;\n"
"\n"
- "ReceivePort get receivePort() {\n"
- " return GlobalsHack._receivePort;\n"
- "}\n"
- "\n"
"echo(arg) native \"native_echo\";\n"
"\n"
"class CustomIsolateImpl implements CustomIsolate {\n"
@@ -62,7 +56,7 @@
"\n"
"isolateMain() {\n"
" echo('Running isolateMain');\n"
- " receivePort.receive((message, SendPort replyTo) {\n"
+ " mainPort.receive((message, SendPort replyTo) {\n"
" echo('Received: ' + message);\n"
" replyTo.send((message + 1), null);\n"
" });\n"
@@ -185,13 +179,7 @@
Dart_Handle recv_port = Dart_GetReceivePort(Dart_GetMainPortId());
EXPECT_VALID(recv_port);
-
- // TODO(turnidge): Provide a way to set a top-level variable from
- // the dart embedding api.
- Dart_Handle hidden = Dart_GetClass(lib, Dart_NewString("GlobalsHack"));
- EXPECT_VALID(hidden);
- result = Dart_SetStaticField(hidden, Dart_NewString("_receivePort"),
- recv_port);
+ result = Dart_SetField(lib, Dart_NewString("mainPort"), recv_port);
EXPECT_VALID(result);
result = Dart_InvokeStatic(lib,
« no previous file with comments | « runtime/bin/socket.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698