| Index: runtime/vm/service.cc
|
| diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
|
| index 19ff7983b1341ba13eb564679650390244f26527..f528a642710f509ad90384d0de13aac2f821844a 100644
|
| --- a/runtime/vm/service.cc
|
| +++ b/runtime/vm/service.cc
|
| @@ -46,7 +46,6 @@ namespace dart {
|
|
|
| #define Z (T->zone())
|
|
|
| -
|
| DECLARE_FLAG(bool, trace_service);
|
| DECLARE_FLAG(bool, trace_service_pause_events);
|
| DECLARE_FLAG(bool, profile_vm);
|
| @@ -68,7 +67,6 @@ DECLARE_FLAG(bool, show_kernel_isolate);
|
| // The name of this of this vm as reported by the VM service protocol.
|
| static char* vm_name = NULL;
|
|
|
| -
|
| static const char* GetVMName() {
|
| if (vm_name == NULL) {
|
| return FLAG_vm_name;
|
| @@ -76,27 +74,21 @@ static const char* GetVMName() {
|
| return vm_name;
|
| }
|
|
|
| -
|
| ServiceIdZone::ServiceIdZone() {}
|
|
|
| -
|
| ServiceIdZone::~ServiceIdZone() {}
|
|
|
| -
|
| RingServiceIdZone::RingServiceIdZone()
|
| : ring_(NULL), policy_(ObjectIdRing::kAllocateId) {}
|
|
|
| -
|
| RingServiceIdZone::~RingServiceIdZone() {}
|
|
|
| -
|
| void RingServiceIdZone::Init(ObjectIdRing* ring,
|
| ObjectIdRing::IdPolicy policy) {
|
| ring_ = ring;
|
| policy_ = policy;
|
| }
|
|
|
| -
|
| char* RingServiceIdZone::GetServiceId(const Object& obj) {
|
| ASSERT(ring_ != NULL);
|
| Thread* thread = Thread::Current();
|
| @@ -106,14 +98,12 @@ char* RingServiceIdZone::GetServiceId(const Object& obj) {
|
| return zone->PrintToString("objects/%" Pd "", id);
|
| }
|
|
|
| -
|
| // TODO(johnmccutchan): Unify embedder service handler lists and their APIs.
|
| EmbedderServiceHandler* Service::isolate_service_handler_head_ = NULL;
|
| EmbedderServiceHandler* Service::root_service_handler_head_ = NULL;
|
| struct ServiceMethodDescriptor;
|
| const ServiceMethodDescriptor* FindMethod(const char* method_name);
|
|
|
| -
|
| // Support for streams defined in embedders.
|
| Dart_ServiceStreamListenCallback Service::stream_listen_callback_ = NULL;
|
| Dart_ServiceStreamCancelCallback Service::stream_cancel_callback_ = NULL;
|
| @@ -138,7 +128,6 @@ static StreamInfo* streams_[] = {
|
| &Service::logging_stream, &Service::extension_stream,
|
| &Service::timeline_stream, &Service::editor_stream};
|
|
|
| -
|
| bool Service::ListenStream(const char* stream_id) {
|
| if (FLAG_trace_service) {
|
| OS::Print("vm-service: starting stream '%s'\n", stream_id);
|
| @@ -158,7 +147,6 @@ bool Service::ListenStream(const char* stream_id) {
|
| return false;
|
| }
|
|
|
| -
|
| void Service::CancelStream(const char* stream_id) {
|
| if (FLAG_trace_service) {
|
| OS::Print("vm-service: stopping stream '%s'\n", stream_id);
|
| @@ -212,7 +200,6 @@ RawObject* Service::RequestAssets() {
|
| return Api::UnwrapHandle(handle);
|
| }
|
|
|
| -
|
| static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
|
| void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
|
| if (new_ptr == NULL) {
|
| @@ -221,36 +208,30 @@ static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
|
| return reinterpret_cast<uint8_t*>(new_ptr);
|
| }
|
|
|
| -
|
| static void PrintMissingParamError(JSONStream* js, const char* param) {
|
| js->PrintError(kInvalidParams, "%s expects the '%s' parameter", js->method(),
|
| param);
|
| }
|
|
|
| -
|
| static void PrintInvalidParamError(JSONStream* js, const char* param) {
|
| js->PrintError(kInvalidParams, "%s: invalid '%s' parameter: %s", js->method(),
|
| param, js->LookupParam(param));
|
| }
|
|
|
| -
|
| static void PrintIllegalParamError(JSONStream* js, const char* param) {
|
| js->PrintError(kInvalidParams, "%s: illegal '%s' parameter: %s", js->method(),
|
| param, js->LookupParam(param));
|
| }
|
|
|
| -
|
| static void PrintUnrecognizedMethodError(JSONStream* js) {
|
| js->PrintError(kMethodNotFound, NULL);
|
| }
|
|
|
| -
|
| static void PrintSuccess(JSONStream* js) {
|
| JSONObject jsobj(js);
|
| jsobj.AddProperty("type", "Success");
|
| }
|
|
|
| -
|
| static bool GetIntegerId(const char* s, intptr_t* id, int base = 10) {
|
| if ((s == NULL) || (*s == '\0')) {
|
| // Empty string.
|
| @@ -271,7 +252,6 @@ static bool GetIntegerId(const char* s, intptr_t* id, int base = 10) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool GetUnsignedIntegerId(const char* s, uintptr_t* id, int base = 10) {
|
| if ((s == NULL) || (*s == '\0')) {
|
| // Empty string.
|
| @@ -292,7 +272,6 @@ static bool GetUnsignedIntegerId(const char* s, uintptr_t* id, int base = 10) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool GetInteger64Id(const char* s, int64_t* id, int base = 10) {
|
| if ((s == NULL) || (*s == '\0')) {
|
| // Empty string.
|
| @@ -313,7 +292,6 @@ static bool GetInteger64Id(const char* s, int64_t* id, int base = 10) {
|
| return true;
|
| }
|
|
|
| -
|
| // Scans the string until the '-' character. Returns pointer to string
|
| // at '-' character. Returns NULL if not found.
|
| static const char* ScanUntilDash(const char* s) {
|
| @@ -330,7 +308,6 @@ static const char* ScanUntilDash(const char* s) {
|
| return NULL;
|
| }
|
|
|
| -
|
| static bool GetCodeId(const char* s, int64_t* timestamp, uword* address) {
|
| if ((s == NULL) || (*s == '\0')) {
|
| // Empty string.
|
| @@ -357,7 +334,6 @@ static bool GetCodeId(const char* s, int64_t* timestamp, uword* address) {
|
| return true;
|
| }
|
|
|
| -
|
| // Verifies that |s| begins with |prefix| and then calls |GetIntegerId| on
|
| // the remainder of |s|.
|
| static bool GetPrefixedIntegerId(const char* s,
|
| @@ -382,7 +358,6 @@ static bool GetPrefixedIntegerId(const char* s,
|
| return GetIntegerId(s, service_id);
|
| }
|
|
|
| -
|
| static bool IsValidClassId(Isolate* isolate, intptr_t cid) {
|
| ASSERT(isolate != NULL);
|
| ClassTable* class_table = isolate->class_table();
|
| @@ -390,7 +365,6 @@ static bool IsValidClassId(Isolate* isolate, intptr_t cid) {
|
| return class_table->IsValidIndex(cid) && class_table->HasValidClassAt(cid);
|
| }
|
|
|
| -
|
| static RawClass* GetClassForId(Isolate* isolate, intptr_t cid) {
|
| ASSERT(isolate == Isolate::Current());
|
| ASSERT(isolate != NULL);
|
| @@ -399,7 +373,6 @@ static RawClass* GetClassForId(Isolate* isolate, intptr_t cid) {
|
| return class_table->At(cid);
|
| }
|
|
|
| -
|
| // TODO(johnmccutchan): Split into separate file and write unit tests.
|
| class MethodParameter {
|
| public:
|
| @@ -433,7 +406,6 @@ class MethodParameter {
|
| bool required_;
|
| };
|
|
|
| -
|
| class DartStringParameter : public MethodParameter {
|
| public:
|
| DartStringParameter(const char* name, bool required)
|
| @@ -444,7 +416,6 @@ class DartStringParameter : public MethodParameter {
|
| }
|
| };
|
|
|
| -
|
| class DartListParameter : public MethodParameter {
|
| public:
|
| DartListParameter(const char* name, bool required)
|
| @@ -455,7 +426,6 @@ class DartListParameter : public MethodParameter {
|
| }
|
| };
|
|
|
| -
|
| class NoSuchParameter : public MethodParameter {
|
| public:
|
| explicit NoSuchParameter(const char* name) : MethodParameter(name, false) {}
|
| @@ -467,7 +437,6 @@ class NoSuchParameter : public MethodParameter {
|
| }
|
| };
|
|
|
| -
|
| class BoolParameter : public MethodParameter {
|
| public:
|
| BoolParameter(const char* name, bool required)
|
| @@ -488,7 +457,6 @@ class BoolParameter : public MethodParameter {
|
| }
|
| };
|
|
|
| -
|
| class UIntParameter : public MethodParameter {
|
| public:
|
| UIntParameter(const char* name, bool required)
|
| @@ -517,7 +485,6 @@ class UIntParameter : public MethodParameter {
|
| }
|
| };
|
|
|
| -
|
| class Int64Parameter : public MethodParameter {
|
| public:
|
| Int64Parameter(const char* name, bool required)
|
| @@ -546,7 +513,6 @@ class Int64Parameter : public MethodParameter {
|
| }
|
| };
|
|
|
| -
|
| class IdParameter : public MethodParameter {
|
| public:
|
| IdParameter(const char* name, bool required)
|
| @@ -555,7 +521,6 @@ class IdParameter : public MethodParameter {
|
| virtual bool Validate(const char* value) const { return (value != NULL); }
|
| };
|
|
|
| -
|
| class StringParameter : public MethodParameter {
|
| public:
|
| StringParameter(const char* name, bool required)
|
| @@ -564,7 +529,6 @@ class StringParameter : public MethodParameter {
|
| virtual bool Validate(const char* value) const { return (value != NULL); }
|
| };
|
|
|
| -
|
| class RunnableIsolateParameter : public MethodParameter {
|
| public:
|
| explicit RunnableIsolateParameter(const char* name)
|
| @@ -583,7 +547,6 @@ class RunnableIsolateParameter : public MethodParameter {
|
| }
|
| };
|
|
|
| -
|
| #define ISOLATE_PARAMETER new IdParameter("isolateId", true)
|
| #define NO_ISOLATE_PARAMETER new NoSuchParameter("isolateId")
|
| #define RUNNABLE_ISOLATE_PARAMETER new RunnableIsolateParameter("isolateId")
|
| @@ -609,7 +572,6 @@ class EnumParameter : public MethodParameter {
|
| const char* const* enums_;
|
| };
|
|
|
| -
|
| // If the key is not found, this function returns the last element in the
|
| // values array. This can be used to encode the default value.
|
| template <typename T>
|
| @@ -625,7 +587,6 @@ T EnumMapper(const char* value, const char* const* enums, T* values) {
|
| return values[i];
|
| }
|
|
|
| -
|
| class EnumListParameter : public MethodParameter {
|
| public:
|
| EnumListParameter(const char* name, bool required, const char* const* enums)
|
| @@ -740,17 +701,14 @@ class EnumListParameter : public MethodParameter {
|
| const char* const* enums_;
|
| };
|
|
|
| -
|
| typedef bool (*ServiceMethodEntry)(Thread* thread, JSONStream* js);
|
|
|
| -
|
| struct ServiceMethodDescriptor {
|
| const char* name;
|
| const ServiceMethodEntry entry;
|
| const MethodParameter* const* parameters;
|
| };
|
|
|
| -
|
| // TODO(johnmccutchan): Do we reject unexpected parameters?
|
| static bool ValidateParameters(const MethodParameter* const* parameters,
|
| JSONStream* js) {
|
| @@ -794,7 +752,6 @@ static bool ValidateParameters(const MethodParameter* const* parameters,
|
| return true;
|
| }
|
|
|
| -
|
| void Service::PostError(const String& method_name,
|
| const Array& parameter_keys,
|
| const Array& parameter_values,
|
| @@ -812,7 +769,6 @@ void Service::PostError(const String& method_name,
|
| js.PostReply();
|
| }
|
|
|
| -
|
| RawError* Service::InvokeMethod(Isolate* I,
|
| const Array& msg,
|
| bool parameters_are_dart_objects) {
|
| @@ -924,33 +880,28 @@ RawError* Service::InvokeMethod(Isolate* I,
|
| }
|
| }
|
|
|
| -
|
| RawError* Service::HandleRootMessage(const Array& msg_instance) {
|
| Isolate* isolate = Isolate::Current();
|
| return InvokeMethod(isolate, msg_instance);
|
| }
|
|
|
| -
|
| RawError* Service::HandleObjectRootMessage(const Array& msg_instance) {
|
| Isolate* isolate = Isolate::Current();
|
| return InvokeMethod(isolate, msg_instance, true);
|
| }
|
|
|
| -
|
| RawError* Service::HandleIsolateMessage(Isolate* isolate, const Array& msg) {
|
| ASSERT(isolate != NULL);
|
| const Error& error = Error::Handle(InvokeMethod(isolate, msg));
|
| return MaybePause(isolate, error);
|
| }
|
|
|
| -
|
| static void Finalizer(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* buffer) {
|
| free(buffer);
|
| }
|
|
|
| -
|
| void Service::SendEvent(const char* stream_id,
|
| const char* event_type,
|
| uint8_t* bytes,
|
| @@ -997,7 +948,6 @@ void Service::SendEvent(const char* stream_id,
|
| }
|
| }
|
|
|
| -
|
| void Service::SendEventWithData(const char* stream_id,
|
| const char* event_type,
|
| const char* metadata,
|
| @@ -1030,7 +980,6 @@ void Service::SendEventWithData(const char* stream_id,
|
| SendEvent(stream_id, event_type, message, total_bytes);
|
| }
|
|
|
| -
|
| static void ReportPauseOnConsole(ServiceEvent* event) {
|
| const char* name = event->isolate()->debugger_name();
|
| switch (event->kind()) {
|
| @@ -1087,7 +1036,6 @@ static void ReportPauseOnConsole(ServiceEvent* event) {
|
| }
|
| }
|
|
|
| -
|
| void Service::HandleEvent(ServiceEvent* event) {
|
| if (event->stream_info() != NULL && !event->stream_info()->enabled()) {
|
| if (FLAG_warn_on_pause_with_no_debugger && event->IsPause()) {
|
| @@ -1115,7 +1063,6 @@ void Service::HandleEvent(ServiceEvent* event) {
|
| PostEvent(event->isolate(), stream_id, event->KindAsCString(), &js);
|
| }
|
|
|
| -
|
| void Service::PostEvent(Isolate* isolate,
|
| const char* stream_id,
|
| const char* kind,
|
| @@ -1159,7 +1106,6 @@ void Service::PostEvent(Isolate* isolate,
|
| Dart_PostCObject(ServiceIsolate::Port(), &list_cobj);
|
| }
|
|
|
| -
|
| class EmbedderServiceHandler {
|
| public:
|
| explicit EmbedderServiceHandler(const char* name)
|
| @@ -1190,7 +1136,6 @@ class EmbedderServiceHandler {
|
| EmbedderServiceHandler* next_;
|
| };
|
|
|
| -
|
| void Service::EmbedderHandleMessage(EmbedderServiceHandler* handler,
|
| JSONStream* js) {
|
| ASSERT(handler != NULL);
|
| @@ -1212,7 +1157,6 @@ void Service::EmbedderHandleMessage(EmbedderServiceHandler* handler,
|
| free(const_cast<char*>(response));
|
| }
|
|
|
| -
|
| void Service::RegisterIsolateEmbedderCallback(
|
| const char* name,
|
| Dart_ServiceRequestCallback callback,
|
| @@ -1237,7 +1181,6 @@ void Service::RegisterIsolateEmbedderCallback(
|
| isolate_service_handler_head_ = handler;
|
| }
|
|
|
| -
|
| EmbedderServiceHandler* Service::FindIsolateEmbedderHandler(const char* name) {
|
| EmbedderServiceHandler* current = isolate_service_handler_head_;
|
| while (current != NULL) {
|
| @@ -1249,7 +1192,6 @@ EmbedderServiceHandler* Service::FindIsolateEmbedderHandler(const char* name) {
|
| return NULL;
|
| }
|
|
|
| -
|
| void Service::RegisterRootEmbedderCallback(const char* name,
|
| Dart_ServiceRequestCallback callback,
|
| void* user_data) {
|
| @@ -1273,7 +1215,6 @@ void Service::RegisterRootEmbedderCallback(const char* name,
|
| root_service_handler_head_ = handler;
|
| }
|
|
|
| -
|
| void Service::SetEmbedderStreamCallbacks(
|
| Dart_ServiceStreamListenCallback listen_callback,
|
| Dart_ServiceStreamCancelCallback cancel_callback) {
|
| @@ -1281,13 +1222,11 @@ void Service::SetEmbedderStreamCallbacks(
|
| stream_cancel_callback_ = cancel_callback;
|
| }
|
|
|
| -
|
| void Service::SetGetServiceAssetsCallback(
|
| Dart_GetVMServiceAssetsArchive get_service_assets) {
|
| get_service_assets_callback_ = get_service_assets;
|
| }
|
|
|
| -
|
| EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) {
|
| EmbedderServiceHandler* current = root_service_handler_head_;
|
| while (current != NULL) {
|
| @@ -1299,7 +1238,6 @@ EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) {
|
| return NULL;
|
| }
|
|
|
| -
|
| void Service::ScheduleExtensionHandler(const Instance& handler,
|
| const String& method_name,
|
| const Array& parameter_keys,
|
| @@ -1317,23 +1255,19 @@ void Service::ScheduleExtensionHandler(const Instance& handler,
|
| parameter_values, reply_port, id);
|
| }
|
|
|
| -
|
| static const MethodParameter* get_isolate_params[] = {
|
| ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetIsolate(Thread* thread, JSONStream* js) {
|
| thread->isolate()->PrintJSON(js, false);
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_stack_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new BoolParameter("_full", false), NULL,
|
| };
|
|
|
| -
|
| static bool GetStack(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| if (isolate->debugger() == NULL) {
|
| @@ -1393,7 +1327,6 @@ static bool GetStack(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) {
|
| jsobj->AddProperty("type", "_EchoResponse");
|
| if (js->HasParam("text")) {
|
| @@ -1402,7 +1335,6 @@ static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| void Service::SendEchoEvent(Isolate* isolate, const char* text) {
|
| JSONStream js;
|
| {
|
| @@ -1429,7 +1361,6 @@ void Service::SendEchoEvent(Isolate* isolate, const char* text) {
|
| js.buffer()->length(), data, sizeof(data));
|
| }
|
|
|
| -
|
| static bool TriggerEchoEvent(Thread* thread, JSONStream* js) {
|
| if (Service::echo_stream.enabled()) {
|
| Service::SendEchoEvent(thread->isolate(), js->LookupParam("text"));
|
| @@ -1438,7 +1369,6 @@ static bool TriggerEchoEvent(Thread* thread, JSONStream* js) {
|
| return HandleCommonEcho(&jsobj, js);
|
| }
|
|
|
| -
|
| static bool DumpIdZone(Thread* thread, JSONStream* js) {
|
| // TODO(johnmccutchan): Respect _idZone parameter passed to RPC. For now,
|
| // always send the ObjectIdRing.
|
| @@ -1453,13 +1383,11 @@ static bool DumpIdZone(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool Echo(Thread* thread, JSONStream* js) {
|
| JSONObject jsobj(js);
|
| return HandleCommonEcho(&jsobj, js);
|
| }
|
|
|
| -
|
| static bool ContainsNonInstance(const Object& obj) {
|
| if (obj.IsArray()) {
|
| const Array& array = Array::Cast(obj);
|
| @@ -1486,7 +1414,6 @@ static bool ContainsNonInstance(const Object& obj) {
|
| }
|
| }
|
|
|
| -
|
| static RawObject* LookupObjectId(Thread* thread,
|
| const char* arg,
|
| ObjectIdRing::LookupResult* kind) {
|
| @@ -1519,7 +1446,6 @@ static RawObject* LookupObjectId(Thread* thread,
|
| return ring->GetObjectForId(id, kind);
|
| }
|
|
|
| -
|
| static RawObject* LookupHeapObjectLibraries(Isolate* isolate,
|
| char** parts,
|
| int num_parts) {
|
| @@ -1708,7 +1634,6 @@ static RawObject* LookupHeapObjectClasses(Thread* thread,
|
| return Object::sentinel().raw();
|
| }
|
|
|
| -
|
| static RawObject* LookupHeapObjectTypeArguments(Thread* thread,
|
| char** parts,
|
| int num_parts) {
|
| @@ -1732,7 +1657,6 @@ static RawObject* LookupHeapObjectTypeArguments(Thread* thread,
|
| return table.At(id);
|
| }
|
|
|
| -
|
| static RawObject* LookupHeapObjectCode(Isolate* isolate,
|
| char** parts,
|
| int num_parts) {
|
| @@ -1781,7 +1705,6 @@ static RawObject* LookupHeapObjectCode(Isolate* isolate,
|
| return Object::sentinel().raw();
|
| }
|
|
|
| -
|
| static RawObject* LookupHeapObjectMessage(Thread* thread,
|
| char** parts,
|
| int num_parts) {
|
| @@ -1806,7 +1729,6 @@ static RawObject* LookupHeapObjectMessage(Thread* thread,
|
| }
|
| }
|
|
|
| -
|
| static RawObject* LookupHeapObject(Thread* thread,
|
| const char* id_original,
|
| ObjectIdRing::LookupResult* result) {
|
| @@ -1868,14 +1790,12 @@ static RawObject* LookupHeapObject(Thread* thread,
|
| return Object::sentinel().raw();
|
| }
|
|
|
| -
|
| enum SentinelType {
|
| kCollectedSentinel,
|
| kExpiredSentinel,
|
| kFreeSentinel,
|
| };
|
|
|
| -
|
| static void PrintSentinel(JSONStream* js, SentinelType sentinel_type) {
|
| JSONObject jsobj(js);
|
| jsobj.AddProperty("type", "Sentinel");
|
| @@ -1898,7 +1818,6 @@ static void PrintSentinel(JSONStream* js, SentinelType sentinel_type) {
|
| }
|
| }
|
|
|
| -
|
| static Breakpoint* LookupBreakpoint(Isolate* isolate,
|
| const char* id,
|
| ObjectIdRing::LookupResult* result) {
|
| @@ -1926,7 +1845,6 @@ static Breakpoint* LookupBreakpoint(Isolate* isolate,
|
| return NULL;
|
| }
|
|
|
| -
|
| static bool PrintInboundReferences(Thread* thread,
|
| Object* target,
|
| intptr_t limit,
|
| @@ -1979,12 +1897,10 @@ static bool PrintInboundReferences(Thread* thread,
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_inbound_references_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetInboundReferences(Thread* thread, JSONStream* js) {
|
| const char* target_id = js->LookupParam("targetId");
|
| if (target_id == NULL) {
|
| @@ -2021,7 +1937,6 @@ static bool GetInboundReferences(Thread* thread, JSONStream* js) {
|
| return PrintInboundReferences(thread, &obj, limit, js);
|
| }
|
|
|
| -
|
| static bool PrintRetainingPath(Thread* thread,
|
| Object* obj,
|
| intptr_t limit,
|
| @@ -2093,12 +2008,10 @@ static bool PrintRetainingPath(Thread* thread,
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_retaining_path_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetRetainingPath(Thread* thread, JSONStream* js) {
|
| const char* target_id = js->LookupParam("targetId");
|
| if (target_id == NULL) {
|
| @@ -2135,12 +2048,10 @@ static bool GetRetainingPath(Thread* thread, JSONStream* js) {
|
| return PrintRetainingPath(thread, &obj, limit, js);
|
| }
|
|
|
| -
|
| static const MethodParameter* get_retained_size_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL,
|
| };
|
|
|
| -
|
| static bool GetRetainedSize(Thread* thread, JSONStream* js) {
|
| const char* target_id = js->LookupParam("targetId");
|
| ASSERT(target_id != NULL);
|
| @@ -2175,12 +2086,10 @@ static bool GetRetainedSize(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_reachable_size_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL,
|
| };
|
|
|
| -
|
| static bool GetReachableSize(Thread* thread, JSONStream* js) {
|
| const char* target_id = js->LookupParam("targetId");
|
| ASSERT(target_id != NULL);
|
| @@ -2215,12 +2124,10 @@ static bool GetReachableSize(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* evaluate_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool IsAlpha(char c) {
|
| return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
|
| }
|
| @@ -2234,7 +2141,6 @@ static bool IsObjectIdChar(char c) {
|
| return IsAlphaNum(c) || c == '/' || c == '-' || c == '@' || c == '%';
|
| }
|
|
|
| -
|
| // TODO(vm-service): Consider whether we should pass structured objects in
|
| // service messages instead of always flattening them to C strings.
|
| static bool ParseScope(const char* scope,
|
| @@ -2284,7 +2190,6 @@ static bool ParseScope(const char* scope,
|
| return false;
|
| }
|
|
|
| -
|
| static bool BuildScope(Thread* thread,
|
| JSONStream* js,
|
| const GrowableObjectArray& names,
|
| @@ -2327,7 +2232,6 @@ static bool BuildScope(Thread* thread,
|
| return false;
|
| }
|
|
|
| -
|
| static bool Evaluate(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(kFeatureDisabled,
|
| @@ -2403,13 +2307,11 @@ static bool Evaluate(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* evaluate_in_frame_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("frameIndex", true),
|
| new MethodParameter("expression", true), NULL,
|
| };
|
|
|
| -
|
| static bool EvaluateInFrame(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| if (!isolate->compilation_allowed()) {
|
| @@ -2443,7 +2345,6 @@ static bool EvaluateInFrame(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| class GetInstancesVisitor : public ObjectGraph::Visitor {
|
| public:
|
| GetInstancesVisitor(const Class& cls, const Array& storage)
|
| @@ -2475,12 +2376,10 @@ class GetInstancesVisitor : public ObjectGraph::Visitor {
|
| intptr_t count_;
|
| };
|
|
|
| -
|
| static const MethodParameter* get_instances_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetInstances(Thread* thread, JSONStream* js) {
|
| const char* target_id = js->LookupParam("classId");
|
| if (target_id == NULL) {
|
| @@ -2530,7 +2429,6 @@ static bool GetInstances(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const char* const report_enum_names[] = {
|
| SourceReport::kCallSitesStr,
|
| SourceReport::kCoverageStr,
|
| @@ -2539,7 +2437,6 @@ static const char* const report_enum_names[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static const MethodParameter* get_source_report_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new EnumListParameter("reports", true, report_enum_names),
|
| @@ -2550,7 +2447,6 @@ static const MethodParameter* get_source_report_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool GetSourceReport(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(
|
| @@ -2617,7 +2513,6 @@ static bool GetSourceReport(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* reload_sources_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new BoolParameter("force", false),
|
| @@ -2627,7 +2522,6 @@ static const MethodParameter* reload_sources_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool ReloadSources(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| if (!isolate->compilation_allowed()) {
|
| @@ -2668,14 +2562,12 @@ static bool ReloadSources(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| void Service::CheckForPause(Isolate* isolate, JSONStream* stream) {
|
| // Should we pause?
|
| isolate->set_should_pause_post_service_request(
|
| BoolParameter::Parse(stream->LookupParam("pause"), false));
|
| }
|
|
|
| -
|
| RawError* Service::MaybePause(Isolate* isolate, const Error& error) {
|
| // Don't pause twice.
|
| if (!isolate->IsPaused()) {
|
| @@ -2692,7 +2584,6 @@ RawError* Service::MaybePause(Isolate* isolate, const Error& error) {
|
| return error.raw();
|
| }
|
|
|
| -
|
| static bool AddBreakpointCommon(Thread* thread,
|
| JSONStream* js,
|
| const String& script_uri) {
|
| @@ -2728,7 +2619,6 @@ static bool AddBreakpointCommon(Thread* thread,
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* add_breakpoint_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new IdParameter("scriptId", true),
|
| @@ -2737,7 +2627,6 @@ static const MethodParameter* add_breakpoint_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool AddBreakpoint(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(
|
| @@ -2757,7 +2646,6 @@ static bool AddBreakpoint(Thread* thread, JSONStream* js) {
|
| return AddBreakpointCommon(thread, js, script_uri);
|
| }
|
|
|
| -
|
| static const MethodParameter* add_breakpoint_with_script_uri_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new IdParameter("scriptUri", true),
|
| @@ -2766,7 +2654,6 @@ static const MethodParameter* add_breakpoint_with_script_uri_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(
|
| @@ -2779,12 +2666,10 @@ static bool AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) {
|
| return AddBreakpointCommon(thread, js, script_uri);
|
| }
|
|
|
| -
|
| static const MethodParameter* add_breakpoint_at_entry_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new IdParameter("functionId", true), NULL,
|
| };
|
|
|
| -
|
| static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(
|
| @@ -2811,12 +2696,10 @@ static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* add_breakpoint_at_activation_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new IdParameter("objectId", true), NULL,
|
| };
|
|
|
| -
|
| static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(
|
| @@ -2842,12 +2725,10 @@ static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* remove_breakpoint_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool RemoveBreakpoint(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(
|
| @@ -2874,7 +2755,6 @@ static bool RemoveBreakpoint(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static RawClass* GetMetricsClass(Thread* thread) {
|
| Zone* zone = thread->zone();
|
| const Library& prof_lib = Library::Handle(zone, Library::DeveloperLibrary());
|
| @@ -2887,7 +2767,6 @@ static RawClass* GetMetricsClass(Thread* thread) {
|
| return metrics_cls.raw();
|
| }
|
|
|
| -
|
| static bool HandleNativeMetricsList(Thread* thread, JSONStream* js) {
|
| JSONObject obj(js);
|
| obj.AddProperty("type", "MetricList");
|
| @@ -2902,7 +2781,6 @@ static bool HandleNativeMetricsList(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool HandleNativeMetric(Thread* thread, JSONStream* js, const char* id) {
|
| Metric* current = thread->isolate()->metrics_list_head();
|
| while (current != NULL) {
|
| @@ -2918,7 +2796,6 @@ static bool HandleNativeMetric(Thread* thread, JSONStream* js, const char* id) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool HandleDartMetricsList(Thread* thread, JSONStream* js) {
|
| Zone* zone = thread->zone();
|
| const Class& metrics_cls = Class::Handle(zone, GetMetricsClass(thread));
|
| @@ -2938,7 +2815,6 @@ static bool HandleDartMetricsList(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool HandleDartMetric(Thread* thread, JSONStream* js, const char* id) {
|
| Zone* zone = thread->zone();
|
| const Class& metrics_cls = Class::Handle(zone, GetMetricsClass(thread));
|
| @@ -2964,12 +2840,10 @@ static bool HandleDartMetric(Thread* thread, JSONStream* js, const char* id) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_isolate_metric_list_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetIsolateMetricList(Thread* thread, JSONStream* js) {
|
| bool native_metrics = false;
|
| if (js->HasParam("type")) {
|
| @@ -2991,12 +2865,10 @@ static bool GetIsolateMetricList(Thread* thread, JSONStream* js) {
|
| return HandleDartMetricsList(thread, js);
|
| }
|
|
|
| -
|
| static const MethodParameter* get_isolate_metric_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetIsolateMetric(Thread* thread, JSONStream* js) {
|
| const char* metric_id = js->LookupParam("metricId");
|
| if (metric_id == NULL) {
|
| @@ -3023,22 +2895,18 @@ static bool GetIsolateMetric(Thread* thread, JSONStream* js) {
|
| return HandleDartMetric(thread, js, id);
|
| }
|
|
|
| -
|
| static const MethodParameter* get_vm_metric_list_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetVMMetricList(Thread* thread, JSONStream* js) {
|
| return false;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_vm_metric_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetVMMetric(Thread* thread, JSONStream* js) {
|
| const char* metric_id = js->LookupParam("metricId");
|
| if (metric_id == NULL) {
|
| @@ -3062,7 +2930,6 @@ static const MethodParameter* set_vm_timeline_flags_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool HasStream(const char** recorded_streams, const char* stream) {
|
| while (*recorded_streams != NULL) {
|
| if ((strstr(*recorded_streams, "all") != NULL) ||
|
| @@ -3074,7 +2941,6 @@ static bool HasStream(const char** recorded_streams, const char* stream) {
|
| return false;
|
| }
|
|
|
| -
|
| static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
| if (!FLAG_support_timeline) {
|
| PrintSuccess(js);
|
| @@ -3101,12 +2967,10 @@ static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_vm_timeline_flags_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
| if (!FLAG_support_timeline) {
|
| JSONObject obj(js);
|
| @@ -3120,12 +2984,10 @@ static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* clear_vm_timeline_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool ClearVMTimeline(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| ASSERT(isolate != NULL);
|
| @@ -3138,13 +3000,11 @@ static bool ClearVMTimeline(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_vm_timeline_params[] = {
|
| NO_ISOLATE_PARAMETER, new Int64Parameter("timeOriginMicros", false),
|
| new Int64Parameter("timeExtentMicros", false), NULL,
|
| };
|
|
|
| -
|
| static bool GetVMTimeline(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| ASSERT(isolate != NULL);
|
| @@ -3162,12 +3022,10 @@ static bool GetVMTimeline(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const char* const step_enum_names[] = {
|
| "None", "Into", "Over", "Out", "Rewind", "OverAsyncSuspension", NULL,
|
| };
|
|
|
| -
|
| static const Debugger::ResumeAction step_enum_values[] = {
|
| Debugger::kContinue, Debugger::kStepInto,
|
| Debugger::kStepOver, Debugger::kStepOut,
|
| @@ -3175,14 +3033,12 @@ static const Debugger::ResumeAction step_enum_values[] = {
|
| Debugger::kContinue, // Default value
|
| };
|
|
|
| -
|
| static const MethodParameter* resume_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new EnumParameter("step", false, step_enum_names),
|
| new UIntParameter("frameIndex", false), NULL,
|
| };
|
|
|
| -
|
| static bool Resume(Thread* thread, JSONStream* js) {
|
| const char* step_param = js->LookupParam("step");
|
| Debugger::ResumeAction step = Debugger::kContinue;
|
| @@ -3250,12 +3106,10 @@ static bool Resume(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* pause_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool Pause(Thread* thread, JSONStream* js) {
|
| // TODO(turnidge): This interrupt message could have been sent from
|
| // the service isolate directly, but would require some special case
|
| @@ -3268,12 +3122,10 @@ static bool Pause(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_tag_profile_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetTagProfile(Thread* thread, JSONStream* js) {
|
| JSONObject miniProfile(js);
|
| miniProfile.AddProperty("type", "TagProfile");
|
| @@ -3281,19 +3133,16 @@ static bool GetTagProfile(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const char* const tags_enum_names[] = {
|
| "None", "UserVM", "UserOnly", "VMUser", "VMOnly", NULL,
|
| };
|
|
|
| -
|
| static const Profile::TagOrder tags_enum_values[] = {
|
| Profile::kNoTags, Profile::kUserVM, Profile::kUser,
|
| Profile::kVMUser, Profile::kVM,
|
| Profile::kNoTags, // Default value.
|
| };
|
|
|
| -
|
| static const MethodParameter* get_cpu_profile_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new EnumParameter("tags", true, tags_enum_names),
|
| @@ -3303,7 +3152,6 @@ static const MethodParameter* get_cpu_profile_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| // TODO(johnmccutchan): Rename this to GetCpuSamples.
|
| static bool GetCpuProfile(Thread* thread, JSONStream* js) {
|
| Profile::TagOrder tag_order =
|
| @@ -3321,7 +3169,6 @@ static bool GetCpuProfile(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_cpu_profile_timeline_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new EnumParameter("tags", true, tags_enum_names),
|
| @@ -3330,7 +3177,6 @@ static const MethodParameter* get_cpu_profile_timeline_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool GetCpuProfileTimeline(Thread* thread, JSONStream* js) {
|
| Profile::TagOrder tag_order =
|
| EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values);
|
| @@ -3343,7 +3189,6 @@ static bool GetCpuProfileTimeline(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_allocation_samples_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new EnumParameter("tags", true, tags_enum_names),
|
| @@ -3353,7 +3198,6 @@ static const MethodParameter* get_allocation_samples_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool GetAllocationSamples(Thread* thread, JSONStream* js) {
|
| Profile::TagOrder tag_order =
|
| EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values);
|
| @@ -3375,7 +3219,6 @@ static bool GetAllocationSamples(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_native_allocation_samples_params[] = {
|
| NO_ISOLATE_PARAMETER,
|
| new EnumParameter("tags", true, tags_enum_names),
|
| @@ -3384,7 +3227,6 @@ static const MethodParameter* get_native_allocation_samples_params[] = {
|
| NULL,
|
| };
|
|
|
| -
|
| static bool GetNativeAllocationSamples(Thread* thread, JSONStream* js) {
|
| Profile::TagOrder tag_order =
|
| EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values);
|
| @@ -3400,24 +3242,20 @@ static bool GetNativeAllocationSamples(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* clear_cpu_profile_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool ClearCpuProfile(Thread* thread, JSONStream* js) {
|
| ProfilerService::ClearSamples();
|
| PrintSuccess(js);
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_allocation_profile_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetAllocationProfile(Thread* thread, JSONStream* js) {
|
| bool should_reset_accumulator = false;
|
| bool should_collect = false;
|
| @@ -3450,7 +3288,6 @@ static bool GetAllocationProfile(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* collect_all_garbage_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
| @@ -3469,12 +3306,10 @@ static bool CollectAllGarbage(Thread* thread, JSONStream* js) {
|
| }
|
| #endif // defined(DEBUG)
|
|
|
| -
|
| static const MethodParameter* get_heap_map_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetHeapMap(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| bool should_collect = false;
|
| @@ -3493,24 +3328,20 @@ static bool GetHeapMap(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const char* snapshot_roots_names[] = {
|
| "User", "VM", NULL,
|
| };
|
|
|
| -
|
| static ObjectGraph::SnapshotRoots snapshot_roots_values[] = {
|
| ObjectGraph::kUser, ObjectGraph::kVM,
|
| };
|
|
|
| -
|
| static const MethodParameter* request_heap_snapshot_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER,
|
| new EnumParameter("roots", false /* not required */, snapshot_roots_names),
|
| new BoolParameter("collectGarbage", false /* not required */), NULL,
|
| };
|
|
|
| -
|
| static bool RequestHeapSnapshot(Thread* thread, JSONStream* js) {
|
| ObjectGraph::SnapshotRoots roots = ObjectGraph::kVM;
|
| const char* roots_arg = js->LookupParam("roots");
|
| @@ -3527,7 +3358,6 @@ static bool RequestHeapSnapshot(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| void Service::SendGraphEvent(Thread* thread,
|
| ObjectGraph::SnapshotRoots roots,
|
| bool collect_garbage) {
|
| @@ -3574,7 +3404,6 @@ void Service::SendGraphEvent(Thread* thread,
|
| }
|
| }
|
|
|
| -
|
| void Service::SendInspectEvent(Isolate* isolate, const Object& inspectee) {
|
| if (!Service::debug_stream.enabled()) {
|
| return;
|
| @@ -3584,7 +3413,6 @@ void Service::SendInspectEvent(Isolate* isolate, const Object& inspectee) {
|
| Service::HandleEvent(&event);
|
| }
|
|
|
| -
|
| void Service::SendEmbedderEvent(Isolate* isolate,
|
| const char* stream_id,
|
| const char* event_kind,
|
| @@ -3600,7 +3428,6 @@ void Service::SendEmbedderEvent(Isolate* isolate,
|
| Service::HandleEvent(&event);
|
| }
|
|
|
| -
|
| void Service::SendLogEvent(Isolate* isolate,
|
| int64_t sequence_number,
|
| int64_t timestamp,
|
| @@ -3627,7 +3454,6 @@ void Service::SendLogEvent(Isolate* isolate,
|
| Service::HandleEvent(&event);
|
| }
|
|
|
| -
|
| void Service::SendExtensionEvent(Isolate* isolate,
|
| const String& event_kind,
|
| const String& event_data) {
|
| @@ -3642,7 +3468,6 @@ void Service::SendExtensionEvent(Isolate* isolate,
|
| Service::HandleEvent(&event);
|
| }
|
|
|
| -
|
| class ContainsAddressVisitor : public FindObjectVisitor {
|
| public:
|
| explicit ContainsAddressVisitor(uword addr) : addr_(addr) {}
|
| @@ -3663,12 +3488,10 @@ class ContainsAddressVisitor : public FindObjectVisitor {
|
| uword addr_;
|
| };
|
|
|
| -
|
| static const MethodParameter* get_object_by_address_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static RawObject* GetObjectHelper(Thread* thread, uword addr) {
|
| Object& object = Object::Handle(thread->zone());
|
|
|
| @@ -3692,7 +3515,6 @@ static RawObject* GetObjectHelper(Thread* thread, uword addr) {
|
| return object.raw();
|
| }
|
|
|
| -
|
| static bool GetObjectByAddress(Thread* thread, JSONStream* js) {
|
| const char* addr_str = js->LookupParam("address");
|
| if (addr_str == NULL) {
|
| @@ -3717,12 +3539,10 @@ static bool GetObjectByAddress(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_persistent_handles_params[] = {
|
| ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| template <typename T>
|
| class PersistentHandleVisitor : public HandleVisitor {
|
| public:
|
| @@ -3773,7 +3593,6 @@ class PersistentHandleVisitor : public HandleVisitor {
|
| JSONArray* handles_;
|
| };
|
|
|
| -
|
| static bool GetPersistentHandles(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| ASSERT(isolate != NULL);
|
| @@ -3806,19 +3625,16 @@ static bool GetPersistentHandles(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_ports_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetPorts(Thread* thread, JSONStream* js) {
|
| MessageHandler* message_handler = thread->isolate()->message_handler();
|
| PortMap::PrintPortsForMessageHandler(message_handler, js);
|
| return true;
|
| }
|
|
|
| -
|
| static bool RespondWithMalformedJson(Thread* thread, JSONStream* js) {
|
| JSONObject jsobj(js);
|
| jsobj.AddProperty("a", "a");
|
| @@ -3831,20 +3647,17 @@ static bool RespondWithMalformedJson(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static bool RespondWithMalformedObject(Thread* thread, JSONStream* js) {
|
| JSONObject jsobj(js);
|
| jsobj.AddProperty("bart", "simpson");
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_object_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("offset", false),
|
| new UIntParameter("count", false), NULL,
|
| };
|
|
|
| -
|
| static bool GetObject(Thread* thread, JSONStream* js) {
|
| const char* id = js->LookupParam("objectId");
|
| if (id == NULL) {
|
| @@ -3898,24 +3711,20 @@ static bool GetObject(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_object_store_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetObjectStore(Thread* thread, JSONStream* js) {
|
| JSONObject jsobj(js);
|
| thread->isolate()->object_store()->PrintToJSONObject(&jsobj);
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_class_list_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetClassList(Thread* thread, JSONStream* js) {
|
| ClassTable* table = thread->isolate()->class_table();
|
| JSONObject jsobj(js);
|
| @@ -3923,12 +3732,10 @@ static bool GetClassList(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_type_arguments_list_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) {
|
| bool only_with_instantiations = false;
|
| if (js->ParamIs("onlyWithInstantiations", "true")) {
|
| @@ -3961,12 +3768,10 @@ static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_version_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetVersion(Thread* thread, JSONStream* js) {
|
| JSONObject jsobj(js);
|
| jsobj.AddProperty("type", "Version");
|
| @@ -3979,7 +3784,6 @@ static bool GetVersion(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| class ServiceIsolateVisitor : public IsolateVisitor {
|
| public:
|
| explicit ServiceIsolateVisitor(JSONArray* jsarr) : jsarr_(jsarr) {}
|
| @@ -4000,12 +3804,10 @@ class ServiceIsolateVisitor : public IsolateVisitor {
|
| JSONArray* jsarr_;
|
| };
|
|
|
| -
|
| static const MethodParameter* get_vm_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| void Service::PrintJSONForVM(JSONStream* js, bool ref) {
|
| JSONObject jsobj(js);
|
| jsobj.AddProperty("type", (ref ? "@VM" : "VM"));
|
| @@ -4033,30 +3835,25 @@ void Service::PrintJSONForVM(JSONStream* js, bool ref) {
|
| }
|
| }
|
|
|
| -
|
| static bool GetVM(Thread* thread, JSONStream* js) {
|
| Service::PrintJSONForVM(js, false);
|
| return true;
|
| }
|
|
|
| -
|
| static const char* exception_pause_mode_names[] = {
|
| "All", "None", "Unhandled", NULL,
|
| };
|
|
|
| -
|
| static Dart_ExceptionPauseInfo exception_pause_mode_values[] = {
|
| kPauseOnAllExceptions, kNoPauseOnExceptions, kPauseOnUnhandledExceptions,
|
| kInvalidExceptionPauseInfo,
|
| };
|
|
|
| -
|
| static const MethodParameter* set_exception_pause_mode_params[] = {
|
| ISOLATE_PARAMETER,
|
| new EnumParameter("mode", true, exception_pause_mode_names), NULL,
|
| };
|
|
|
| -
|
| static bool SetExceptionPauseMode(Thread* thread, JSONStream* js) {
|
| const char* mode = js->LookupParam("mode");
|
| if (mode == NULL) {
|
| @@ -4079,23 +3876,19 @@ static bool SetExceptionPauseMode(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* get_flag_list_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool GetFlagList(Thread* thread, JSONStream* js) {
|
| Flags::PrintJSON(js);
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* set_flags_params[] = {
|
| NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
| -
|
| static bool SetFlag(Thread* thread, JSONStream* js) {
|
| const char* flag_name = js->LookupParam("name");
|
| if (flag_name == NULL) {
|
| @@ -4119,13 +3912,11 @@ static bool SetFlag(Thread* thread, JSONStream* js) {
|
| }
|
| }
|
|
|
| -
|
| static const MethodParameter* set_library_debuggable_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new IdParameter("libraryId", true),
|
| new BoolParameter("isDebuggable", true), NULL,
|
| };
|
|
|
| -
|
| static bool SetLibraryDebuggable(Thread* thread, JSONStream* js) {
|
| const char* lib_id = js->LookupParam("libraryId");
|
| ObjectIdRing::LookupResult lookup_result;
|
| @@ -4150,12 +3941,10 @@ static bool SetLibraryDebuggable(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* set_name_params[] = {
|
| ISOLATE_PARAMETER, new MethodParameter("name", true), NULL,
|
| };
|
|
|
| -
|
| static bool SetName(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| isolate->set_debugger_name(js->LookupParam("name"));
|
| @@ -4167,12 +3956,10 @@ static bool SetName(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* set_vm_name_params[] = {
|
| NO_ISOLATE_PARAMETER, new MethodParameter("name", true), NULL,
|
| };
|
|
|
| -
|
| static bool SetVMName(Thread* thread, JSONStream* js) {
|
| const char* name_param = js->LookupParam("name");
|
| free(vm_name);
|
| @@ -4185,13 +3972,11 @@ static bool SetVMName(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| static const MethodParameter* set_trace_class_allocation_params[] = {
|
| RUNNABLE_ISOLATE_PARAMETER, new IdParameter("classId", true),
|
| new BoolParameter("enable", true), NULL,
|
| };
|
|
|
| -
|
| static bool SetTraceClassAllocation(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| js->PrintError(
|
| @@ -4251,7 +4036,6 @@ static bool SendObjectToEditor(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
|
|
| -
|
| // clang-format off
|
| static const ServiceMethodDescriptor service_methods_[] = {
|
| { "_dumpIdZone", DumpIdZone, NULL },
|
|
|