Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: runtime/vm/service.cc

Issue 1537523002: Add dart:developer.postEvent for posting events to the service protocol from Dart code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/service.h ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index c698ffb8238b9e139c3b87a2297d98c6b5a7822b..c8c42499159649e8ab8167b06b30b9d12934fea4 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -113,6 +113,7 @@ StreamInfo Service::gc_stream("GC");
StreamInfo Service::echo_stream("_Echo");
StreamInfo Service::graph_stream("_Graph");
StreamInfo Service::logging_stream("_Logging");
+StreamInfo Service::extension_stream("Extension");
static StreamInfo* streams_[] = {
&Service::vm_stream,
@@ -122,6 +123,7 @@ static StreamInfo* streams_[] = {
&Service::echo_stream,
&Service::graph_stream,
&Service::logging_stream,
+ &Service::extension_stream,
};
@@ -2952,6 +2954,9 @@ void Service::SendLogEvent(Isolate* isolate,
const Instance& zone,
const Object& error,
const Instance& stack_trace) {
+ if (!Service::logging_stream.enabled()) {
+ return;
+ }
ServiceEvent::LogRecord log_record;
log_record.sequence_number = sequence_number;
log_record.timestamp = timestamp;
@@ -2967,6 +2972,21 @@ void Service::SendLogEvent(Isolate* isolate,
}
+void Service::SendExtensionEvent(Isolate* isolate,
+ const String& event_kind,
+ const String& event_data) {
+ if (!Service::extension_stream.enabled()) {
+ return;
+ }
+ ServiceEvent::ExtensionEvent extension_event;
+ extension_event.event_kind = &event_kind;
+ extension_event.event_data = &event_data;
+ ServiceEvent event(isolate, ServiceEvent::kExtension);
+ event.set_extension_event(extension_event);
+ Service::HandleEvent(&event);
+}
+
+
class ContainsAddressVisitor : public FindObjectVisitor {
public:
ContainsAddressVisitor(Isolate* isolate, uword addr)
« no previous file with comments | « runtime/vm/service.h ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698