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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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::IsServiceIsolate(Isolate::Current())); |
533 if (ServiceIsolate::IsServiceIsolateDescendant(Isolate::Current())) { | |
turnidge
2015/04/01 19:57:34
Make this an assert. Collapse to single test.
Cutch
2015/04/01 20:19:04
Done.
| |
534 return; | |
535 } | |
533 if (!ServiceIsolate::IsRunning()) { | 536 if (!ServiceIsolate::IsRunning()) { |
534 return; | 537 return; |
535 } | 538 } |
536 Isolate* isolate = Isolate::Current(); | 539 Isolate* isolate = Isolate::Current(); |
537 ASSERT(isolate != NULL); | 540 ASSERT(isolate != NULL); |
538 HANDLESCOPE(isolate); | 541 HANDLESCOPE(isolate); |
539 | 542 |
540 // Construct a list of the form [eventFamilyId, eventMessage]. | 543 // Construct a list of the form [eventFamilyId, eventMessage]. |
541 // | 544 // |
542 // TODO(turnidge): Revisit passing the eventFamilyId here at all. | 545 // 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); | 588 memmove(message.DataAddr(offset), data, size); |
586 offset += size; | 589 offset += size; |
587 } | 590 } |
588 ASSERT(offset == total_bytes); | 591 ASSERT(offset == total_bytes); |
589 // TODO(turnidge): Pass the real eventType here. | 592 // TODO(turnidge): Pass the real eventType here. |
590 SendEvent(eventFamilyId, 0, message); | 593 SendEvent(eventFamilyId, 0, message); |
591 } | 594 } |
592 | 595 |
593 | 596 |
594 void Service::HandleGCEvent(GCEvent* event) { | 597 void Service::HandleGCEvent(GCEvent* event) { |
595 if (ServiceIsolate::IsServiceIsolate(Isolate::Current())) { | 598 if (ServiceIsolate::IsServiceIsolate(Isolate::Current()) || |
599 ServiceIsolate::IsServiceIsolateDescendant(Isolate::Current())) { | |
turnidge
2015/04/01 19:57:34
Collapse to one test.
Cutch
2015/04/01 20:19:04
Done.
| |
596 return; | 600 return; |
597 } | 601 } |
598 JSONStream js; | 602 JSONStream js; |
599 event->PrintJSON(&js); | 603 event->PrintJSON(&js); |
600 const String& message = String::Handle(String::New(js.ToCString())); | 604 const String& message = String::Handle(String::New(js.ToCString())); |
601 // TODO(turnidge): Pass the real eventType here. | 605 // TODO(turnidge): Pass the real eventType here. |
602 SendEvent(kEventFamilyGC, 0, message); | 606 SendEvent(kEventFamilyGC, 0, message); |
603 } | 607 } |
604 | 608 |
605 | 609 |
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2412 class ServiceIsolateVisitor : public IsolateVisitor { | 2416 class ServiceIsolateVisitor : public IsolateVisitor { |
2413 public: | 2417 public: |
2414 explicit ServiceIsolateVisitor(JSONArray* jsarr) | 2418 explicit ServiceIsolateVisitor(JSONArray* jsarr) |
2415 : jsarr_(jsarr) { | 2419 : jsarr_(jsarr) { |
2416 } | 2420 } |
2417 | 2421 |
2418 virtual ~ServiceIsolateVisitor() {} | 2422 virtual ~ServiceIsolateVisitor() {} |
2419 | 2423 |
2420 void VisitIsolate(Isolate* isolate) { | 2424 void VisitIsolate(Isolate* isolate) { |
2421 if ((isolate != Dart::vm_isolate()) && | 2425 if ((isolate != Dart::vm_isolate()) && |
2422 !ServiceIsolate::IsServiceIsolate(isolate)) { | 2426 !ServiceIsolate::IsServiceIsolate(isolate) && |
2427 !ServiceIsolate::IsServiceIsolateDescendant(isolate)) { | |
turnidge
2015/04/01 19:57:34
Collapse test.
Cutch
2015/04/01 20:19:04
Done.
| |
2423 jsarr_->AddValue(isolate); | 2428 jsarr_->AddValue(isolate); |
2424 } | 2429 } |
2425 } | 2430 } |
2426 | 2431 |
2427 private: | 2432 private: |
2428 JSONArray* jsarr_; | 2433 JSONArray* jsarr_; |
2429 }; | 2434 }; |
2430 | 2435 |
2431 | 2436 |
2432 static const MethodParameter* get_vm_params[] = { | 2437 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]; | 2616 ServiceMethodDescriptor& method = service_methods_[i]; |
2612 if (strcmp(method_name, method.name) == 0) { | 2617 if (strcmp(method_name, method.name) == 0) { |
2613 return &method; | 2618 return &method; |
2614 } | 2619 } |
2615 } | 2620 } |
2616 return NULL; | 2621 return NULL; |
2617 } | 2622 } |
2618 | 2623 |
2619 | 2624 |
2620 } // namespace dart | 2625 } // namespace dart |
OLD | NEW |