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

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
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index b8cea45480457444f6eac04b0d1c840790a5d529..68664b8ab82f78111bd157e63b6aba0a32c0f95d 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()));
@@ -2457,7 +2461,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).
@@ -2465,12 +2468,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");
@@ -2525,6 +2526,26 @@ 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) {
+ // TODO(turnidge): Do we want to send some sort of isolate update event?
Cutch 2015/03/18 20:05:48 dead TODO.
turnidge 2015/03/26 17:46:58 Done.
+ 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 },
@@ -2596,8 +2617,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 },
};

Powered by Google App Engine
This is Rietveld 408576698