Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
dart::Service Class Reference

#include <service.h>

Inheritance diagram for dart::Service:
dart::AllStatic

Static Public Member Functions

static void Init ()
 
static void Cleanup ()
 
static ErrorPtr HandleRootMessage (const Array &message)
 
static ErrorPtr HandleObjectRootMessage (const Array &message)
 
static ErrorPtr HandleIsolateMessage (Isolate *isolate, const Array &message)
 
static void HandleEvent (ServiceEvent *event, bool enter_safepoint=true)
 
static void RegisterIsolateEmbedderCallback (const char *name, Dart_ServiceRequestCallback callback, void *user_data)
 
static void RegisterRootEmbedderCallback (const char *name, Dart_ServiceRequestCallback callback, void *user_data)
 
static void SetEmbedderInformationCallback (Dart_EmbedderInformationCallback callback)
 
static void SetEmbedderStreamCallbacks (Dart_ServiceStreamListenCallback listen_callback, Dart_ServiceStreamCancelCallback cancel_callback)
 
static void SetGetServiceAssetsCallback (Dart_GetVMServiceAssetsArchive get_service_assets)
 
static void SendEchoEvent (Isolate *isolate, const char *text)
 
static void SendInspectEvent (Isolate *isolate, const Object &inspectee)
 
static void SendEmbedderEvent (Isolate *isolate, const char *stream_id, const char *event_kind, const uint8_t *bytes, intptr_t bytes_len)
 
static void SendLogEvent (Isolate *isolate, int64_t sequence_number, int64_t timestamp, intptr_t level, const String &name, const String &message, const Instance &zone, const Object &error, const Instance &stack_trace)
 
static void SendExtensionEvent (Isolate *isolate, const String &event_kind, const String &event_data)
 
static void SendEventWithData (const char *stream_id, const char *event_type, intptr_t reservation, const char *metadata, intptr_t metadata_size, uint8_t *data, intptr_t data_size)
 
static void PostError (const String &method_name, const Array &parameter_keys, const Array &parameter_values, const Instance &reply_port, const Instance &id, const Error &error)
 
static void LogResponseSize (const char *method, JSONStream *js)
 
static bool EnableTimelineStreams (char *categories_list)
 
static bool ListenStream (const char *stream_id, bool include_privates)
 
static void CancelStream (const char *stream_id)
 
static ObjectPtr RequestAssets ()
 
static Dart_ServiceStreamListenCallback stream_listen_callback ()
 
static Dart_ServiceStreamCancelCallback stream_cancel_callback ()
 
static void PrintJSONForEmbedderInformation (JSONObject *jsobj)
 
static void PrintJSONForVM (JSONStream *js, bool ref)
 
static void CheckForPause (Isolate *isolate, JSONStream *stream)
 
static int64_t CurrentRSS ()
 
static int64_t MaxRSS ()
 
static void SetDartLibraryKernelForSources (const uint8_t *kernel_bytes, intptr_t kernel_length)
 
static bool HasDartLibraryKernelForSources ()
 
static const uint8_t * dart_library_kernel ()
 
static intptr_t dart_library_kernel_length ()
 

Static Public Attributes

static StreamInfo vm_stream
 
static StreamInfo isolate_stream
 
static StreamInfo debug_stream
 
static StreamInfo gc_stream
 
static StreamInfo echo_stream
 
static StreamInfo heapsnapshot_stream
 
static StreamInfo logging_stream
 
static StreamInfo extension_stream
 
static StreamInfo timeline_stream
 
static StreamInfo profiler_stream
 

Detailed Description

Definition at line 96 of file service.h.

Member Function Documentation

◆ CancelStream()

void dart::Service::CancelStream ( const char *  stream_id)
static

Definition at line 448 of file service.cc.

448 {
449 if (FLAG_trace_service) {
450 OS::PrintErr("vm-service: stopping stream '%s'\n", stream_id);
451 }
452 intptr_t num_streams = sizeof(streams_) / sizeof(streams_[0]);
453 for (intptr_t i = 0; i < num_streams; i++) {
454 if (strcmp(stream_id, streams_[i]->id()) == 0) {
455 streams_[i]->set_enabled(false);
456 return;
457 }
458 }
459 if (stream_cancel_callback_ != nullptr) {
460 Thread* T = Thread::Current();
461 TransitionVMToNative transition(T);
462 return (*stream_cancel_callback_)(stream_id);
463 }
464}
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
void set_enabled(bool value)
Definition service.h:79
static Thread * Current()
Definition thread.h:361
static StreamInfo *const streams_[]
Definition service.cc:419
#define T

◆ CheckForPause()

void dart::Service::CheckForPause ( Isolate isolate,
JSONStream stream 
)
static

Definition at line 3880 of file service.cc.

3880 {
3881 // Should we pause?
3882 isolate->set_should_pause_post_service_request(
3883 BoolParameter::Parse(stream->LookupParam("pause"), false));
3884}
static bool Parse(const char *value, bool default_value=false)
Definition service.cc:714

◆ Cleanup()

void dart::Service::Cleanup ( )
static

Definition at line 119 of file service.cc.

119 {
120 if (service_response_size_log_file_ == nullptr) {
121 return;
122 }
124 (*file_close)(service_response_size_log_file_);
125 service_response_size_log_file_ = nullptr;
126}
static Dart_FileCloseCallback file_close_callback()
Definition dart.h:128
void(* Dart_FileCloseCallback)(void *stream)
Definition dart_api.h:819

◆ CurrentRSS()

int64_t dart::Service::CurrentRSS ( )
static

Definition at line 1451 of file service.cc.

1451 {
1452 if (embedder_information_callback_ == nullptr) {
1453 return -1;
1454 }
1456 0, // version
1457 nullptr, // name
1458 0, // max_rss
1459 0 // current_rss
1460 };
1461 embedder_information_callback_(&info);
1463 return info.current_rss;
1464}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
#define DART_EMBEDDER_INFORMATION_CURRENT_VERSION
#define ASSERT(E)

◆ dart_library_kernel()

static const uint8_t * dart::Service::dart_library_kernel ( )
inlinestatic

Definition at line 216 of file service.h.

216{ return dart_library_kernel_; }

◆ dart_library_kernel_length()

static intptr_t dart::Service::dart_library_kernel_length ( )
inlinestatic

Definition at line 218 of file service.h.

218 {
219 return dart_library_kernel_len_;
220 }

◆ EnableTimelineStreams()

static bool dart::Service::EnableTimelineStreams ( char *  categories_list)
static

◆ HandleEvent()

void dart::Service::HandleEvent ( ServiceEvent event,
bool  enter_safepoint = true 
)
static

Definition at line 1206 of file service.cc.

1206 {
1207 if (event->stream_info() != nullptr && !event->stream_info()->enabled()) {
1208 if (FLAG_warn_on_pause_with_no_debugger && event->IsPause()) {
1209 // If we are about to pause a running program which has no
1210 // debugger connected, tell the user about it.
1212 }
1213 // Ignore events when no one is listening to the event stream.
1214 return;
1215 } else if (event->stream_info() != nullptr &&
1216 FLAG_warn_on_pause_with_no_debugger && event->IsPause()) {
1218 }
1220 return;
1221 }
1222 JSONStream js;
1223 if (event->stream_info() != nullptr) {
1224 js.set_include_private_members(
1225 event->stream_info()->include_private_members());
1226 }
1227 const char* stream_id = event->stream_id();
1228 ASSERT(stream_id != nullptr);
1229 {
1230 JSONObject jsobj(&js);
1231 jsobj.AddProperty("jsonrpc", "2.0");
1232 jsobj.AddProperty("method", "streamNotify");
1233 JSONObject params(&jsobj, "params");
1234 params.AddProperty("streamId", stream_id);
1235 params.AddProperty("event", event);
1236 }
1237 PostEvent(event->isolate_group(), event->isolate(), stream_id,
1238 event->KindAsCString(), &js, enter_safepoint);
1239}
const EmbeddedViewParams * params
FlKeyEvent * event
static void ReportPauseOnConsole(ServiceEvent *event)
Definition service.cc:1152

◆ HandleIsolateMessage()

ErrorPtr dart::Service::HandleIsolateMessage ( Isolate isolate,
const Array message 
)
static

Definition at line 1069 of file service.cc.

1069 {
1070 ASSERT(isolate != nullptr);
1071 const Error& error = Error::Handle(InvokeMethod(isolate, msg));
1072 return MaybePause(isolate, error);
1073}
static Object & Handle()
Definition object.h:407
const uint8_t uint32_t uint32_t GError ** error

◆ HandleObjectRootMessage()

ErrorPtr dart::Service::HandleObjectRootMessage ( const Array message)
static

Definition at line 1064 of file service.cc.

1064 {
1065 Isolate* isolate = Isolate::Current();
1066 return InvokeMethod(isolate, msg_instance, true);
1067}
static Isolate * Current()
Definition isolate.h:939

◆ HandleRootMessage()

ErrorPtr dart::Service::HandleRootMessage ( const Array message)
static

Definition at line 1059 of file service.cc.

1059 {
1060 Isolate* isolate = Isolate::Current();
1061 return InvokeMethod(isolate, msg_instance);
1062}

◆ HasDartLibraryKernelForSources()

static bool dart::Service::HasDartLibraryKernelForSources ( )
inlinestatic

Definition at line 212 of file service.h.

212 {
213 return (dart_library_kernel_ != nullptr);
214 }

◆ Init()

void dart::Service::Init ( )
static

Definition at line 97 of file service.cc.

97 {
98 if (FLAG_log_service_response_sizes == nullptr) {
99 return;
100 }
104 if ((file_open == nullptr) || (file_write == nullptr) ||
105 (file_close == nullptr)) {
106 OS::PrintErr("Error: Could not access file callbacks.");
107 UNREACHABLE();
108 }
109 ASSERT(service_response_size_log_file_ == nullptr);
110 service_response_size_log_file_ =
111 (*file_open)(FLAG_log_service_response_sizes, true);
112 if (service_response_size_log_file_ == nullptr) {
113 OS::PrintErr("Warning: Failed to open service response size log file: %s\n",
114 FLAG_log_service_response_sizes);
115 return;
116 }
117}
#define UNREACHABLE()
Definition assert.h:248
static Dart_FileWriteCallback file_write_callback()
Definition dart.h:125
static Dart_FileOpenCallback file_open_callback()
Definition dart.h:119
void(* Dart_FileWriteCallback)(const void *data, intptr_t length, void *stream)
Definition dart_api.h:806
void *(* Dart_FileOpenCallback)(const char *name, bool write)
Definition dart_api.h:775

◆ ListenStream()

bool dart::Service::ListenStream ( const char *  stream_id,
bool  include_privates 
)
static

Definition at line 427 of file service.cc.

428 {
429 if (FLAG_trace_service) {
430 OS::PrintErr("vm-service: starting stream '%s'\n", stream_id);
431 }
432 intptr_t num_streams = sizeof(streams_) / sizeof(streams_[0]);
433 for (intptr_t i = 0; i < num_streams; i++) {
434 if (strcmp(stream_id, streams_[i]->id()) == 0) {
435 streams_[i]->set_enabled(true);
436 streams_[i]->set_include_private_members(include_private_members);
437 return true;
438 }
439 }
440 if (stream_listen_callback_ != nullptr) {
441 Thread* T = Thread::Current();
442 TransitionVMToNative transition(T);
443 return (*stream_listen_callback_)(stream_id);
444 }
445 return false;
446}
void set_include_private_members(bool value)
Definition service.h:82

◆ LogResponseSize()

void dart::Service::LogResponseSize ( const char *  method,
JSONStream js 
)
static

Definition at line 86 of file service.cc.

86 {
87 if (service_response_size_log_file_ == nullptr) {
88 return;
89 }
91 char* entry =
92 OS::SCreate(nullptr, "%s, %" Pd "\n", method, js->buffer()->length());
93 (*file_write)(entry, strlen(entry), service_response_size_log_file_);
94 free(entry);
95}
static char * SCreate(Zone *zone, const char *format,...) PRINTF_ATTRIBUTE(2
#define Pd
Definition globals.h:408

◆ MaxRSS()

int64_t dart::Service::MaxRSS ( )
static

Definition at line 1466 of file service.cc.

1466 {
1467 if (embedder_information_callback_ == nullptr) {
1468 return -1;
1469 }
1471 0, // version
1472 nullptr, // name
1473 0, // max_rss
1474 0 // current_rss
1475 };
1476 embedder_information_callback_(&info);
1478 return info.max_rss;
1479}

◆ PostError()

void dart::Service::PostError ( const String method_name,
const Array parameter_keys,
const Array parameter_values,
const Instance reply_port,
const Instance id,
const Error error 
)
static

Definition at line 937 of file service.cc.

942 {
943 Thread* T = Thread::Current();
944 StackZone zone(T);
945 JSONStream js;
946 js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(), id, method_name,
947 parameter_keys, parameter_values);
948 js.PrintError(kExtensionError, "Error in extension `%s`: %s", js.method(),
949 error.ToErrorCString());
950 js.PostReply();
951}
@ kExtensionError
Definition json_stream.h:51

◆ PrintJSONForEmbedderInformation()

void dart::Service::PrintJSONForEmbedderInformation ( JSONObject jsobj)
static

Definition at line 5252 of file service.cc.

5252 {
5253 if (embedder_information_callback_ != nullptr) {
5255 0, // version
5256 nullptr, // name
5257 -1, // max_rss
5258 -1 // current_rss
5259 };
5260 embedder_information_callback_(&info);
5262 if (info.name != nullptr) {
5263 jsobj->AddProperty("_embedder", info.name);
5264 }
5265 if (info.max_rss >= 0) {
5266 jsobj->AddProperty64("_maxRSS", info.max_rss);
5267 }
5268 if (info.current_rss >= 0) {
5269 jsobj->AddProperty64("_currentRSS", info.current_rss);
5270 }
5271 }
5272}

◆ PrintJSONForVM()

void dart::Service::PrintJSONForVM ( JSONStream js,
bool  ref 
)
static

Definition at line 5274 of file service.cc.

5274 {
5275 JSONObject jsobj(js);
5276 jsobj.AddProperty("type", (ref ? "@VM" : "VM"));
5277 jsobj.AddProperty("name", GetVMName());
5278 if (ref) {
5279 return;
5280 }
5281 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord));
5282 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware());
5283 jsobj.AddProperty("operatingSystem", OS::Name());
5284 jsobj.AddProperty("targetCPU", CPU::Id());
5285 jsobj.AddProperty("version", Version::String());
5286#if defined(DART_PRECOMPILED_RUNTIME)
5288#else
5290#endif
5291 char* features_string = Dart::FeaturesString(nullptr, true, kind);
5292 jsobj.AddProperty("_features", features_string);
5293 free(features_string);
5294 jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart");
5295 jsobj.AddProperty64("pid", OS::ProcessId());
5296 jsobj.AddPropertyTimeMillis(
5297 "startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis());
5299 // Construct the isolate and isolate_groups list.
5300 {
5301 JSONArray jsarr(&jsobj, "isolates");
5302 ServiceIsolateVisitor visitor(&jsarr);
5303 Isolate::VisitIsolates(&visitor);
5304 }
5305 {
5306 JSONArray jsarr(&jsobj, "systemIsolates");
5307 SystemServiceIsolateVisitor visitor(&jsarr);
5308 Isolate::VisitIsolates(&visitor);
5309 }
5310 {
5311 JSONArray jsarr_isolate_groups(&jsobj, "isolateGroups");
5312 IsolateGroup::ForEach([&jsarr_isolate_groups](IsolateGroup* isolate_group) {
5313 if (!isolate_group->is_system_isolate_group()) {
5314 jsarr_isolate_groups.AddValue(isolate_group);
5315 }
5316 });
5317 }
5318 {
5319 JSONArray jsarr_isolate_groups(&jsobj, "systemIsolateGroups");
5320 IsolateGroup::ForEach([&jsarr_isolate_groups](IsolateGroup* isolate_group) {
5321 // Don't surface the vm-isolate since it's not a "real" isolate.
5322 if (isolate_group->is_vm_isolate()) {
5323 return;
5324 }
5325 if (isolate_group->is_system_isolate_group()) {
5326 jsarr_isolate_groups.AddValue(isolate_group);
5327 }
5328 });
5329 }
5330 {
5331 JSONStream discard_js;
5332 intptr_t vm_memory = GetProcessMemoryUsageHelper(&discard_js);
5333 jsobj.AddProperty("_currentMemory", vm_memory);
5334 }
5335}
static const char * Id()
static int64_t UptimeMillis()
Definition dart.h:76
static char * FeaturesString(IsolateGroup *isolate_group, bool is_vm_snapshot, Snapshot::Kind kind)
Definition dart.cc:998
static const char * hardware()
Definition cpu_arm.h:30
static void ForEach(std::function< void(IsolateGroup *)> action)
Definition isolate.cc:677
static void VisitIsolates(IsolateVisitor *visitor)
Definition isolate.cc:3485
static const char * Name()
Definition os.h:22
static int64_t GetCurrentTimeMillis()
static intptr_t ProcessId()
static void PrintJSONForEmbedderInformation(JSONObject *jsobj)
Definition service.cc:5252
static const char * String()
Definition version_in.cc:11
if(end==-1)
constexpr intptr_t kBitsPerWord
Definition globals.h:514
static intptr_t GetProcessMemoryUsageHelper(JSONStream *js)
Definition service.cc:4705
static const char * GetVMName()
Definition service.cc:358

◆ RegisterIsolateEmbedderCallback()

void dart::Service::RegisterIsolateEmbedderCallback ( const char *  name,
Dart_ServiceRequestCallback  callback,
void *  user_data 
)
static

Definition at line 1376 of file service.cc.

1379 {
1380 if (name == nullptr) {
1381 return;
1382 }
1383 EmbedderServiceHandler* handler = FindIsolateEmbedderHandler(name);
1384 if (handler != nullptr) {
1385 // Update existing handler entry.
1386 handler->set_callback(callback);
1387 handler->set_user_data(user_data);
1388 return;
1389 }
1390 // Create a new handler.
1391 handler = new EmbedderServiceHandler(name);
1392 handler->set_callback(callback);
1393 handler->set_user_data(user_data);
1394
1395 // Insert into isolate_service_handler_head_ list.
1396 handler->set_next(isolate_service_handler_head_);
1397 isolate_service_handler_head_ = handler;
1398}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const char *const name

◆ RegisterRootEmbedderCallback()

void dart::Service::RegisterRootEmbedderCallback ( const char *  name,
Dart_ServiceRequestCallback  callback,
void *  user_data 
)
static

Definition at line 1411 of file service.cc.

1413 {
1414 if (name == nullptr) {
1415 return;
1416 }
1417 EmbedderServiceHandler* handler = FindRootEmbedderHandler(name);
1418 if (handler != nullptr) {
1419 // Update existing handler entry.
1420 handler->set_callback(callback);
1421 handler->set_user_data(user_data);
1422 return;
1423 }
1424 // Create a new handler.
1425 handler = new EmbedderServiceHandler(name);
1426 handler->set_callback(callback);
1427 handler->set_user_data(user_data);
1428
1429 // Insert into root_service_handler_head_ list.
1430 handler->set_next(root_service_handler_head_);
1431 root_service_handler_head_ = handler;
1432}

◆ RequestAssets()

ObjectPtr dart::Service::RequestAssets ( )
static

Definition at line 466 of file service.cc.

466 {
467 Thread* T = Thread::Current();
468 Object& object = Object::Handle();
469 {
470 Api::Scope api_scope(T);
471 Dart_Handle handle;
472 {
473 TransitionVMToNative transition(T);
474 if (get_service_assets_callback_ == nullptr) {
475 return Object::null();
476 }
477 handle = get_service_assets_callback_();
478 if (Dart_IsError(handle)) {
479 Dart_PropagateError(handle);
480 }
481 }
482 object = Api::UnwrapHandle(handle);
483 }
484 if (object.IsNull()) {
485 return Object::null();
486 }
487 if (!object.IsTypedData()) {
488 const String& error_message = String::Handle(
489 String::New("An implementation of Dart_GetVMServiceAssetsArchive "
490 "should return a Uint8Array or null."));
491 const Error& error = Error::Handle(ApiError::New(error_message));
493 return Object::null();
494 }
495 const TypedData& typed_data = TypedData::Cast(object);
496 if (typed_data.ElementSizeInBytes() != 1) {
497 const String& error_message = String::Handle(
498 String::New("An implementation of Dart_GetVMServiceAssetsArchive "
499 "should return a Uint8Array or null."));
500 const Error& error = Error::Handle(ApiError::New(error_message));
502 return Object::null();
503 }
504 return object.ptr();
505}
static ObjectPtr UnwrapHandle(Dart_Handle object)
static DART_NORETURN void PropagateError(const Error &error)
static ObjectPtr null()
Definition object.h:433
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
DART_EXPORT bool IsNull(Dart_Handle object)
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)

◆ SendEchoEvent()

void dart::Service::SendEchoEvent ( Isolate isolate,
const char *  text 
)
static

Definition at line 1744 of file service.cc.

1744 {
1745 JSONStream js;
1746 {
1747 JSONObject jsobj(&js);
1748 jsobj.AddProperty("jsonrpc", "2.0");
1749 jsobj.AddProperty("method", "streamNotify");
1750 {
1751 JSONObject params(&jsobj, "params");
1752 params.AddProperty("streamId", echo_stream.id());
1753 {
1754 JSONObject event(&params, "event");
1755 event.AddProperty("type", "Event");
1756 event.AddProperty("kind", "_Echo");
1757 event.AddProperty("isolate", isolate);
1758 if (text != nullptr) {
1759 event.AddProperty("text", text);
1760 }
1761 event.AddPropertyTimeMillis("timestamp", OS::GetCurrentTimeMillis());
1762 }
1763 }
1764 }
1765
1766 intptr_t reservation = js.buffer()->length() + sizeof(int32_t);
1767 intptr_t data_size = reservation + 3;
1768 uint8_t* data = reinterpret_cast<uint8_t*>(malloc(data_size));
1769 data[reservation + 0] = 0;
1770 data[reservation + 1] = 128;
1771 data[reservation + 2] = 255;
1772 SendEventWithData(echo_stream.id(), "_Echo", reservation,
1773 js.buffer()->buffer(), js.buffer()->length(), data,
1774 data_size);
1775}
static StreamInfo echo_stream
Definition service.h:183
static void SendEventWithData(const char *stream_id, const char *event_type, intptr_t reservation, const char *metadata, intptr_t metadata_size, uint8_t *data, intptr_t data_size)
Definition service.cc:1134
const char * id() const
Definition service.h:77
std::u16string text
void * malloc(size_t size)
Definition allocation.cc:19
static int8_t data[kExtLength]

◆ SendEmbedderEvent()

void dart::Service::SendEmbedderEvent ( Isolate isolate,
const char *  stream_id,
const char *  event_kind,
const uint8_t *  bytes,
intptr_t  bytes_len 
)
static

Definition at line 4838 of file service.cc.

4842 {
4843 ServiceEvent event(isolate, ServiceEvent::kEmbedder);
4844 event.set_embedder_kind(event_kind);
4845 event.set_embedder_stream_id(stream_id);
4846 event.set_bytes(bytes, bytes_len);
4847 Service::HandleEvent(&event, /*enter_safepoint=*/false);
4848}
static void HandleEvent(ServiceEvent *event, bool enter_safepoint=true)
Definition service.cc:1206

◆ SendEventWithData()

void dart::Service::SendEventWithData ( const char *  stream_id,
const char *  event_type,
intptr_t  reservation,
const char *  metadata,
intptr_t  metadata_size,
uint8_t *  data,
intptr_t  data_size 
)
static

Definition at line 1134 of file service.cc.

1140 {
1141 ASSERT(kInt32Size + metadata_size <= reservation);
1142 // Using a SPACE creates valid JSON. Our goal here is to prevent the memory
1143 // overhead of copying to concatenate metadata and payload together by
1144 // over-allocating to underlying buffer before we know how long the metadata
1145 // will be.
1146 memset(data, ' ', reservation);
1147 reinterpret_cast<uint32_t*>(data)[0] = reservation;
1148 memmove(&(reinterpret_cast<uint32_t*>(data)[1]), metadata, metadata_size);
1149 Service::SendEvent(stream_id, event_type, data, data_size);
1150}
ax::mojom::Event event_type
constexpr intptr_t kInt32Size
Definition globals.h:450

◆ SendExtensionEvent()

void dart::Service::SendExtensionEvent ( Isolate isolate,
const String event_kind,
const String event_data 
)
static

Definition at line 4876 of file service.cc.

4878 {
4879 if (!Service::extension_stream.enabled()) {
4880 return;
4881 }
4882 ServiceEvent::ExtensionEvent extension_event;
4883 extension_event.event_kind = &event_kind;
4884 extension_event.event_data = &event_data;
4885 ServiceEvent event(isolate, ServiceEvent::kExtension);
4886 event.set_extension_event(extension_event);
4888}
static StreamInfo extension_stream
Definition service.h:186

◆ SendInspectEvent()

void dart::Service::SendInspectEvent ( Isolate isolate,
const Object inspectee 
)
static

Definition at line 4829 of file service.cc.

4829 {
4830 if (!Service::debug_stream.enabled()) {
4831 return;
4832 }
4833 ServiceEvent event(isolate, ServiceEvent::kInspect);
4834 event.set_inspectee(&inspectee);
4836}
static StreamInfo debug_stream
Definition service.h:181

◆ SendLogEvent()

void dart::Service::SendLogEvent ( Isolate isolate,
int64_t  sequence_number,
int64_t  timestamp,
intptr_t  level,
const String name,
const String message,
const Instance zone,
const Object error,
const Instance stack_trace 
)
static

Definition at line 4850 of file service.cc.

4858 {
4859 if (!Service::logging_stream.enabled()) {
4860 return;
4861 }
4862 ServiceEvent::LogRecord log_record;
4863 log_record.sequence_number = sequence_number;
4864 log_record.timestamp = timestamp;
4865 log_record.level = level;
4866 log_record.name = &name;
4867 log_record.message = &message;
4868 log_record.zone = &zone;
4869 log_record.error = &error;
4870 log_record.stack_trace = &stack_trace;
4871 ServiceEvent event(isolate, ServiceEvent::kLogging);
4872 event.set_log_record(log_record);
4874}
static StreamInfo logging_stream
Definition service.h:185
Win32Message message

◆ SetDartLibraryKernelForSources()

void dart::Service::SetDartLibraryKernelForSources ( const uint8_t *  kernel_bytes,
intptr_t  kernel_length 
)
static

Definition at line 1481 of file service.cc.

1482 {
1483 dart_library_kernel_ = kernel_bytes;
1484 dart_library_kernel_len_ = kernel_length;
1485}

◆ SetEmbedderInformationCallback()

void dart::Service::SetEmbedderInformationCallback ( Dart_EmbedderInformationCallback  callback)
static

Definition at line 1446 of file service.cc.

1447 {
1448 embedder_information_callback_ = callback;
1449}

◆ SetEmbedderStreamCallbacks()

void dart::Service::SetEmbedderStreamCallbacks ( Dart_ServiceStreamListenCallback  listen_callback,
Dart_ServiceStreamCancelCallback  cancel_callback 
)
static

Definition at line 1434 of file service.cc.

1436 {
1437 stream_listen_callback_ = listen_callback;
1438 stream_cancel_callback_ = cancel_callback;
1439}

◆ SetGetServiceAssetsCallback()

void dart::Service::SetGetServiceAssetsCallback ( Dart_GetVMServiceAssetsArchive  get_service_assets)
static

Definition at line 1441 of file service.cc.

1442 {
1443 get_service_assets_callback_ = get_service_assets;
1444}

◆ stream_cancel_callback()

static Dart_ServiceStreamCancelCallback dart::Service::stream_cancel_callback ( )
inlinestatic

Definition at line 198 of file service.h.

198 {
199 return stream_cancel_callback_;
200 }

◆ stream_listen_callback()

static Dart_ServiceStreamListenCallback dart::Service::stream_listen_callback ( )
inlinestatic

Definition at line 195 of file service.h.

195 {
196 return stream_listen_callback_;
197 }

Member Data Documentation

◆ debug_stream

StreamInfo dart::Service::debug_stream
static

Definition at line 181 of file service.h.

◆ echo_stream

StreamInfo dart::Service::echo_stream
static

Definition at line 183 of file service.h.

◆ extension_stream

StreamInfo dart::Service::extension_stream
static

Definition at line 186 of file service.h.

◆ gc_stream

StreamInfo dart::Service::gc_stream
static

Definition at line 182 of file service.h.

◆ heapsnapshot_stream

StreamInfo dart::Service::heapsnapshot_stream
static

Definition at line 184 of file service.h.

◆ isolate_stream

StreamInfo dart::Service::isolate_stream
static

Definition at line 180 of file service.h.

◆ logging_stream

StreamInfo dart::Service::logging_stream
static

Definition at line 185 of file service.h.

◆ profiler_stream

StreamInfo dart::Service::profiler_stream
static

Definition at line 188 of file service.h.

◆ timeline_stream

StreamInfo dart::Service::timeline_stream
static

Definition at line 187 of file service.h.

◆ vm_stream

StreamInfo dart::Service::vm_stream
static

Definition at line 179 of file service.h.


The documentation for this class was generated from the following files: