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

Unified Diff: runtime/bin/main.cc

Issue 456983002: Refactor isolate startup code in preparation for making isolate spawning more truly non-blocking. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 4 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 | « no previous file | runtime/lib/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 46f0652268da0110c17c7e1dcfdaf91884011954..4c3c7dd3aa5d32059bf2066206749917b654f670 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -1125,29 +1125,22 @@ void main(int argc, char** argv) {
// Call _startIsolate in the isolate library to enable dispatching the
// initial startup message.
- Dart_Handle isolate_args[2];
- isolate_args[0] = main_closure;
- isolate_args[1] = Dart_True();
+ const intptr_t kNumIsolateArgs = 7;
+ Dart_Handle isolate_args[kNumIsolateArgs];
+ isolate_args[0] = Dart_Null(); // no parent port
+ isolate_args[1] = main_closure; // entryPoint
+ isolate_args[2] = CreateRuntimeOptions(&dart_options); // args
+ isolate_args[3] = Dart_Null(); // no message
+ isolate_args[4] = Dart_True(); // isSpawnUri
+ isolate_args[5] = Dart_Null(); // no control port
+ isolate_args[6] = Dart_Null(); // no capabilities
Dart_Handle isolate_lib = Dart_LookupLibrary(
Dart_NewStringFromCString("dart:isolate"));
result = Dart_Invoke(isolate_lib,
Dart_NewStringFromCString("_startIsolate"),
- 2, isolate_args);
-
- // Setup the arguments in the initial startup message and leave the
- // replyTo and message fields empty.
- Dart_Handle initial_startup_msg = Dart_NewList(3);
- result = Dart_ListSetAt(initial_startup_msg, 1,
- CreateRuntimeOptions(&dart_options));
+ kNumIsolateArgs, isolate_args);
DartExitOnError(result);
- Dart_Port main_port = Dart_GetMainPortId();
- bool posted = Dart_Post(main_port, initial_startup_msg);
- if (!posted) {
- ErrorExit(kErrorExitCode,
- "Failed posting startup message to main "
- "isolate control port.");
- }
// Keep handling messages until the last active receive port is closed.
result = Dart_RunLoop();
« no previous file with comments | « no previous file | runtime/lib/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698