<commit_before>// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#include "vm/service_event.h"

#include "vm/debugger.h"
#include "vm/message_handler.h"
#include "vm/service_isolate.h"
#include "vm/timeline.h"

namespace dart {

#ifndef PRODUCT

ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind)
    : isolate_(isolate),
      kind_(event_kind),
      flag_name_(NULL),
      flag_new_value_(NULL),
      embedder_kind_(NULL),
      embedder_stream_id_(NULL),
      breakpoint_(NULL),
      top_frame_(NULL),
      timeline_event_block_(NULL),
      extension_rpc_(NULL),
      exception_(NULL),
      reload_error_(NULL),
      spawn_token_(NULL),
      spawn_error_(NULL),
      at_async_jump_(false),
      inspectee_(NULL),
      gc_stats_(NULL),
      bytes_(NULL),
      bytes_length_(0),
      timestamp_(OS::GetCurrentTimeMillis()) {
  // We should never generate events for the vm or service isolates.
  ASSERT(isolate_ != Dart::vm_isolate());
  ASSERT(isolate == NULL || !Isolate::IsSystemIsolate(isolate) ||
         (Isolate::IsSystemIsolate(isolate) &&
          event_kind == ServiceEvent::kResume));

  if ((event_kind == ServiceEvent::kPauseStart) ||
      (event_kind == ServiceEvent::kPauseExit)) {
    timestamp_ = isolate->message_handler()->paused_timestamp();
  } else if (event_kind == ServiceEvent::kResume) {<commit_msg>[ VM ] Fix failing assert when requesting system isolates immediately after startup<commit_after>// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#include "vm/service_event.h"

#include "vm/debugger.h"
#include "vm/message_handler.h"
#include "vm/service_isolate.h"
#include "vm/timeline.h"

namespace dart {

#ifndef PRODUCT

ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind)
    : isolate_(isolate),
      kind_(event_kind),
      flag_name_(NULL),
      flag_new_value_(NULL),
      embedder_kind_(NULL),
      embedder_stream_id_(NULL),
      breakpoint_(NULL),
      top_frame_(NULL),
      timeline_event_block_(NULL),
      extension_rpc_(NULL),
      exception_(NULL),
      reload_error_(NULL),
      spawn_token_(NULL),
      spawn_error_(NULL),
      at_async_jump_(false),
      inspectee_(NULL),
      gc_stats_(NULL),
      bytes_(NULL),
      bytes_length_(0),
      timestamp_(OS::GetCurrentTimeMillis()) {
  // We should never generate events for the vm isolate as it is never reported over the service.
  ASSERT(isolate_ != Dart::vm_isolate());

  // System isolates should never post service events. However, the Isolate service object uses a
  // service event to represent the current running state of the isolate, so we need to allow for
  // system isolates to create resume and none events for this purpose. The resume event represents
  // a running isolate and the none event is returned for an isolate that has not yet been marked as
  // runnable (see "pauseEvent" in Isolate::PrintJSON).
  ASSERT(isolate == NULL || !Isolate::IsSystemIsolate(isolate) ||
         (Isolate::IsSystemIsolate(isolate) &&
          (event_kind == ServiceEvent::kResume ||
           event_kind == ServiceEvent::kNone)));

  if ((event_kind == ServiceEvent::kPauseStart) ||
      (event_kind == ServiceEvent::kPauseExit)) {
    timestamp_ = isolate->message_handler()->paused_timestamp();
  } else if (event_kind == ServiceEvent::kResume) {
{'fraction_non_alphanumeric': 0.1111718109806064, 'fraction_numerical': 0.0027314941272876263, 'mean_word_length': 3.812089356110381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7560022', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1073, 'n_words': 299}