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

Unified Diff: runtime/bin/main.cc

Issue 13813018: Changelist to land https://codereview.chromium.org/13452007/ for Siva. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/include/dart_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
===================================================================
--- runtime/bin/main.cc (revision 21158)
+++ runtime/bin/main.cc (working copy)
@@ -427,19 +427,19 @@
*error = strdup(Dart_GetError(result)); \
Dart_ExitScope(); \
Dart_ShutdownIsolate(); \
- return false; \
+ return NULL; \
} \
// Returns true on success, false on failure.
-static bool CreateIsolateAndSetupHelper(const char* script_uri,
- const char* main,
- void* data,
- char** error) {
+static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
+ const char* main,
+ void* data,
+ char** error) {
Dart_Isolate isolate =
Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error);
if (isolate == NULL) {
- return false;
+ return NULL;
}
Dart_EnterScope();
@@ -481,17 +481,28 @@
*error = strdup(errbuf);
Dart_ExitScope();
Dart_ShutdownIsolate();
- return false;
+ return NULL;
}
+
+ // Make the isolate runnable so that it is ready to handle messages.
Dart_ExitScope();
+ Dart_ExitIsolate();
+ bool retval = Dart_IsolateMakeRunnable(isolate);
+ if (!retval) {
+ *error = strdup("Invalid isolate state - Unable to make it runnable");
+ Dart_EnterIsolate(isolate);
+ Dart_ShutdownIsolate();
+ return NULL;
+ }
+
VmStats::AddIsolate(reinterpret_cast<IsolateData*>(data), isolate);
- return true;
+ return isolate;
}
-static bool CreateIsolateAndSetup(const char* script_uri,
- const char* main,
- void* data, char** error) {
+static Dart_Isolate CreateIsolateAndSetup(const char* script_uri,
+ const char* main,
+ void* data, char** error) {
return CreateIsolateAndSetupHelper(script_uri,
main,
new IsolateData(),
@@ -744,10 +755,11 @@
// the specified application script.
char* error = NULL;
char* isolate_name = BuildIsolateName(script_name, "main");
- if (!CreateIsolateAndSetupHelper(script_name,
- "main",
- new IsolateData(),
- &error)) {
+ Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name,
+ "main",
+ new IsolateData(),
+ &error);
+ if (isolate == NULL) {
Log::PrintErr("%s\n", error);
free(error);
delete [] isolate_name;
@@ -755,7 +767,8 @@
}
delete [] isolate_name;
- Dart_Isolate isolate = Dart_CurrentIsolate();
+ Dart_EnterIsolate(isolate);
+ ASSERT(isolate == Dart_CurrentIsolate());
ASSERT(isolate != NULL);
Dart_Handle result;
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698