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

Side by Side Diff: runtime/bin/main.cc

Issue 503363002: Defer execution of the main isolate's entry point until the message loop. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix test Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_debugger_api.h" 10 #include "include/dart_debugger_api.h"
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 if (Dart_IsError(result)) { 1118 if (Dart_IsError(result)) {
1119 ErrorExit(kErrorExitCode, 1119 ErrorExit(kErrorExitCode,
1120 "Error setting breakpoint at '%s': %s\n", 1120 "Error setting breakpoint at '%s': %s\n",
1121 breakpoint_at, 1121 breakpoint_at,
1122 Dart_GetError(result)); 1122 Dart_GetError(result));
1123 } 1123 }
1124 } 1124 }
1125 1125
1126 // Call _startIsolate in the isolate library to enable dispatching the 1126 // Call _startIsolate in the isolate library to enable dispatching the
1127 // initial startup message. 1127 // initial startup message.
1128 const intptr_t kNumIsolateArgs = 7; 1128 const intptr_t kNumIsolateArgs = 2;
1129 Dart_Handle isolate_args[kNumIsolateArgs]; 1129 Dart_Handle isolate_args[kNumIsolateArgs];
1130 isolate_args[0] = Dart_Null(); // no parent port 1130 isolate_args[0] = main_closure; // entryPoint
1131 isolate_args[1] = main_closure; // entryPoint 1131 isolate_args[1] = CreateRuntimeOptions(&dart_options); // args
1132 isolate_args[2] = CreateRuntimeOptions(&dart_options); // args
1133 isolate_args[3] = Dart_Null(); // no message
1134 isolate_args[4] = Dart_True(); // isSpawnUri
1135 isolate_args[5] = Dart_Null(); // no control port
1136 isolate_args[6] = Dart_Null(); // no capabilities
1137 1132
1138 Dart_Handle isolate_lib = Dart_LookupLibrary( 1133 Dart_Handle isolate_lib = Dart_LookupLibrary(
1139 Dart_NewStringFromCString("dart:isolate")); 1134 Dart_NewStringFromCString("dart:isolate"));
1140 result = Dart_Invoke(isolate_lib, 1135 result = Dart_Invoke(isolate_lib,
1141 Dart_NewStringFromCString("_startIsolate"), 1136 Dart_NewStringFromCString("_startMainIsolate"),
1142 kNumIsolateArgs, isolate_args); 1137 kNumIsolateArgs, isolate_args);
1143 DartExitOnError(result); 1138 DartExitOnError(result);
1144 1139
1145 // Keep handling messages until the last active receive port is closed. 1140 // Keep handling messages until the last active receive port is closed.
1146 result = Dart_RunLoop(); 1141 result = Dart_RunLoop();
1147 DartExitOnError(result); 1142 DartExitOnError(result);
1148 } 1143 }
1149 } 1144 }
1150 1145
1151 Dart_ExitScope(); 1146 Dart_ExitScope();
(...skipping 23 matching lines...) Expand all
1175 exit(Process::GlobalExitCode()); 1170 exit(Process::GlobalExitCode());
1176 } 1171 }
1177 1172
1178 } // namespace bin 1173 } // namespace bin
1179 } // namespace dart 1174 } // namespace dart
1180 1175
1181 int main(int argc, char** argv) { 1176 int main(int argc, char** argv) {
1182 dart::bin::main(argc, argv); 1177 dart::bin::main(argc, argv);
1183 UNREACHABLE(); 1178 UNREACHABLE();
1184 } 1179 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698