Skip to content

Commit feaa0c6

Browse files
derekxu16Commit Queue
authored andcommitted
[VM/Service] Fix assertions regarding the kinds of service events that can be posted from VM-internal isolates
This CL also updates the documentation of these assertions. TEST=CI Fixes: #60612 Change-Id: Idec31a299614e63a36a7c131d38281be5fb8bde7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424520 Commit-Queue: Derek Xu <[email protected]> Reviewed-by: Ben Konyi <[email protected]>
1 parent 876118d commit feaa0c6

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

runtime/vm/service_event.cc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,25 @@ ServiceEvent::ServiceEvent(IsolateGroup* isolate_group,
5555
// over the service.
5656
ASSERT(isolate_ != Dart::vm_isolate());
5757

58-
// VM internal isolates should never post service events. However, the Isolate
59-
// service object uses a service event to represent the current running state
60-
// of the isolate, so we need to allow for system isolates to create resume
61-
// and none events for this purpose. The resume event represents a running
62-
// isolate and the none event is returned for an isolate that has not yet
63-
// been marked as runnable (see "pauseEvent" in Isolate::PrintJSON).
58+
// VM-internal isolates should never post service events outside of the
59+
// following cases:
60+
// - The `Isolate` service object uses a service event to represent the
61+
// current running state of the isolate, so we need to allow for system
62+
// isolates to create `kResume` and `kNone` events for this purpose. The
63+
// `kResume` event represents a running isolate and the `kNone` event is
64+
// returned for an isolate that has not yet been marked as runnable (see
65+
// "pauseEvent" in Isolate::PrintJSON).
66+
// - `kEmbedder` events relaying output printed on stdout/stderr may be
67+
// posted from any isolate.
68+
// - `kCpuSamples` events may be posted from any isolate.
69+
// - `kTimerSignificantlyOverdue` events may be posted from any isolate.
6470
ASSERT(isolate == nullptr || !Isolate::IsVMInternalIsolate(isolate) ||
6571
(Isolate::IsVMInternalIsolate(isolate) &&
6672
(event_kind == ServiceEvent::kResume ||
6773
event_kind == ServiceEvent::kNone ||
68-
// VM service can print Observatory information to Stdout or Stderr
69-
// which are embedder streams.
7074
event_kind == ServiceEvent::kEmbedder ||
71-
event_kind == ServiceEvent::kCpuSamples)));
75+
event_kind == ServiceEvent::kCpuSamples ||
76+
event_kind == ServiceEvent::kTimerSignificantlyOverdue)));
7277

7378
if ((event_kind == ServiceEvent::kPauseStart) ||
7479
(event_kind == ServiceEvent::kPauseExit)) {

0 commit comments

Comments
 (0)