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

Unified Diff: runtime/bin/main.cc

Issue 13452007: Add new Dart API call Dart_MakeIsolateRunnable(). This would allow an (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') | runtime/include/dart_api.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
===================================================================
--- runtime/bin/main.cc (revision 20976)
+++ runtime/bin/main.cc (working copy)
@@ -422,19 +422,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();
@@ -476,17 +476,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(),
@@ -734,10 +745,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;
@@ -745,7 +757,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') | runtime/include/dart_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698