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

Unified Diff: runtime/lib/isolate.cc

Issue 9242035: Give isolates names to be used during debugging. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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
Index: runtime/lib/isolate.cc
===================================================================
--- runtime/lib/isolate.cc (revision 3367)
+++ runtime/lib/isolate.cc (working copy)
@@ -248,6 +248,25 @@
}
+static char* BuildIsolateName(const char* script_name,
+ const char* class_name,
+ const char* func_name) {
+ // Skip past any slashes in the script name.
+ const char* last_slash = strrchr(script_name, '/');
+ if (last_slash != NULL) {
+ script_name = last_slash + 1;
+ }
+
+ const char* kFormat = "%s/%s.%s";
+ intptr_t len = OS::SNPrint(NULL, 0, kFormat, script_name, class_name,
+ func_name) + 1;
+ char* chars = reinterpret_cast<char*>(
+ Isolate::Current()->current_zone()->Allocate(len));
+ OS::SNPrint(chars, len, kFormat, script_name, class_name, func_name);
+ return chars;
+}
+
+
DEFINE_NATIVE_ENTRY(IsolateNatives_start, 2) {
Isolate* preserved_isolate = Isolate::Current();
const Instance& runnable = Instance::CheckedHandle(arguments->At(0));
@@ -263,9 +282,10 @@
void* callback_data = preserved_isolate->init_callback_data();
char* error = NULL;
Dart_IsolateCreateCallback callback = Isolate::CreateCallback();
+ const char* isolate_name = BuildIsolateName(library_url, class_name, "main");
if (callback == NULL) {
error = strdup("Null callback specified for isolate creation\n");
- } else if (callback(callback_data, &error)) {
+ } else if (callback(isolate_name, callback_data, &error)) {
spawned_isolate = Isolate::Current();
ASSERT(spawned_isolate != NULL);
// Check arguments to see if the specified library and classes are
« runtime/include/dart_api.h ('K') | « runtime/include/dart_api.h ('k') | runtime/vm/dart.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698