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

Unified Diff: runtime/vm/service.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/object.cc ('k') | runtime/vm/service_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 5cb1721fe4c6f39d172614bfc4d55750c3bf79df..0a59f071f5621def10d86eba7b4f3cd03d58e13a 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -529,6 +529,7 @@ void Service::SetEventMask(uint32_t mask) {
void Service::SendEvent(intptr_t eventFamilyId,
intptr_t eventType,
const Object& eventMessage) {
+ ASSERT(!ServiceIsolate::IsServiceIsolate(Isolate::Current()));
if (!ServiceIsolate::IsRunning()) {
return;
}
@@ -591,6 +592,9 @@ void Service::SendEvent(intptr_t eventFamilyId,
void Service::HandleGCEvent(GCEvent* event) {
+ if (ServiceIsolate::IsServiceIsolate(Isolate::Current())) {
+ return;
+ }
JSONStream js;
event->PrintJSON(&js);
const String& message = String::Handle(String::New(js.ToCString()));
@@ -2438,7 +2442,6 @@ static bool GetVM(Isolate* isolate, JSONStream* js) {
jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord));
jsobj.AddProperty("targetCPU", CPU::Id());
jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware());
- jsobj.AddPropertyF("date", "%" Pd64 "", OS::GetCurrentTimeMillis());
jsobj.AddProperty("version", Version::String());
// Send pid as a string because it allows us to avoid any issues with
// pids > 53-bits (when consumed by JavaScript).
@@ -2446,12 +2449,10 @@ static bool GetVM(Isolate* isolate, JSONStream* js) {
jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId());
jsobj.AddProperty("assertsEnabled", isolate->AssertsEnabled());
jsobj.AddProperty("typeChecksEnabled", isolate->TypeChecksEnabled());
- int64_t start_time_micros = Dart::vm_isolate()->start_time();
- int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros);
- double seconds = (static_cast<double>(uptime_micros) /
- static_cast<double>(kMicrosecondsPerSecond));
- jsobj.AddProperty("uptime", seconds);
-
+ int64_t start_time_millis = (Dart::vm_isolate()->start_time() /
+ kMicrosecondsPerMillisecond);
+ jsobj.AddProperty64("refreshTime", OS::GetCurrentTimeMillis());
+ jsobj.AddProperty64("startTime", start_time_millis);
// Construct the isolate list.
{
JSONArray jsarr(&jsobj, "isolates");
@@ -2506,6 +2507,25 @@ static bool SetFlag(Isolate* isolate, JSONStream* js) {
}
+static const MethodParameter* set_name_params[] = {
+ ISOLATE_PARAMETER,
+ new MethodParameter("name", true),
+ NULL,
+};
+
+
+static bool SetName(Isolate* isolate, JSONStream* js) {
+ isolate->set_debugger_name(js->LookupParam("name"));
+ {
+ ServiceEvent event(isolate, ServiceEvent::kIsolateUpdate);
+ Service::HandleEvent(&event);
+ }
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "Success");
+ return true;
+}
+
+
static ServiceMethodDescriptor service_methods_[] = {
{ "_echo", _Echo,
NULL },
@@ -2577,8 +2597,10 @@ static ServiceMethodDescriptor service_methods_[] = {
resume_params },
{ "requestHeapSnapshot", RequestHeapSnapshot,
request_heap_snapshot_params },
- { "setFlag", SetFlag ,
+ { "setFlag", SetFlag,
set_flags_params },
+ { "setName", SetName,
+ set_name_params },
};
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698