Chromium Code Reviews| Index: runtime/vm/service.cc |
| diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc |
| index 4c49fcf8df692581aed6045eeb94ada6a49f4fc5..933ab51277b4508ca6f138c1b6ac3ae5f6e6b890 100644 |
| --- a/runtime/vm/service.cc |
| +++ b/runtime/vm/service.cc |
| @@ -129,14 +129,14 @@ StreamInfo Service::graph_stream("_Graph"); |
| StreamInfo Service::logging_stream("_Logging"); |
| StreamInfo Service::extension_stream("Extension"); |
| StreamInfo Service::timeline_stream("Timeline"); |
| +StreamInfo Service::editor_stream("_Editor"); |
| 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::timeline_stream, &Service::editor_stream}; |
| bool Service::ListenStream(const char* stream_id) { |
| @@ -4203,6 +4203,41 @@ static bool SetTraceClassAllocation(Thread* thread, JSONStream* js) { |
| return true; |
| } |
| +static const MethodParameter* send_object_to_editor_params[] = { |
| + RUNNABLE_ISOLATE_PARAMETER, new StringParameter("editor", true), |
| + new StringParameter("objectId", true), NULL, |
| +}; |
| + |
| +static bool SendObjectToEditor(Thread* thread, JSONStream* js) { |
| + // Handle heap objects. |
| + ObjectIdRing::LookupResult lookup_result; |
| + const Object& obj = Object::Handle( |
| + LookupHeapObject(thread, js->LookupParam("objectId"), &lookup_result)); |
|
rmacnak
2017/06/27 16:47:56
It looks like the only thing we do with the object
cbernaschina
2017/06/27 17:03:25
In the event it is sent as an ObjectRef.
Looking i
rmacnak
2017/06/28 16:32:42
Add a comment here explaining we're effectively re
cbernaschina
2017/06/29 17:29:38
Done.
|
| + if (obj.raw() != Object::sentinel().raw()) { |
| + // We found a heap object for this id. Return it. |
| + if (Service::editor_stream.enabled()) { |
| + ServiceEvent event(thread->isolate(), |
| + ServiceEvent::kEditorObjectSelected); |
| + ServiceEvent::EditorEvent editor_event; |
| + editor_event.object = &obj; |
| + editor_event.editor = js->LookupParam("editor"); |
| + event.set_editor_event(editor_event); |
| + Service::HandleEvent(&event); |
| + } |
| + PrintSuccess(js); |
| + return true; |
| + } else if (lookup_result == ObjectIdRing::kCollected) { |
| + PrintSentinel(js, kCollectedSentinel); |
| + return true; |
| + } else if (lookup_result == ObjectIdRing::kExpired) { |
| + PrintSentinel(js, kExpiredSentinel); |
| + return true; |
| + } |
| + PrintInvalidParamError(js, "objectId"); |
| + |
| + return true; |
| +} |
| + |
| // clang-format off |
| static const ServiceMethodDescriptor service_methods_[] = { |
| @@ -4321,6 +4356,8 @@ static const ServiceMethodDescriptor service_methods_[] = { |
| set_vm_timeline_flags_params }, |
| { "_collectAllGarbage", CollectAllGarbage, |
| collect_all_garbage_params }, |
| + { "_sendObjectToEditor", SendObjectToEditor, |
| + send_object_to_editor_params }, |
| }; |
| // clang-format on |