| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/service.h" | 5 #include "vm/service.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 | 523 |
| 524 void Service::SetEventMask(uint32_t mask) { | 524 void Service::SetEventMask(uint32_t mask) { |
| 525 event_mask_ = mask; | 525 event_mask_ = mask; |
| 526 } | 526 } |
| 527 | 527 |
| 528 | 528 |
| 529 void Service::SendEvent(intptr_t eventFamilyId, | 529 void Service::SendEvent(intptr_t eventFamilyId, |
| 530 intptr_t eventType, | 530 intptr_t eventType, |
| 531 const Object& eventMessage) { | 531 const Object& eventMessage) { |
| 532 ASSERT(!ServiceIsolate::IsServiceIsolate(Isolate::Current())); | 532 ASSERT(!ServiceIsolate::IsServiceIsolateDescendant(Isolate::Current())); |
| 533 if (!ServiceIsolate::IsRunning()) { | 533 if (!ServiceIsolate::IsRunning()) { |
| 534 return; | 534 return; |
| 535 } | 535 } |
| 536 Isolate* isolate = Isolate::Current(); | 536 Isolate* isolate = Isolate::Current(); |
| 537 ASSERT(isolate != NULL); | 537 ASSERT(isolate != NULL); |
| 538 HANDLESCOPE(isolate); | 538 HANDLESCOPE(isolate); |
| 539 | 539 |
| 540 // Construct a list of the form [eventFamilyId, eventMessage]. | 540 // Construct a list of the form [eventFamilyId, eventMessage]. |
| 541 // | 541 // |
| 542 // TODO(turnidge): Revisit passing the eventFamilyId here at all. | 542 // TODO(turnidge): Revisit passing the eventFamilyId here at all. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 memmove(message.DataAddr(offset), data, size); | 585 memmove(message.DataAddr(offset), data, size); |
| 586 offset += size; | 586 offset += size; |
| 587 } | 587 } |
| 588 ASSERT(offset == total_bytes); | 588 ASSERT(offset == total_bytes); |
| 589 // TODO(turnidge): Pass the real eventType here. | 589 // TODO(turnidge): Pass the real eventType here. |
| 590 SendEvent(eventFamilyId, 0, message); | 590 SendEvent(eventFamilyId, 0, message); |
| 591 } | 591 } |
| 592 | 592 |
| 593 | 593 |
| 594 void Service::HandleGCEvent(GCEvent* event) { | 594 void Service::HandleGCEvent(GCEvent* event) { |
| 595 if (ServiceIsolate::IsServiceIsolate(Isolate::Current())) { | 595 if (ServiceIsolate::IsServiceIsolateDescendant(Isolate::Current())) { |
| 596 return; | 596 return; |
| 597 } | 597 } |
| 598 JSONStream js; | 598 JSONStream js; |
| 599 event->PrintJSON(&js); | 599 event->PrintJSON(&js); |
| 600 const String& message = String::Handle(String::New(js.ToCString())); | 600 const String& message = String::Handle(String::New(js.ToCString())); |
| 601 // TODO(turnidge): Pass the real eventType here. | 601 // TODO(turnidge): Pass the real eventType here. |
| 602 SendEvent(kEventFamilyGC, 0, message); | 602 SendEvent(kEventFamilyGC, 0, message); |
| 603 } | 603 } |
| 604 | 604 |
| 605 | 605 |
| (...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 class ServiceIsolateVisitor : public IsolateVisitor { | 2412 class ServiceIsolateVisitor : public IsolateVisitor { |
| 2413 public: | 2413 public: |
| 2414 explicit ServiceIsolateVisitor(JSONArray* jsarr) | 2414 explicit ServiceIsolateVisitor(JSONArray* jsarr) |
| 2415 : jsarr_(jsarr) { | 2415 : jsarr_(jsarr) { |
| 2416 } | 2416 } |
| 2417 | 2417 |
| 2418 virtual ~ServiceIsolateVisitor() {} | 2418 virtual ~ServiceIsolateVisitor() {} |
| 2419 | 2419 |
| 2420 void VisitIsolate(Isolate* isolate) { | 2420 void VisitIsolate(Isolate* isolate) { |
| 2421 if ((isolate != Dart::vm_isolate()) && | 2421 if ((isolate != Dart::vm_isolate()) && |
| 2422 !ServiceIsolate::IsServiceIsolate(isolate)) { | 2422 !ServiceIsolate::IsServiceIsolateDescendant(isolate)) { |
| 2423 jsarr_->AddValue(isolate); | 2423 jsarr_->AddValue(isolate); |
| 2424 } | 2424 } |
| 2425 } | 2425 } |
| 2426 | 2426 |
| 2427 private: | 2427 private: |
| 2428 JSONArray* jsarr_; | 2428 JSONArray* jsarr_; |
| 2429 }; | 2429 }; |
| 2430 | 2430 |
| 2431 | 2431 |
| 2432 static const MethodParameter* get_vm_params[] = { | 2432 static const MethodParameter* get_vm_params[] = { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 ServiceMethodDescriptor& method = service_methods_[i]; | 2611 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2612 if (strcmp(method_name, method.name) == 0) { | 2612 if (strcmp(method_name, method.name) == 0) { |
| 2613 return &method; | 2613 return &method; |
| 2614 } | 2614 } |
| 2615 } | 2615 } |
| 2616 return NULL; | 2616 return NULL; |
| 2617 } | 2617 } |
| 2618 | 2618 |
| 2619 | 2619 |
| 2620 } // namespace dart | 2620 } // namespace dart |
| OLD | NEW |