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

Unified Diff: runtime/vm/isolate.cc

Issue 1007863003: Allow Observatory debugger to switch isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | « runtime/vm/isolate.h ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index cb5b63d11c36867926f4dc2bbb2f7bcdb9c13493..5d1813d51527bdd1b0a6ece37ef8d69bced1b26c 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -541,6 +541,7 @@ Isolate::Isolate()
store_buffer_(),
message_notify_callback_(NULL),
name_(NULL),
+ debugger_name_(NULL),
start_time_(OS::GetCurrentTimeMicros()),
main_port_(0),
origin_id_(0),
@@ -609,6 +610,7 @@ Isolate::Isolate(Isolate* original)
class_table_(original->class_table()),
message_notify_callback_(NULL),
name_(NULL),
+ debugger_name_(NULL),
start_time_(OS::GetCurrentTimeMicros()),
main_port_(0),
pause_capability_(0),
@@ -666,6 +668,7 @@ Isolate::Isolate(Isolate* original)
Isolate::~Isolate() {
free(name_);
+ free(debugger_name_);
delete heap_;
delete object_store_;
delete api_state_;
@@ -771,7 +774,6 @@ Isolate* Isolate::Init(const char* name_prefix, bool is_vm_isolate) {
result->set_terminate_capability(result->random()->NextUInt64());
result->BuildName(name_prefix);
-
result->debugger_ = new Debugger();
result->debugger_->Initialize(result);
if (FLAG_trace_isolates) {
@@ -815,11 +817,18 @@ uword Isolate::GetCurrentStackPointer() {
}
+void Isolate::set_debugger_name(const char* name) {
+ free(debugger_name_);
+ debugger_name_ = strdup(name);
+}
+
+
void Isolate::BuildName(const char* name_prefix) {
ASSERT(name_ == NULL);
if (name_prefix == NULL) {
name_prefix = "isolate";
}
+ set_debugger_name(name_prefix);
if (ServiceIsolate::NameEquals(name_prefix)) {
name_ = strdup(name_prefix);
return;
@@ -931,6 +940,7 @@ void Isolate::DoneLoading() {
bool Isolate::MakeRunnable() {
ASSERT(Isolate::Current() == NULL);
+
MutexLocker ml(mutex_);
// Check if we are in a valid state to make the isolate runnable.
if (is_runnable_ == true) {
@@ -1535,23 +1545,16 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) {
jsobj.AddProperty("type", (ref ? "@Isolate" : "Isolate"));
jsobj.AddPropertyF("id", "isolates/%" Pd "",
static_cast<intptr_t>(main_port()));
- jsobj.AddPropertyF("mainPort", "%" Pd "",
- static_cast<intptr_t>(main_port()));
- // Assign an isolate name based on the entry function.
- IsolateSpawnState* state = spawn_state();
- if (state == NULL) {
- jsobj.AddPropertyF("name", "root");
- } else if (state->class_name() != NULL) {
- jsobj.AddPropertyF("name", "%s.%s",
- state->class_name(),
- state->function_name());
- } else {
- jsobj.AddPropertyF("name", "%s", state->function_name());
- }
+ jsobj.AddProperty("name", debugger_name());
+ jsobj.AddPropertyF("number", "%" Pd "",
+ static_cast<intptr_t>(main_port()));
if (ref) {
return;
}
+ int64_t start_time_millis = start_time() / kMicrosecondsPerMillisecond;
+ jsobj.AddProperty64("startTime", start_time_millis);
+ IsolateSpawnState* state = spawn_state();
if (state != NULL) {
const Object& entry = Object::Handle(this, state->ResolveFunction());
if (!entry.IsNull() && entry.IsFunction()) {
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698