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

Unified Diff: runtime/vm/custom_isolate_test.cc

Issue 196443009: - First step in refactoring ports with the goal of moving (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/lib/isolate_patch.dart ('k') | runtime/vm/dart_api_impl.h » ('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 34429)
+++ runtime/vm/custom_isolate_test.cc (working copy)
@@ -26,7 +26,7 @@
static const char* kCustomIsolateScriptChars =
"import 'dart:isolate';\n"
"\n"
- "RawReceivePort mainPort;\n"
+ "final RawReceivePort mainPort = new RawReceivePort();\n"
"\n"
"echo(arg) native \"native_echo\";\n"
"\n"
@@ -170,18 +170,9 @@
Dart_EnterScope();
Dart_Handle result;
- // Reload all the test classes here.
- //
- // TODO(turnidge): Use the create isolate callback instead?
- Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
- NativeLookup);
+ Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url()));
EXPECT_VALID(lib);
- Dart_Handle recv_port = Dart_GetReceivePort(Dart_GetMainPortId());
- EXPECT_VALID(recv_port);
- result = Dart_SetField(lib, NewString("mainPort"), recv_port);
- EXPECT_VALID(result);
-
result = Dart_Invoke(lib, NewString(main_), 0, NULL);
EXPECT_VALID(result);
free(const_cast<char*>(main_));
@@ -287,17 +278,30 @@
Dart_Isolate new_isolate = TestCase::CreateTestIsolate();
EXPECT(new_isolate != NULL);
Dart_SetMessageNotifyCallback(&NotifyMessage);
- Dart_Port new_port = Dart_GetMainPortId();
+ Dart_EnterScope();
+ // Reload all the test classes here.
+ //
+ // TODO(turnidge): Use the create isolate callback instead?
+ Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
+ NativeLookup);
+ EXPECT_VALID(lib);
+ Dart_Handle main_port = Dart_GetField(lib, NewString("mainPort"));
+ EXPECT_VALID(main_port);
+ Dart_Port main_port_id;
+ Dart_Handle err = Dart_PortGetId(main_port, &main_port_id);
+ EXPECT_VALID(err);
+
OS::Print("-- Adding StartEvent to queue --\n");
event_queue->Add(new StartEvent(new_isolate, isolate_main));
// Restore the original isolate.
+ Dart_ExitScope();
Dart_ExitIsolate();
Dart_EnterIsolate(saved_isolate);
Dart_EnterScope();
- Dart_Handle send_port = Dart_NewSendPort(new_port);
+ Dart_Handle send_port = Dart_NewSendPort(main_port_id);
EXPECT_VALID(send_port);
Dart_SetReturnValue(args, send_port);
« no previous file with comments | « runtime/lib/isolate_patch.dart ('k') | runtime/vm/dart_api_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698