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

Unified Diff: runtime/bin/main.cc

Issue 11362103: Rotating spheres sample (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More cleanup Created 8 years, 1 month 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/bin.gypi ('k') | runtime/bin/main_android.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 c464a43b21e6952e256c4861e189b8de2654f467..2aa8c440aec535d7b8bcdf7d1231b78bb966585d 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -548,8 +548,8 @@ static void ShutdownIsolate(void* callback_data) {
delete isolate_data;
}
-
-int main(int argc, char** argv) {
+DART_EXPORT
+int Dart_SO_Start(int argc, char** argv, Dart_Isolate* pmain_isolate) {
char* executable_name;
char* script_name;
CommandLineOptions vm_options(argc);
@@ -559,6 +559,7 @@ int main(int argc, char** argv) {
// Perform platform specific initialization.
if (!Platform::Initialize()) {
fprintf(stderr, "Initialization failed\n");
+ return kErrorExitCode;
}
// Parse command line arguments.
@@ -607,6 +608,7 @@ int main(int argc, char** argv) {
Dart_Isolate isolate = Dart_CurrentIsolate();
ASSERT(isolate != NULL);
+ *pmain_isolate = isolate;
Dart_Handle result;
Dart_EnterScope();
@@ -646,8 +648,25 @@ int main(int argc, char** argv) {
DebuggerConnectionHandler::StartHandler(debug_ip, debug_port);
}
+ Dart_ExitScope();
+ Dart_ExitIsolate();
+
+ return 0;
+}
+
+DART_EXPORT
+int Dart_SO_MainLoop(Dart_Isolate isolate) {
+ Dart_EnterIsolate(isolate);
+ Dart_EnterScope();
+
+ // Lookup the library of the root script.
+ Dart_Handle library = Dart_RootLibrary();
+ if (Dart_IsNull(library)) {
+ return ErrorExit("Unable to find root library\n");
+ }
+
// Lookup and invoke the top level main function.
- result = Dart_Invoke(library, Dart_NewString("main"), 0, NULL);
+ Dart_Handle result = Dart_Invoke(library, Dart_NewString("main"), 0, NULL);
if (Dart_IsError(result)) {
return ErrorExit("%s\n", Dart_GetError(result));
}
@@ -658,6 +677,13 @@ int main(int argc, char** argv) {
}
Dart_ExitScope();
+ Dart_ExitIsolate();
+ return 0;
+}
+
+DART_EXPORT
+int Dart_SO_Finish(Dart_Isolate isolate) {
+ Dart_EnterIsolate(isolate);
// Dump symbol information for the profiler.
DumpPprofSymbolInfo();
// Shutdown the isolate.
@@ -667,3 +693,19 @@ int main(int argc, char** argv) {
return 0;
}
+
+int main(int argc, char** argv) {
+ Dart_Isolate main_isolate;
+ int result = Dart_SO_Start(argc, argv, &main_isolate);
+ if (result != 0) {
+ return result;
+ }
+
+ result = Dart_SO_MainLoop(main_isolate);
+ if (result != 0) {
+ return result;
+ }
+
+ result = Dart_SO_Finish(main_isolate);
+ return result;
+}
« no previous file with comments | « runtime/bin/bin.gypi ('k') | runtime/bin/main_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698