| Index: runtime/vm/service.cc
|
| diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
|
| index bb9ada10a091635cd3039fb2974d1c2e981a41db..1c05a5c3df5d165937d23b18fe6e8edbea18b528 100644
|
| --- a/runtime/vm/service.cc
|
| +++ b/runtime/vm/service.cc
|
| @@ -48,11 +48,15 @@ namespace dart {
|
| DECLARE_FLAG(bool, trace_service);
|
| DECLARE_FLAG(bool, trace_service_pause_events);
|
| DECLARE_FLAG(bool, profile_vm);
|
| -DEFINE_FLAG(charp, vm_name, "vm",
|
| +DEFINE_FLAG(charp,
|
| + vm_name,
|
| + "vm",
|
| "The default name of this vm as reported by the VM service "
|
| "protocol");
|
|
|
| -DEFINE_FLAG(bool, warn_on_pause_with_no_debugger, false,
|
| +DEFINE_FLAG(bool,
|
| + warn_on_pause_with_no_debugger,
|
| + false,
|
| "Print a message when an isolate is paused but there is no "
|
| "debugger attached.");
|
|
|
| @@ -69,26 +73,21 @@ static const char* GetVMName() {
|
| }
|
|
|
|
|
| -ServiceIdZone::ServiceIdZone() {
|
| -}
|
| +ServiceIdZone::ServiceIdZone() {}
|
|
|
|
|
| -ServiceIdZone::~ServiceIdZone() {
|
| -}
|
| +ServiceIdZone::~ServiceIdZone() {}
|
|
|
|
|
| RingServiceIdZone::RingServiceIdZone()
|
| - : ring_(NULL),
|
| - policy_(ObjectIdRing::kAllocateId) {
|
| -}
|
| + : ring_(NULL), policy_(ObjectIdRing::kAllocateId) {}
|
|
|
|
|
| -RingServiceIdZone::~RingServiceIdZone() {
|
| -}
|
| +RingServiceIdZone::~RingServiceIdZone() {}
|
|
|
|
|
| -void RingServiceIdZone::Init(
|
| - ObjectIdRing* ring, ObjectIdRing::IdPolicy policy) {
|
| +void RingServiceIdZone::Init(ObjectIdRing* ring,
|
| + ObjectIdRing::IdPolicy policy) {
|
| ring_ = ring;
|
| policy_ = policy;
|
| }
|
| @@ -128,25 +127,19 @@ StreamInfo Service::extension_stream("Extension");
|
| StreamInfo Service::timeline_stream("Timeline");
|
|
|
| static StreamInfo* streams_[] = {
|
| - &Service::vm_stream,
|
| - &Service::isolate_stream,
|
| - &Service::debug_stream,
|
| - &Service::gc_stream,
|
| - &Service::echo_stream,
|
| - &Service::graph_stream,
|
| - &Service::logging_stream,
|
| - &Service::extension_stream,
|
| - &Service::timeline_stream,
|
| + &Service::vm_stream, &Service::isolate_stream,
|
| + &Service::debug_stream, &Service::gc_stream,
|
| + &Service::echo_stream, &Service::graph_stream,
|
| + &Service::logging_stream, &Service::extension_stream,
|
| + &Service::timeline_stream,
|
| };
|
|
|
|
|
| bool Service::ListenStream(const char* stream_id) {
|
| if (FLAG_trace_service) {
|
| - OS::Print("vm-service: starting stream '%s'\n",
|
| - stream_id);
|
| + OS::Print("vm-service: starting stream '%s'\n", stream_id);
|
| }
|
| - intptr_t num_streams = sizeof(streams_) /
|
| - sizeof(streams_[0]);
|
| + intptr_t num_streams = sizeof(streams_) / sizeof(streams_[0]);
|
| for (intptr_t i = 0; i < num_streams; i++) {
|
| if (strcmp(stream_id, streams_[i]->id()) == 0) {
|
| streams_[i]->set_enabled(true);
|
| @@ -164,11 +157,9 @@ bool Service::ListenStream(const char* stream_id) {
|
|
|
| void Service::CancelStream(const char* stream_id) {
|
| if (FLAG_trace_service) {
|
| - OS::Print("vm-service: stopping stream '%s'\n",
|
| - stream_id);
|
| + OS::Print("vm-service: stopping stream '%s'\n", stream_id);
|
| }
|
| - intptr_t num_streams = sizeof(streams_) /
|
| - sizeof(streams_[0]);
|
| + intptr_t num_streams = sizeof(streams_) / sizeof(streams_[0]);
|
| for (intptr_t i = 0; i < num_streams; i++) {
|
| if (strcmp(stream_id, streams_[i]->id()) == 0) {
|
| streams_[i]->set_enabled(false);
|
| @@ -198,20 +189,18 @@ RawObject* Service::RequestAssets() {
|
| return Object::null();
|
| }
|
| if (!object.IsTypedData()) {
|
| - const String& error_message =
|
| - String::Handle(
|
| - String::New("An implementation of Dart_GetVMServiceAssetsArchive "
|
| - "should return a Uint8Array or null."));
|
| + const String& error_message = String::Handle(
|
| + String::New("An implementation of Dart_GetVMServiceAssetsArchive "
|
| + "should return a Uint8Array or null."));
|
| const Error& error = Error::Handle(ApiError::New(error_message));
|
| Exceptions::PropagateError(error);
|
| return Object::null();
|
| }
|
| const TypedData& typed_data = TypedData::Cast(object);
|
| if (typed_data.ElementSizeInBytes() != 1) {
|
| - const String& error_message =
|
| - String::Handle(
|
| - String::New("An implementation of Dart_GetVMServiceAssetsArchive "
|
| - "should return a Uint8Array or null."));
|
| + const String& error_message = String::Handle(
|
| + String::New("An implementation of Dart_GetVMServiceAssetsArchive "
|
| + "should return a Uint8Array or null."));
|
| const Error& error = Error::Handle(ApiError::New(error_message));
|
| Exceptions::PropagateError(error);
|
| return Object::null();
|
| @@ -229,26 +218,21 @@ static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
|
| }
|
|
|
|
|
| -static void PrintMissingParamError(JSONStream* js,
|
| - const char* param) {
|
| - js->PrintError(kInvalidParams,
|
| - "%s expects the '%s' parameter", js->method(), param);
|
| +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 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 PrintIllegalParamError(JSONStream* js, const char* param) {
|
| + js->PrintError(kInvalidParams, "%s: illegal '%s' parameter: %s", js->method(),
|
| + param, js->LookupParam(param));
|
| }
|
|
|
|
|
| @@ -416,26 +400,17 @@ static RawClass* GetClassForId(Isolate* isolate, intptr_t cid) {
|
| class MethodParameter {
|
| public:
|
| MethodParameter(const char* name, bool required)
|
| - : name_(name), required_(required) {
|
| - }
|
| + : name_(name), required_(required) {}
|
|
|
| - virtual ~MethodParameter() { }
|
| + virtual ~MethodParameter() {}
|
|
|
| - virtual bool Validate(const char* value) const {
|
| - return true;
|
| - }
|
| + virtual bool Validate(const char* value) const { return true; }
|
|
|
| - virtual bool ValidateObject(const Object& value) const {
|
| - return true;
|
| - }
|
| + virtual bool ValidateObject(const Object& value) const { return true; }
|
|
|
| - const char* name() const {
|
| - return name_;
|
| - }
|
| + const char* name() const { return name_; }
|
|
|
| - bool required() const {
|
| - return required_;
|
| - }
|
| + bool required() const { return required_; }
|
|
|
| virtual void PrintError(const char* name,
|
| const char* value,
|
| @@ -458,8 +433,7 @@ class MethodParameter {
|
| class DartStringParameter : public MethodParameter {
|
| public:
|
| DartStringParameter(const char* name, bool required)
|
| - : MethodParameter(name, required) {
|
| - }
|
| + : MethodParameter(name, required) {}
|
|
|
| virtual bool ValidateObject(const Object& value) const {
|
| return value.IsString();
|
| @@ -470,8 +444,7 @@ class DartStringParameter : public MethodParameter {
|
| class DartListParameter : public MethodParameter {
|
| public:
|
| DartListParameter(const char* name, bool required)
|
| - : MethodParameter(name, required) {
|
| - }
|
| + : MethodParameter(name, required) {}
|
|
|
| virtual bool ValidateObject(const Object& value) const {
|
| return value.IsArray() || value.IsGrowableObjectArray();
|
| @@ -481,13 +454,9 @@ class DartListParameter : public MethodParameter {
|
|
|
| class NoSuchParameter : public MethodParameter {
|
| public:
|
| - explicit NoSuchParameter(const char* name)
|
| - : MethodParameter(name, false) {
|
| - }
|
| + explicit NoSuchParameter(const char* name) : MethodParameter(name, false) {}
|
|
|
| - virtual bool Validate(const char* value) const {
|
| - return (value == NULL);
|
| - }
|
| + virtual bool Validate(const char* value) const { return (value == NULL); }
|
|
|
| virtual bool ValidateObject(const Object& value) const {
|
| return value.IsNull();
|
| @@ -498,8 +467,7 @@ class NoSuchParameter : public MethodParameter {
|
| class BoolParameter : public MethodParameter {
|
| public:
|
| BoolParameter(const char* name, bool required)
|
| - : MethodParameter(name, required) {
|
| - }
|
| + : MethodParameter(name, required) {}
|
|
|
| virtual bool Validate(const char* value) const {
|
| if (value == NULL) {
|
| @@ -520,8 +488,7 @@ class BoolParameter : public MethodParameter {
|
| class UIntParameter : public MethodParameter {
|
| public:
|
| UIntParameter(const char* name, bool required)
|
| - : MethodParameter(name, required) {
|
| - }
|
| + : MethodParameter(name, required) {}
|
|
|
| virtual bool Validate(const char* value) const {
|
| if (value == NULL) {
|
| @@ -550,8 +517,7 @@ class UIntParameter : public MethodParameter {
|
| class Int64Parameter : public MethodParameter {
|
| public:
|
| Int64Parameter(const char* name, bool required)
|
| - : MethodParameter(name, required) {
|
| - }
|
| + : MethodParameter(name, required) {}
|
|
|
| virtual bool Validate(const char* value) const {
|
| if (value == NULL) {
|
| @@ -580,20 +546,16 @@ class Int64Parameter : public MethodParameter {
|
| class IdParameter : public MethodParameter {
|
| public:
|
| IdParameter(const char* name, bool required)
|
| - : MethodParameter(name, required) {
|
| - }
|
| + : MethodParameter(name, required) {}
|
|
|
| - virtual bool Validate(const char* value) const {
|
| - return (value != NULL);
|
| - }
|
| + virtual bool Validate(const char* value) const { return (value != NULL); }
|
| };
|
|
|
|
|
| class RunnableIsolateParameter : public MethodParameter {
|
| public:
|
| explicit RunnableIsolateParameter(const char* name)
|
| - : MethodParameter(name, true) {
|
| - }
|
| + : MethodParameter(name, true) {}
|
|
|
| virtual bool Validate(const char* value) const {
|
| Isolate* isolate = Isolate::Current();
|
| @@ -616,9 +578,7 @@ class RunnableIsolateParameter : public MethodParameter {
|
| class EnumParameter : public MethodParameter {
|
| public:
|
| EnumParameter(const char* name, bool required, const char* const* enums)
|
| - : MethodParameter(name, required),
|
| - enums_(enums) {
|
| - }
|
| + : MethodParameter(name, required), enums_(enums) {}
|
|
|
| virtual bool Validate(const char* value) const {
|
| if (value == NULL) {
|
| @@ -639,7 +599,7 @@ class EnumParameter : public MethodParameter {
|
|
|
| // 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>
|
| +template <typename T>
|
| T EnumMapper(const char* value, const char* const* enums, T* values) {
|
| ASSERT(value != NULL);
|
| intptr_t i = 0;
|
| @@ -656,9 +616,7 @@ T EnumMapper(const char* value, const char* const* enums, T* values) {
|
| class EnumListParameter : public MethodParameter {
|
| public:
|
| EnumListParameter(const char* name, bool required, const char* const* enums)
|
| - : MethodParameter(name, required),
|
| - enums_(enums) {
|
| - }
|
| + : MethodParameter(name, required), enums_(enums) {}
|
|
|
| virtual bool Validate(const char* value) const {
|
| return ElementCount(value) >= 0;
|
| @@ -695,8 +653,7 @@ class EnumListParameter : public MethodParameter {
|
| private:
|
| // For now observatory enums are ascii letters plus underscore.
|
| static bool IsEnumChar(char c) {
|
| - return (((c >= 'a') && (c <= 'z')) ||
|
| - ((c >= 'A') && (c <= 'Z')) ||
|
| + return (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
|
| (c == '_'));
|
| }
|
|
|
| @@ -777,13 +734,13 @@ typedef bool (*ServiceMethodEntry)(Thread* thread, JSONStream* js);
|
| struct ServiceMethodDescriptor {
|
| const char* name;
|
| const ServiceMethodEntry entry;
|
| - const MethodParameter* const * parameters;
|
| + const MethodParameter* const* parameters;
|
| };
|
|
|
|
|
| // TODO(johnmccutchan): Do we reject unexpected parameters?
|
| static bool ValidateParameters(const MethodParameter* const* parameters,
|
| - JSONStream* js) {
|
| + JSONStream* js) {
|
| if (parameters == NULL) {
|
| return true;
|
| }
|
| @@ -835,11 +792,10 @@ void Service::PostError(const String& method_name,
|
| StackZone zone(T);
|
| HANDLESCOPE(T);
|
| JSONStream js;
|
| - js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(),
|
| - id, method_name, parameter_keys, parameter_values);
|
| - js.PrintError(kExtensionError,
|
| - "Error in extension `%s`: %s",
|
| - js.method(), error.ToErrorCString());
|
| + js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(), id, method_name,
|
| + parameter_keys, parameter_values);
|
| + js.PrintError(kExtensionError, "Error in extension `%s`: %s", js.method(),
|
| + error.ToErrorCString());
|
| js.PostReply();
|
| }
|
|
|
| @@ -880,12 +836,8 @@ void Service::InvokeMethod(Isolate* I,
|
| }
|
|
|
| JSONStream js;
|
| - js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(),
|
| - seq,
|
| - method_name,
|
| - param_keys,
|
| - param_values,
|
| - parameters_are_dart_objects);
|
| + js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(), seq, method_name,
|
| + param_keys, param_values, parameters_are_dart_objects);
|
|
|
| // RPC came in with a custom service id zone.
|
| const char* id_zone_param = js.LookupParam("_idZone");
|
| @@ -938,15 +890,11 @@ void Service::InvokeMethod(Isolate* I,
|
| return;
|
| }
|
|
|
| - const Instance& extension_handler = Instance::Handle(Z,
|
| - I->LookupServiceExtensionHandler(method_name));
|
| + const Instance& extension_handler =
|
| + Instance::Handle(Z, I->LookupServiceExtensionHandler(method_name));
|
| if (!extension_handler.IsNull()) {
|
| - ScheduleExtensionHandler(extension_handler,
|
| - method_name,
|
| - param_keys,
|
| - param_values,
|
| - reply_port,
|
| - seq);
|
| + ScheduleExtensionHandler(extension_handler, method_name, param_keys,
|
| + param_values, reply_port, seq);
|
| // Schedule was successful. Extension code will post a reply
|
| // asynchronously.
|
| return;
|
| @@ -995,9 +943,10 @@ void Service::SendEvent(const char* stream_id,
|
| ASSERT(!ServiceIsolate::IsServiceIsolateDescendant(isolate));
|
|
|
| if (FLAG_trace_service) {
|
| - OS::Print("vm-service: Pushing ServiceEvent(isolate='%s', kind='%s',"
|
| - " len=%" Pd ") to stream %s\n",
|
| - isolate->name(), event_type, bytes_length, stream_id);
|
| + OS::Print(
|
| + "vm-service: Pushing ServiceEvent(isolate='%s', kind='%s',"
|
| + " len=%" Pd ") to stream %s\n",
|
| + isolate->name(), event_type, bytes_length, stream_id);
|
| }
|
|
|
| bool result;
|
| @@ -1066,26 +1015,30 @@ void Service::SendEventWithData(const char* stream_id,
|
|
|
| static void ReportPauseOnConsole(ServiceEvent* event) {
|
| const char* name = event->isolate()->debugger_name();
|
| - switch (event->kind()) {
|
| + switch (event->kind()) {
|
| case ServiceEvent::kPauseStart:
|
| OS::PrintErr(
|
| "vm-service: isolate '%s' has no debugger attached and is paused at "
|
| - "start.", name);
|
| + "start.",
|
| + name);
|
| break;
|
| case ServiceEvent::kPauseExit:
|
| OS::PrintErr(
|
| "vm-service: isolate '%s' has no debugger attached and is paused at "
|
| - "exit.", name);
|
| + "exit.",
|
| + name);
|
| break;
|
| case ServiceEvent::kPauseException:
|
| OS::PrintErr(
|
| "vm-service: isolate '%s' has no debugger attached and is paused due "
|
| - "to exception.", name);
|
| + "to exception.",
|
| + name);
|
| break;
|
| case ServiceEvent::kPauseInterrupted:
|
| OS::PrintErr(
|
| "vm-service: isolate '%s' has no debugger attached and is paused due "
|
| - "to interrupt.", name);
|
| + "to interrupt.",
|
| + name);
|
| break;
|
| case ServiceEvent::kPauseBreakpoint:
|
| OS::PrintErr(
|
| @@ -1095,7 +1048,8 @@ static void ReportPauseOnConsole(ServiceEvent* event) {
|
| case ServiceEvent::kPausePostRequest:
|
| OS::PrintErr(
|
| "vm-service: isolate '%s' has no debugger attached and is paused "
|
| - "post reload.", name);
|
| + "post reload.",
|
| + name);
|
| break;
|
| default:
|
| UNREACHABLE();
|
| @@ -1117,10 +1071,8 @@ 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()) {
|
| + if (event->stream_info() != NULL && !event->stream_info()->enabled()) {
|
| + if (FLAG_warn_on_pause_with_no_debugger && event->IsPause()) {
|
| // If we are about to pause a running program which has no
|
| // debugger connected, tell the user about it.
|
| ReportPauseOnConsole(event);
|
| @@ -1180,9 +1132,10 @@ void Service::PostEvent(Isolate* isolate,
|
| if (isolate != NULL) {
|
| isolate_name = isolate->name();
|
| }
|
| - OS::Print("vm-service: Pushing ServiceEvent(isolate='%s', kind='%s') "
|
| - "to stream %s\n",
|
| - isolate_name, kind, stream_id);
|
| + OS::Print(
|
| + "vm-service: Pushing ServiceEvent(isolate='%s', kind='%s') "
|
| + "to stream %s\n",
|
| + isolate_name, kind, stream_id);
|
| }
|
|
|
| Dart_PostCObject(ServiceIsolate::Port(), &list_cobj);
|
| @@ -1191,17 +1144,13 @@ void Service::PostEvent(Isolate* isolate,
|
|
|
| class EmbedderServiceHandler {
|
| public:
|
| - explicit EmbedderServiceHandler(const char* name) : name_(NULL),
|
| - callback_(NULL),
|
| - user_data_(NULL),
|
| - next_(NULL) {
|
| + explicit EmbedderServiceHandler(const char* name)
|
| + : name_(NULL), callback_(NULL), user_data_(NULL), next_(NULL) {
|
| ASSERT(name != NULL);
|
| name_ = strdup(name);
|
| }
|
|
|
| - ~EmbedderServiceHandler() {
|
| - free(name_);
|
| - }
|
| + ~EmbedderServiceHandler() { free(name_); }
|
|
|
| const char* name() const { return name_; }
|
|
|
| @@ -1211,14 +1160,10 @@ class EmbedderServiceHandler {
|
| }
|
|
|
| void* user_data() const { return user_data_; }
|
| - void set_user_data(void* user_data) {
|
| - user_data_ = user_data;
|
| - }
|
| + void set_user_data(void* user_data) { user_data_ = user_data; }
|
|
|
| EmbedderServiceHandler* next() const { return next_; }
|
| - void set_next(EmbedderServiceHandler* next) {
|
| - next_ = next;
|
| - }
|
| + void set_next(EmbedderServiceHandler* next) { next_ = next; }
|
|
|
| private:
|
| char* name_;
|
| @@ -1275,8 +1220,7 @@ void Service::RegisterIsolateEmbedderCallback(
|
| }
|
|
|
|
|
| -EmbedderServiceHandler* Service::FindIsolateEmbedderHandler(
|
| - const char* name) {
|
| +EmbedderServiceHandler* Service::FindIsolateEmbedderHandler(const char* name) {
|
| EmbedderServiceHandler* current = isolate_service_handler_head_;
|
| while (current != NULL) {
|
| if (strcmp(name, current->name()) == 0) {
|
| @@ -1288,10 +1232,9 @@ EmbedderServiceHandler* Service::FindIsolateEmbedderHandler(
|
| }
|
|
|
|
|
| -void Service::RegisterRootEmbedderCallback(
|
| - const char* name,
|
| - Dart_ServiceRequestCallback callback,
|
| - void* user_data) {
|
| +void Service::RegisterRootEmbedderCallback(const char* name,
|
| + Dart_ServiceRequestCallback callback,
|
| + void* user_data) {
|
| if (name == NULL) {
|
| return;
|
| }
|
| @@ -1327,8 +1270,7 @@ void Service::SetGetServiceAssetsCallback(
|
| }
|
|
|
|
|
| -EmbedderServiceHandler* Service::FindRootEmbedderHandler(
|
| - const char* name) {
|
| +EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) {
|
| EmbedderServiceHandler* current = root_service_handler_head_;
|
| while (current != NULL) {
|
| if (strcmp(name, current->name()) == 0) {
|
| @@ -1353,18 +1295,13 @@ void Service::ScheduleExtensionHandler(const Instance& handler,
|
| ASSERT(!reply_port.IsNull());
|
| Isolate* isolate = Isolate::Current();
|
| ASSERT(isolate != NULL);
|
| - isolate->AppendServiceExtensionCall(handler,
|
| - method_name,
|
| - parameter_keys,
|
| - parameter_values,
|
| - reply_port,
|
| - id);
|
| + isolate->AppendServiceExtensionCall(handler, method_name, parameter_keys,
|
| + parameter_values, reply_port, id);
|
| }
|
|
|
|
|
| static const MethodParameter* get_isolate_params[] = {
|
| - ISOLATE_PARAMETER,
|
| - NULL,
|
| + ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -1375,9 +1312,7 @@ static bool GetIsolate(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_stack_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new BoolParameter("_full", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new BoolParameter("_full", false), NULL,
|
| };
|
|
|
|
|
| @@ -1447,9 +1382,8 @@ void Service::SendEchoEvent(Isolate* isolate, const char* text) {
|
| }
|
| }
|
| uint8_t data[] = {0, 128, 255};
|
| - SendEventWithData(echo_stream.id(), "_Echo",
|
| - js.buffer()->buf(), js.buffer()->length(),
|
| - data, sizeof(data));
|
| + SendEventWithData(echo_stream.id(), "_Echo", js.buffer()->buf(),
|
| + js.buffer()->length(), data, sizeof(data));
|
| }
|
|
|
|
|
| @@ -1517,13 +1451,12 @@ static RawObject* LookupObjectId(Thread* thread,
|
| if (strncmp(arg, "int-", 4) == 0) {
|
| arg += 4;
|
| int64_t value = 0;
|
| - if (!OS::StringToInt64(arg, &value) ||
|
| - !Smi::IsValid(value)) {
|
| + if (!OS::StringToInt64(arg, &value) || !Smi::IsValid(value)) {
|
| *kind = ObjectIdRing::kInvalid;
|
| return Object::null();
|
| }
|
| - const Integer& obj = Integer::Handle(thread->zone(),
|
| - Smi::New(static_cast<intptr_t>(value)));
|
| + const Integer& obj =
|
| + Integer::Handle(thread->zone(), Smi::New(static_cast<intptr_t>(value)));
|
| return obj.raw();
|
| } else if (strcmp(arg, "bool-true") == 0) {
|
| return Bool::True().raw();
|
| @@ -1545,7 +1478,8 @@ static RawObject* LookupObjectId(Thread* thread,
|
|
|
|
|
| static RawObject* LookupHeapObjectLibraries(Isolate* isolate,
|
| - char** parts, int num_parts) {
|
| + char** parts,
|
| + int num_parts) {
|
| // Library ids look like "libraries/35"
|
| if (num_parts < 2) {
|
| return Object::sentinel().raw();
|
| @@ -1603,7 +1537,8 @@ static RawObject* LookupHeapObjectLibraries(Isolate* isolate,
|
| }
|
|
|
| static RawObject* LookupHeapObjectClasses(Thread* thread,
|
| - char** parts, int num_parts) {
|
| + char** parts,
|
| + int num_parts) {
|
| // Class ids look like: "classes/17"
|
| if (num_parts < 2) {
|
| return Object::sentinel().raw();
|
| @@ -1612,8 +1547,7 @@ static RawObject* LookupHeapObjectClasses(Thread* thread,
|
| Zone* zone = thread->zone();
|
| ClassTable* table = isolate->class_table();
|
| intptr_t id;
|
| - if (!GetIntegerId(parts[1], &id) ||
|
| - !table->IsValidIndex(id)) {
|
| + if (!GetIntegerId(parts[1], &id) || !table->IsValidIndex(id)) {
|
| return Object::sentinel().raw();
|
| }
|
| Class& cls = Class::Handle(zone, table->At(id));
|
| @@ -1726,7 +1660,8 @@ static RawObject* LookupHeapObjectClasses(Thread* thread,
|
|
|
|
|
| static RawObject* LookupHeapObjectTypeArguments(Thread* thread,
|
| - char** parts, int num_parts) {
|
| + char** parts,
|
| + int num_parts) {
|
| Isolate* isolate = thread->isolate();
|
| // TypeArguments ids look like: "typearguments/17"
|
| if (num_parts < 2) {
|
| @@ -1737,8 +1672,8 @@ static RawObject* LookupHeapObjectTypeArguments(Thread* thread,
|
| return Object::sentinel().raw();
|
| }
|
| ObjectStore* object_store = isolate->object_store();
|
| - const Array& table = Array::Handle(thread->zone(),
|
| - object_store->canonical_type_arguments());
|
| + const Array& table =
|
| + Array::Handle(thread->zone(), object_store->canonical_type_arguments());
|
| ASSERT(table.Length() > 0);
|
| const intptr_t table_size = table.Length() - 1;
|
| if ((id < 0) || (id >= table_size) || (table.At(id) == Object::null())) {
|
| @@ -1749,7 +1684,8 @@ static RawObject* LookupHeapObjectTypeArguments(Thread* thread,
|
|
|
|
|
| static RawObject* LookupHeapObjectCode(Isolate* isolate,
|
| - char** parts, int num_parts) {
|
| + char** parts,
|
| + int num_parts) {
|
| if (num_parts != 2) {
|
| return Object::sentinel().raw();
|
| }
|
| @@ -1797,7 +1733,8 @@ static RawObject* LookupHeapObjectCode(Isolate* isolate,
|
|
|
|
|
| static RawObject* LookupHeapObjectMessage(Thread* thread,
|
| - char** parts, int num_parts) {
|
| + char** parts,
|
| + int num_parts) {
|
| if (num_parts != 2) {
|
| return Object::sentinel().raw();
|
| }
|
| @@ -1812,9 +1749,7 @@ static RawObject* LookupHeapObjectMessage(Thread* thread,
|
| return Object::sentinel().raw();
|
| }
|
| if (message->len() > 0) {
|
| - MessageSnapshotReader reader(message->data(),
|
| - message->len(),
|
| - thread);
|
| + MessageSnapshotReader reader(message->data(), message->len(), thread);
|
| return reader.ReadObject();
|
| } else {
|
| return message->raw_obj();
|
| @@ -1966,8 +1901,8 @@ static bool PrintInboundReferences(Thread* thread,
|
|
|
| jselement.AddProperty("source", source);
|
| if (source.IsArray()) {
|
| - intptr_t element_index = slot_offset.Value() -
|
| - (Array::element_offset(0) >> kWordSizeLog2);
|
| + intptr_t element_index =
|
| + slot_offset.Value() - (Array::element_offset(0) >> kWordSizeLog2);
|
| jselement.AddProperty("parentListIndex", element_index);
|
| } else if (source.IsInstance()) {
|
| source_class ^= source.clazz();
|
| @@ -1996,8 +1931,7 @@ static bool PrintInboundReferences(Thread* thread,
|
|
|
|
|
| static const MethodParameter* get_inbound_references_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2067,14 +2001,14 @@ static bool PrintRetainingPath(Thread* thread,
|
| slot_offset ^= path.At((i * 2) - 1);
|
| jselement.AddProperty("offset", slot_offset.Value());
|
| if (element.IsArray() || element.IsGrowableObjectArray()) {
|
| - intptr_t element_index = slot_offset.Value() -
|
| - (Array::element_offset(0) >> kWordSizeLog2);
|
| + intptr_t element_index =
|
| + slot_offset.Value() - (Array::element_offset(0) >> kWordSizeLog2);
|
| jselement.AddProperty("parentListIndex", element_index);
|
| } else if (element.IsLinkedHashMap()) {
|
| map = static_cast<RawLinkedHashMap*>(path.At(i * 2));
|
| map_data = map.data();
|
| - intptr_t element_index = slot_offset.Value() -
|
| - (Array::element_offset(0) >> kWordSizeLog2);
|
| + intptr_t element_index =
|
| + slot_offset.Value() - (Array::element_offset(0) >> kWordSizeLog2);
|
| LinkedHashMap::Iterator iterator(map);
|
| while (iterator.MoveNext()) {
|
| if (iterator.CurrentKey() == map_data.At(element_index) ||
|
| @@ -2111,8 +2045,7 @@ static bool PrintRetainingPath(Thread* thread,
|
|
|
|
|
| static const MethodParameter* get_retaining_path_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2154,9 +2087,7 @@ static bool GetRetainingPath(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_retained_size_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new IdParameter("targetId", true),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL,
|
| };
|
|
|
|
|
| @@ -2164,8 +2095,8 @@ static bool GetRetainedSize(Thread* thread, JSONStream* js) {
|
| const char* target_id = js->LookupParam("targetId");
|
| ASSERT(target_id != NULL);
|
| ObjectIdRing::LookupResult lookup_result;
|
| - Object& obj = Object::Handle(LookupHeapObject(thread, target_id,
|
| - &lookup_result));
|
| + Object& obj =
|
| + Object::Handle(LookupHeapObject(thread, target_id, &lookup_result));
|
| if (obj.raw() == Object::sentinel().raw()) {
|
| if (lookup_result == ObjectIdRing::kCollected) {
|
| PrintSentinel(js, kCollectedSentinel);
|
| @@ -2196,9 +2127,7 @@ static bool GetRetainedSize(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_reachable_size_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new IdParameter("targetId", true),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL,
|
| };
|
|
|
|
|
| @@ -2206,8 +2135,8 @@ static bool GetReachableSize(Thread* thread, JSONStream* js) {
|
| const char* target_id = js->LookupParam("targetId");
|
| ASSERT(target_id != NULL);
|
| ObjectIdRing::LookupResult lookup_result;
|
| - Object& obj = Object::Handle(LookupHeapObject(thread, target_id,
|
| - &lookup_result));
|
| + Object& obj =
|
| + Object::Handle(LookupHeapObject(thread, target_id, &lookup_result));
|
| if (obj.raw() == Object::sentinel().raw()) {
|
| if (lookup_result == ObjectIdRing::kCollected) {
|
| PrintSentinel(js, kCollectedSentinel);
|
| @@ -2238,8 +2167,7 @@ static bool GetReachableSize(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* evaluate_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2262,8 +2190,8 @@ static bool Evaluate(Thread* thread, JSONStream* js) {
|
| Zone* zone = thread->zone();
|
| const String& expr_str = String::Handle(zone, String::New(expr));
|
| ObjectIdRing::LookupResult lookup_result;
|
| - Object& obj = Object::Handle(zone, LookupHeapObject(thread, target_id,
|
| - &lookup_result));
|
| + Object& obj =
|
| + Object::Handle(zone, LookupHeapObject(thread, target_id, &lookup_result));
|
| if (obj.raw() == Object::sentinel().raw()) {
|
| if (lookup_result == ObjectIdRing::kCollected) {
|
| PrintSentinel(js, kCollectedSentinel);
|
| @@ -2276,44 +2204,42 @@ static bool Evaluate(Thread* thread, JSONStream* js) {
|
| }
|
| if (obj.IsLibrary()) {
|
| const Library& lib = Library::Cast(obj);
|
| - const Object& result = Object::Handle(zone,
|
| + const Object& result = Object::Handle(
|
| + zone,
|
| lib.Evaluate(expr_str, Array::empty_array(), Array::empty_array()));
|
| result.PrintJSON(js, true);
|
| return true;
|
| }
|
| if (obj.IsClass()) {
|
| const Class& cls = Class::Cast(obj);
|
| - const Object& result = Object::Handle(zone,
|
| + const Object& result = Object::Handle(
|
| + zone,
|
| cls.Evaluate(expr_str, Array::empty_array(), Array::empty_array()));
|
| result.PrintJSON(js, true);
|
| return true;
|
| }
|
| - if ((obj.IsInstance() || obj.IsNull()) &&
|
| - !ContainsNonInstance(obj)) {
|
| + if ((obj.IsInstance() || obj.IsNull()) && !ContainsNonInstance(obj)) {
|
| // We don't use Instance::Cast here because it doesn't allow null.
|
| Instance& instance = Instance::Handle(zone);
|
| instance ^= obj.raw();
|
| const Class& receiver_cls = Class::Handle(zone, instance.clazz());
|
| - const Object& result =
|
| - Object::Handle(zone, instance.Evaluate(receiver_cls,
|
| - expr_str,
|
| - Array::empty_array(),
|
| - Array::empty_array()));
|
| + const Object& result = Object::Handle(
|
| + zone, instance.Evaluate(receiver_cls, expr_str, Array::empty_array(),
|
| + Array::empty_array()));
|
| result.PrintJSON(js, true);
|
| return true;
|
| }
|
| js->PrintError(kInvalidParams,
|
| "%s: invalid 'targetId' parameter: "
|
| - "Cannot evaluate against a VM-internal object", js->method());
|
| + "Cannot evaluate against a VM-internal object",
|
| + js->method());
|
| return true;
|
| }
|
|
|
|
|
| static const MethodParameter* evaluate_in_frame_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new UIntParameter("frameIndex", true),
|
| - new MethodParameter("expression", true),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("frameIndex", true),
|
| + new MethodParameter("expression", true), NULL,
|
| };
|
|
|
|
|
| @@ -2375,8 +2301,7 @@ class GetInstancesVisitor : public ObjectGraph::Visitor {
|
|
|
|
|
| static const MethodParameter* get_instances_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2396,10 +2321,8 @@ static bool GetInstances(Thread* thread, JSONStream* js) {
|
| PrintInvalidParamError(js, "limit");
|
| return true;
|
| }
|
| - const Object& obj =
|
| - Object::Handle(LookupHeapObject(thread, target_id, NULL));
|
| - if (obj.raw() == Object::sentinel().raw() ||
|
| - !obj.IsClass()) {
|
| + const Object& obj = Object::Handle(LookupHeapObject(thread, target_id, NULL));
|
| + if (obj.raw() == Object::sentinel().raw() || !obj.IsClass()) {
|
| PrintInvalidParamError(js, "classId");
|
| return true;
|
| }
|
| @@ -2432,28 +2355,29 @@ static bool GetInstances(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const char* const report_enum_names[] = {
|
| - SourceReport::kCallSitesStr,
|
| - SourceReport::kCoverageStr,
|
| - SourceReport::kPossibleBreakpointsStr,
|
| - SourceReport::kProfileStr,
|
| - NULL,
|
| + SourceReport::kCallSitesStr,
|
| + SourceReport::kCoverageStr,
|
| + SourceReport::kPossibleBreakpointsStr,
|
| + SourceReport::kProfileStr,
|
| + NULL,
|
| };
|
|
|
|
|
| static const MethodParameter* get_source_report_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new EnumListParameter("reports", true, report_enum_names),
|
| - new IdParameter("scriptId", false),
|
| - new UIntParameter("tokenPos", false),
|
| - new UIntParameter("endTokenPos", false),
|
| - new BoolParameter("forceCompile", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER,
|
| + new EnumListParameter("reports", true, report_enum_names),
|
| + new IdParameter("scriptId", false),
|
| + new UIntParameter("tokenPos", false),
|
| + new UIntParameter("endTokenPos", false),
|
| + new BoolParameter("forceCompile", false),
|
| + NULL,
|
| };
|
|
|
|
|
| static bool GetSourceReport(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| - js->PrintError(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot get source report when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -2511,19 +2435,15 @@ static bool GetSourceReport(Thread* thread, JSONStream* js) {
|
| }
|
| }
|
| SourceReport report(report_set, compile_mode);
|
| - report.PrintJSON(js,
|
| - script,
|
| - TokenPosition(start_pos),
|
| + report.PrintJSON(js, script, TokenPosition(start_pos),
|
| TokenPosition(end_pos));
|
| return true;
|
| }
|
|
|
|
|
| static const MethodParameter* reload_sources_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new BoolParameter("force", false),
|
| - new BoolParameter("pause", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new BoolParameter("force", false),
|
| + new BoolParameter("pause", false), NULL,
|
| };
|
|
|
|
|
| @@ -2531,12 +2451,12 @@ static bool ReloadSources(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| if (!isolate->compilation_allowed()) {
|
| js->PrintError(kFeatureDisabled,
|
| - "Cannot reload source when running a precompiled program.");
|
| + "Cannot reload source when running a precompiled program.");
|
| return true;
|
| }
|
| if (Dart::snapshot_kind() == Snapshot::kAppWithJIT) {
|
| js->PrintError(kFeatureDisabled,
|
| - "Cannot reload source when running an app snapshot.");
|
| + "Cannot reload source when running an app snapshot.");
|
| return true;
|
| }
|
| Dart_LibraryTagHandler handler = isolate->library_tag_handler();
|
| @@ -2553,8 +2473,7 @@ static bool ReloadSources(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
| if (isolate->IsReloading()) {
|
| - js->PrintError(kIsolateIsReloading,
|
| - "This isolate is being reloaded.");
|
| + js->PrintError(kIsolateIsReloading, "This isolate is being reloaded.");
|
| return true;
|
| }
|
| if (!isolate->CanReload()) {
|
| @@ -2595,7 +2514,8 @@ static bool AddBreakpointCommon(Thread* thread,
|
| JSONStream* js,
|
| const String& script_uri) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| - js->PrintError(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot use breakpoints when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -2613,12 +2533,12 @@ static bool AddBreakpointCommon(Thread* thread,
|
| }
|
| ASSERT(!script_uri.IsNull());
|
| Breakpoint* bpt = NULL;
|
| - bpt = thread->isolate()->debugger()->
|
| - SetBreakpointAtLineCol(script_uri, line, col);
|
| + bpt = thread->isolate()->debugger()->SetBreakpointAtLineCol(script_uri, line,
|
| + col);
|
| if (bpt == NULL) {
|
| js->PrintError(kCannotAddBreakpoint,
|
| - "%s: Cannot add breakpoint at line '%s'",
|
| - js->method(), line_param);
|
| + "%s: Cannot add breakpoint at line '%s'", js->method(),
|
| + line_param);
|
| return true;
|
| }
|
| bpt->PrintJSON(js);
|
| @@ -2627,17 +2547,18 @@ static bool AddBreakpointCommon(Thread* thread,
|
|
|
|
|
| static const MethodParameter* add_breakpoint_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new IdParameter("scriptId", true),
|
| - new UIntParameter("line", true),
|
| - new UIntParameter("column", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER,
|
| + new IdParameter("scriptId", true),
|
| + new UIntParameter("line", true),
|
| + new UIntParameter("column", false),
|
| + NULL,
|
| };
|
|
|
|
|
| static bool AddBreakpoint(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| - js->PrintError(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot use breakpoints when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -2655,17 +2576,18 @@ static bool AddBreakpoint(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* add_breakpoint_with_script_uri_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new IdParameter("scriptUri", true),
|
| - new UIntParameter("line", true),
|
| - new UIntParameter("column", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER,
|
| + new IdParameter("scriptUri", true),
|
| + new UIntParameter("line", true),
|
| + new UIntParameter("column", false),
|
| + NULL,
|
| };
|
|
|
|
|
| static bool AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| - js->PrintError(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot use breakpoints when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -2676,15 +2598,14 @@ static bool AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* add_breakpoint_at_entry_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new IdParameter("functionId", true),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new IdParameter("functionId", true), NULL,
|
| };
|
|
|
|
|
| static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| - js->PrintError(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot use breakpoints when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -2699,8 +2620,8 @@ static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) {
|
| thread->isolate()->debugger()->SetBreakpointAtEntry(function, false);
|
| if (bpt == NULL) {
|
| js->PrintError(kCannotAddBreakpoint,
|
| - "%s: Cannot add breakpoint at function '%s'",
|
| - js->method(), function.ToCString());
|
| + "%s: Cannot add breakpoint at function '%s'", js->method(),
|
| + function.ToCString());
|
| return true;
|
| }
|
| bpt->PrintJSON(js);
|
| @@ -2709,15 +2630,14 @@ static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* add_breakpoint_at_activation_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new IdParameter("objectId", true),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new IdParameter("objectId", true), NULL,
|
| };
|
|
|
|
|
| static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| - js->PrintError(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot use breakpoints when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -2732,8 +2652,7 @@ static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) {
|
| thread->isolate()->debugger()->SetBreakpointAtActivation(closure, false);
|
| if (bpt == NULL) {
|
| js->PrintError(kCannotAddBreakpoint,
|
| - "%s: Cannot add breakpoint at activation",
|
| - js->method());
|
| + "%s: Cannot add breakpoint at activation", js->method());
|
| return true;
|
| }
|
| bpt->PrintJSON(js);
|
| @@ -2742,14 +2661,14 @@ static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* remove_breakpoint_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| static bool RemoveBreakpoint(Thread* thread, JSONStream* js) {
|
| if (!thread->isolate()->compilation_allowed()) {
|
| - js->PrintError(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot use breakpoints when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -2775,11 +2694,9 @@ static bool RemoveBreakpoint(Thread* thread, JSONStream* js) {
|
|
|
| static RawClass* GetMetricsClass(Thread* thread) {
|
| Zone* zone = thread->zone();
|
| - const Library& prof_lib =
|
| - Library::Handle(zone, Library::DeveloperLibrary());
|
| + const Library& prof_lib = Library::Handle(zone, Library::DeveloperLibrary());
|
| ASSERT(!prof_lib.IsNull());
|
| - const String& metrics_cls_name =
|
| - String::Handle(zone, String::New("Metrics"));
|
| + const String& metrics_cls_name = String::Handle(zone, String::New("Metrics"));
|
| ASSERT(!metrics_cls_name.IsNull());
|
| const Class& metrics_cls =
|
| Class::Handle(zone, prof_lib.LookupClass(metrics_cls_name));
|
| @@ -2788,7 +2705,6 @@ static RawClass* GetMetricsClass(Thread* thread) {
|
| }
|
|
|
|
|
| -
|
| static bool HandleNativeMetricsList(Thread* thread, JSONStream* js) {
|
| JSONObject obj(js);
|
| obj.AddProperty("type", "MetricList");
|
| @@ -2822,14 +2738,12 @@ static bool HandleNativeMetric(Thread* thread, JSONStream* js, const char* id) {
|
|
|
| static bool HandleDartMetricsList(Thread* thread, JSONStream* js) {
|
| Zone* zone = thread->zone();
|
| - const Class& metrics_cls =
|
| - Class::Handle(zone, GetMetricsClass(thread));
|
| + const Class& metrics_cls = Class::Handle(zone, GetMetricsClass(thread));
|
| const String& print_metrics_name =
|
| String::Handle(String::New("_printMetrics"));
|
| ASSERT(!print_metrics_name.IsNull());
|
| const Function& print_metrics = Function::Handle(
|
| - zone,
|
| - metrics_cls.LookupStaticFunctionAllowPrivate(print_metrics_name));
|
| + zone, metrics_cls.LookupStaticFunctionAllowPrivate(print_metrics_name));
|
| ASSERT(!print_metrics.IsNull());
|
| const Array& args = Object::empty_array();
|
| const Object& result =
|
| @@ -2844,14 +2758,11 @@ static bool HandleDartMetricsList(Thread* thread, JSONStream* js) {
|
|
|
| static bool HandleDartMetric(Thread* thread, JSONStream* js, const char* id) {
|
| Zone* zone = thread->zone();
|
| - const Class& metrics_cls =
|
| - Class::Handle(zone, GetMetricsClass(thread));
|
| - const String& print_metric_name =
|
| - String::Handle(String::New("_printMetric"));
|
| + const Class& metrics_cls = Class::Handle(zone, GetMetricsClass(thread));
|
| + const String& print_metric_name = String::Handle(String::New("_printMetric"));
|
| ASSERT(!print_metric_name.IsNull());
|
| const Function& print_metric = Function::Handle(
|
| - zone,
|
| - metrics_cls.LookupStaticFunctionAllowPrivate(print_metric_name));
|
| + zone, metrics_cls.LookupStaticFunctionAllowPrivate(print_metric_name));
|
| ASSERT(!print_metric.IsNull());
|
| const String& arg0 = String::Handle(String::New(id));
|
| ASSERT(!arg0.IsNull());
|
| @@ -2872,8 +2783,7 @@ static bool HandleDartMetric(Thread* thread, JSONStream* js, const char* id) {
|
|
|
|
|
| static const MethodParameter* get_isolate_metric_list_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2900,8 +2810,7 @@ static bool GetIsolateMetricList(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_isolate_metric_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2933,8 +2842,7 @@ static bool GetIsolateMetric(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_vm_metric_list_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2944,8 +2852,7 @@ static bool GetVMMetricList(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_vm_metric_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -2958,20 +2865,17 @@ static bool GetVMMetric(Thread* thread, JSONStream* js) {
|
| }
|
|
|
| static const char* const timeline_streams_enum_names[] = {
|
| - "all",
|
| -#define DEFINE_NAME(name, unused) \
|
| - #name,
|
| -TIMELINE_STREAM_LIST(DEFINE_NAME)
|
| + "all",
|
| +#define DEFINE_NAME(name, unused) #name,
|
| + TIMELINE_STREAM_LIST(DEFINE_NAME)
|
| #undef DEFINE_NAME
|
| - NULL
|
| -};
|
| + NULL};
|
|
|
| static const MethodParameter* set_vm_timeline_flags_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - new EnumListParameter("recordedStreams",
|
| - false,
|
| - timeline_streams_enum_names),
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, new EnumListParameter("recordedStreams",
|
| + false,
|
| + timeline_streams_enum_names),
|
| + NULL,
|
| };
|
|
|
|
|
| @@ -3005,7 +2909,7 @@ static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
|
|
| #define SET_ENABLE_STREAM(name, unused) \
|
| Timeline::SetStream##name##Enabled(HasStream(recorded_streams, #name));
|
| -TIMELINE_STREAM_LIST(SET_ENABLE_STREAM);
|
| + TIMELINE_STREAM_LIST(SET_ENABLE_STREAM);
|
| #undef SET_ENABLE_STREAM
|
|
|
| PrintSuccess(js);
|
| @@ -3015,8 +2919,7 @@ TIMELINE_STREAM_LIST(SET_ENABLE_STREAM);
|
|
|
|
|
| static const MethodParameter* get_vm_timeline_flags_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3035,8 +2938,7 @@ static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* clear_vm_timeline_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3054,10 +2956,8 @@ static bool ClearVMTimeline(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_vm_timeline_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - new Int64Parameter("timeOriginMicros", false),
|
| - new Int64Parameter("timeExtentMicros", false),
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, new Int64Parameter("timeOriginMicros", false),
|
| + new Int64Parameter("timeExtentMicros", false), NULL,
|
| };
|
|
|
|
|
| @@ -3080,8 +2980,7 @@ static bool GetVMTimeline(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* resume_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3150,8 +3049,7 @@ static bool Resume(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* pause_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3169,8 +3067,7 @@ static bool Pause(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_tag_profile_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3183,32 +3080,24 @@ static bool GetTagProfile(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const char* const tags_enum_names[] = {
|
| - "None",
|
| - "UserVM",
|
| - "UserOnly",
|
| - "VMUser",
|
| - "VMOnly",
|
| - NULL,
|
| + "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.
|
| + 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),
|
| - new BoolParameter("_codeTransitionTags", false),
|
| - new Int64Parameter("timeOriginMicros", false),
|
| - new Int64Parameter("timeExtentMicros", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER,
|
| + new EnumParameter("tags", true, tags_enum_names),
|
| + new BoolParameter("_codeTransitionTags", false),
|
| + new Int64Parameter("timeOriginMicros", false),
|
| + new Int64Parameter("timeExtentMicros", false),
|
| + NULL,
|
| };
|
|
|
|
|
| @@ -3224,21 +3113,18 @@ static bool GetCpuProfile(Thread* thread, JSONStream* js) {
|
| Int64Parameter::Parse(js->LookupParam("timeOriginMicros"));
|
| int64_t time_extent_micros =
|
| Int64Parameter::Parse(js->LookupParam("timeExtentMicros"));
|
| - ProfilerService::PrintJSON(js,
|
| - tag_order,
|
| - extra_tags,
|
| - time_origin_micros,
|
| + ProfilerService::PrintJSON(js, tag_order, extra_tags, time_origin_micros,
|
| time_extent_micros);
|
| return true;
|
| }
|
|
|
|
|
| static const MethodParameter* get_cpu_profile_timeline_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new EnumParameter("tags", true, tags_enum_names),
|
| - new Int64Parameter("timeOriginMicros", false),
|
| - new Int64Parameter("timeExtentMicros", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER,
|
| + new EnumParameter("tags", true, tags_enum_names),
|
| + new Int64Parameter("timeOriginMicros", false),
|
| + new Int64Parameter("timeExtentMicros", false),
|
| + NULL,
|
| };
|
|
|
|
|
| @@ -3249,21 +3135,19 @@ static bool GetCpuProfileTimeline(Thread* thread, JSONStream* js) {
|
| UIntParameter::Parse(js->LookupParam("timeOriginMicros"));
|
| int64_t time_extent_micros =
|
| UIntParameter::Parse(js->LookupParam("timeExtentMicros"));
|
| - ProfilerService::PrintTimelineJSON(js,
|
| - tag_order,
|
| - time_origin_micros,
|
| + ProfilerService::PrintTimelineJSON(js, tag_order, time_origin_micros,
|
| time_extent_micros);
|
| return true;
|
| }
|
|
|
|
|
| static const MethodParameter* get_allocation_samples_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new EnumParameter("tags", true, tags_enum_names),
|
| - new IdParameter("classId", false),
|
| - new Int64Parameter("timeOriginMicros", false),
|
| - new Int64Parameter("timeExtentMicros", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER,
|
| + new EnumParameter("tags", true, tags_enum_names),
|
| + new IdParameter("classId", false),
|
| + new Int64Parameter("timeOriginMicros", false),
|
| + new Int64Parameter("timeExtentMicros", false),
|
| + NULL,
|
| };
|
|
|
|
|
| @@ -3280,10 +3164,7 @@ static bool GetAllocationSamples(Thread* thread, JSONStream* js) {
|
| Isolate* isolate = thread->isolate();
|
| if (IsValidClassId(isolate, cid)) {
|
| const Class& cls = Class::Handle(GetClassForId(isolate, cid));
|
| - ProfilerService::PrintAllocationJSON(js,
|
| - tag_order,
|
| - cls,
|
| - time_origin_micros,
|
| + ProfilerService::PrintAllocationJSON(js, tag_order, cls, time_origin_micros,
|
| time_extent_micros);
|
| } else {
|
| PrintInvalidParamError(js, "classId");
|
| @@ -3293,8 +3174,7 @@ static bool GetAllocationSamples(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* clear_cpu_profile_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3306,8 +3186,7 @@ static bool ClearCpuProfile(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_allocation_profile_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3345,8 +3224,7 @@ static bool GetAllocationProfile(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_heap_map_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3358,9 +3236,8 @@ static bool GetHeapMap(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* request_heap_snapshot_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new BoolParameter("collectGarbage", false /* not required */),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER,
|
| + new BoolParameter("collectGarbage", false /* not required */), NULL,
|
| };
|
|
|
|
|
| @@ -3413,12 +3290,11 @@ void Service::SendGraphEvent(Thread* thread, bool collect_garbage) {
|
|
|
| uint8_t* chunk_start = buffer + (i * kChunkSize);
|
| intptr_t chunk_size = (i + 1 == num_chunks)
|
| - ? stream.bytes_written() - (i * kChunkSize)
|
| - : kChunkSize;
|
| + ? stream.bytes_written() - (i * kChunkSize)
|
| + : kChunkSize;
|
|
|
| - SendEventWithData(graph_stream.id(), "_Graph",
|
| - js.buffer()->buf(), js.buffer()->length(),
|
| - chunk_start, chunk_size);
|
| + SendEventWithData(graph_stream.id(), "_Graph", js.buffer()->buf(),
|
| + js.buffer()->length(), chunk_start, chunk_size);
|
| }
|
| }
|
|
|
| @@ -3493,8 +3369,8 @@ void Service::SendExtensionEvent(Isolate* isolate,
|
|
|
| class ContainsAddressVisitor : public FindObjectVisitor {
|
| public:
|
| - explicit ContainsAddressVisitor(uword addr) : addr_(addr) { }
|
| - virtual ~ContainsAddressVisitor() { }
|
| + explicit ContainsAddressVisitor(uword addr) : addr_(addr) {}
|
| + virtual ~ContainsAddressVisitor() {}
|
|
|
| virtual uword filter_addr() const { return addr_; }
|
|
|
| @@ -3506,14 +3382,14 @@ class ContainsAddressVisitor : public FindObjectVisitor {
|
| uword obj_end = obj_begin + obj->Size();
|
| return obj_begin <= addr_ && addr_ < obj_end;
|
| }
|
| +
|
| private:
|
| uword addr_;
|
| };
|
|
|
|
|
| static const MethodParameter* get_object_by_address_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3555,8 +3431,8 @@ static bool GetObjectByAddress(Thread* thread, JSONStream* js) {
|
| return true;
|
| }
|
| bool ref = js->HasParam("ref") && js->ParamIs("ref", "true");
|
| - const Object& obj = Object::Handle(thread->zone(),
|
| - GetObjectHelper(thread, addr));
|
| + const Object& obj =
|
| + Object::Handle(thread->zone(), GetObjectHelper(thread, addr));
|
| if (obj.IsNull()) {
|
| PrintSentinel(js, kFreeSentinel);
|
| } else {
|
| @@ -3567,17 +3443,15 @@ static bool GetObjectByAddress(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_persistent_handles_params[] = {
|
| - ISOLATE_PARAMETER,
|
| - NULL,
|
| + ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| -template<typename T>
|
| +template <typename T>
|
| class PersistentHandleVisitor : public HandleVisitor {
|
| public:
|
| PersistentHandleVisitor(Thread* thread, JSONArray* handles)
|
| - : HandleVisitor(thread),
|
| - handles_(handles) {
|
| + : HandleVisitor(thread), handles_(handles) {
|
| ASSERT(handles_ != NULL);
|
| }
|
|
|
| @@ -3595,28 +3469,21 @@ class PersistentHandleVisitor : public HandleVisitor {
|
|
|
| JSONObject obj(handles_);
|
| obj.AddProperty("type", "_WeakPersistentHandle");
|
| - const Object& object =
|
| - Object::Handle(weak_persistent_handle->raw());
|
| + const Object& object = Object::Handle(weak_persistent_handle->raw());
|
| obj.AddProperty("object", object);
|
| + obj.AddPropertyF("peer", "0x%" Px "", reinterpret_cast<uintptr_t>(
|
| + weak_persistent_handle->peer()));
|
| obj.AddPropertyF(
|
| - "peer",
|
| - "0x%" Px "",
|
| - reinterpret_cast<uintptr_t>(weak_persistent_handle->peer()));
|
| - obj.AddPropertyF(
|
| - "callbackAddress",
|
| - "0x%" Px "",
|
| + "callbackAddress", "0x%" Px "",
|
| reinterpret_cast<uintptr_t>(weak_persistent_handle->callback()));
|
| // Attempt to include a native symbol name.
|
| char* name = NativeSymbolResolver::LookupSymbolName(
|
| - reinterpret_cast<uintptr_t>(weak_persistent_handle->callback()),
|
| - NULL);
|
| - obj.AddProperty("callbackSymbolName",
|
| - (name == NULL) ? "" : name);
|
| + reinterpret_cast<uintptr_t>(weak_persistent_handle->callback()), NULL);
|
| + obj.AddProperty("callbackSymbolName", (name == NULL) ? "" : name);
|
| if (name != NULL) {
|
| NativeSymbolResolver::FreeSymbolName(name);
|
| }
|
| - obj.AddPropertyF("externalSize",
|
| - "%" Pd "",
|
| + obj.AddPropertyF("externalSize", "%" Pd "",
|
| weak_persistent_handle->external_size());
|
| }
|
|
|
| @@ -3644,8 +3511,8 @@ static bool GetPersistentHandles(Thread* thread, JSONStream* js) {
|
| {
|
| JSONArray persistent_handles(&obj, "persistentHandles");
|
| PersistentHandles& handles = api_state->persistent_handles();
|
| - PersistentHandleVisitor<PersistentHandle> visitor(
|
| - thread, &persistent_handles);
|
| + PersistentHandleVisitor<PersistentHandle> visitor(thread,
|
| + &persistent_handles);
|
| handles.Visit(&visitor);
|
| }
|
| // Weak persistent handles.
|
| @@ -3664,8 +3531,7 @@ static bool GetPersistentHandles(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_ports_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3697,10 +3563,8 @@ static bool RespondWithMalformedObject(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_object_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new UIntParameter("offset", false),
|
| - new UIntParameter("count", false),
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("offset", false),
|
| + new UIntParameter("count", false), NULL,
|
| };
|
|
|
|
|
| @@ -3759,8 +3623,7 @@ static bool GetObject(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_object_store_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3772,8 +3635,7 @@ static bool GetObjectStore(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_class_list_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3786,8 +3648,7 @@ static bool GetClassList(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_type_arguments_list_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - NULL,
|
| + RUNNABLE_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3802,8 +3663,8 @@ static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) {
|
| zone, object_store->canonical_type_arguments());
|
| const intptr_t table_size = typeargs_table.NumEntries();
|
| const intptr_t table_used = typeargs_table.NumOccupied();
|
| - const Array& typeargs_array = Array::Handle(
|
| - zone, HashTables::ToArray(typeargs_table, false));
|
| + const Array& typeargs_array =
|
| + Array::Handle(zone, HashTables::ToArray(typeargs_table, false));
|
| ASSERT(typeargs_array.Length() == table_used);
|
| TypeArguments& typeargs = TypeArguments::Handle(zone);
|
| JSONObject jsobj(js);
|
| @@ -3825,8 +3686,7 @@ static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_version_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3845,9 +3705,7 @@ static bool GetVersion(Thread* thread, JSONStream* js) {
|
|
|
| class ServiceIsolateVisitor : public IsolateVisitor {
|
| public:
|
| - explicit ServiceIsolateVisitor(JSONArray* jsarr)
|
| - : jsarr_(jsarr) {
|
| - }
|
| + explicit ServiceIsolateVisitor(JSONArray* jsarr) : jsarr_(jsarr) {}
|
|
|
| virtual ~ServiceIsolateVisitor() {}
|
|
|
| @@ -3864,8 +3722,7 @@ class ServiceIsolateVisitor : public IsolateVisitor {
|
|
|
|
|
| static const MethodParameter* get_vm_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3884,8 +3741,8 @@ void Service::PrintJSONForVM(JSONStream* js, bool ref) {
|
| jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart");
|
| jsobj.AddProperty64("pid", OS::ProcessId());
|
| jsobj.AddProperty64("_maxRSS", OS::MaxRSS());
|
| - int64_t start_time_millis = (vm_isolate->start_time() /
|
| - kMicrosecondsPerMillisecond);
|
| + int64_t start_time_millis =
|
| + (vm_isolate->start_time() / kMicrosecondsPerMillisecond);
|
| jsobj.AddPropertyTimeMillis("startTime", start_time_millis);
|
| // Construct the isolate list.
|
| {
|
| @@ -3903,8 +3760,7 @@ static bool GetVM(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* restart_vm_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3916,25 +3772,19 @@ static bool RestartVM(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const char* exception_pause_mode_names[] = {
|
| - "All",
|
| - "None",
|
| - "Unhandled",
|
| - NULL,
|
| + "All", "None", "Unhandled", NULL,
|
| };
|
|
|
|
|
| static Dart_ExceptionPauseInfo exception_pause_mode_values[] = {
|
| - kPauseOnAllExceptions,
|
| - kNoPauseOnExceptions,
|
| - kPauseOnUnhandledExceptions,
|
| - kInvalidExceptionPauseInfo,
|
| + kPauseOnAllExceptions, kNoPauseOnExceptions, kPauseOnUnhandledExceptions,
|
| + kInvalidExceptionPauseInfo,
|
| };
|
|
|
|
|
| static const MethodParameter* set_exception_pause_mode_params[] = {
|
| - ISOLATE_PARAMETER,
|
| - new EnumParameter("mode", true, exception_pause_mode_names),
|
| - NULL,
|
| + ISOLATE_PARAMETER,
|
| + new EnumParameter("mode", true, exception_pause_mode_names), NULL,
|
| };
|
|
|
|
|
| @@ -3962,8 +3812,7 @@ static bool SetExceptionPauseMode(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* get_flag_list_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -3974,8 +3823,7 @@ static bool GetFlagList(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* set_flags_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, NULL,
|
| };
|
|
|
|
|
| @@ -4004,18 +3852,16 @@ 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,
|
| + 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;
|
| - Object& obj = Object::Handle(LookupHeapObject(thread, lib_id,
|
| - &lookup_result));
|
| + Object& obj =
|
| + Object::Handle(LookupHeapObject(thread, lib_id, &lookup_result));
|
| const bool is_debuggable =
|
| BoolParameter::Parse(js->LookupParam("isDebuggable"), false);
|
| if (obj.IsLibrary()) {
|
| @@ -4037,9 +3883,7 @@ static bool SetLibraryDebuggable(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* set_name_params[] = {
|
| - ISOLATE_PARAMETER,
|
| - new MethodParameter("name", true),
|
| - NULL,
|
| + ISOLATE_PARAMETER, new MethodParameter("name", true), NULL,
|
| };
|
|
|
|
|
| @@ -4056,9 +3900,7 @@ static bool SetName(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* set_vm_name_params[] = {
|
| - NO_ISOLATE_PARAMETER,
|
| - new MethodParameter("name", true),
|
| - NULL,
|
| + NO_ISOLATE_PARAMETER, new MethodParameter("name", true), NULL,
|
| };
|
|
|
|
|
| @@ -4076,16 +3918,15 @@ static bool SetVMName(Thread* thread, JSONStream* js) {
|
|
|
|
|
| static const MethodParameter* set_trace_class_allocation_params[] = {
|
| - RUNNABLE_ISOLATE_PARAMETER,
|
| - new IdParameter("classId", true),
|
| - new BoolParameter("enable", true),
|
| - NULL,
|
| + 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(kFeatureDisabled,
|
| + js->PrintError(
|
| + kFeatureDisabled,
|
| "Cannot trace allocation when running a precompiled program.");
|
| return true;
|
| }
|
| @@ -4106,6 +3947,7 @@ static bool SetTraceClassAllocation(Thread* thread, JSONStream* js) {
|
| }
|
|
|
|
|
| +// clang-format off
|
| static const ServiceMethodDescriptor service_methods_[] = {
|
| { "_dumpIdZone", DumpIdZone, NULL },
|
| { "_echo", Echo,
|
| @@ -4221,11 +4063,10 @@ static const ServiceMethodDescriptor service_methods_[] = {
|
| { "_setVMTimelineFlags", SetVMTimelineFlags,
|
| set_vm_timeline_flags_params },
|
| };
|
| -
|
| +// clang-format on
|
|
|
| const ServiceMethodDescriptor* FindMethod(const char* method_name) {
|
| - intptr_t num_methods = sizeof(service_methods_) /
|
| - sizeof(service_methods_[0]);
|
| + intptr_t num_methods = sizeof(service_methods_) / sizeof(service_methods_[0]);
|
| for (intptr_t i = 0; i < num_methods; i++) {
|
| const ServiceMethodDescriptor& method = service_methods_[i];
|
| if (strcmp(method_name, method.name) == 0) {
|
|
|