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

Side by Side Diff: runtime/vm/service.h

Issue 1232193003: Provide stdout and stderr output in the Observatory debugger. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tidy up Created 5 years, 5 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_SERVICE_H_ 5 #ifndef VM_SERVICE_H_
6 #define VM_SERVICE_H_ 6 #define VM_SERVICE_H_
7 7
8 #include "include/dart_tools_api.h" 8 #include "include/dart_tools_api.h"
9 9
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Handles a message which is directed to a particular isolate. 67 // Handles a message which is directed to a particular isolate.
68 static void HandleIsolateMessage(Isolate* isolate, const Array& message); 68 static void HandleIsolateMessage(Isolate* isolate, const Array& message);
69 69
70 static bool NeedsIsolateEvents() { return needs_isolate_events_; } 70 static bool NeedsIsolateEvents() { return needs_isolate_events_; }
71 static bool NeedsDebugEvents() { return needs_debug_events_; } 71 static bool NeedsDebugEvents() { return needs_debug_events_; }
72 static bool NeedsGCEvents() { return needs_gc_events_; } 72 static bool NeedsGCEvents() { return needs_gc_events_; }
73 static bool NeedsEchoEvents() { return needs_echo_events_; } 73 static bool NeedsEchoEvents() { return needs_echo_events_; }
74 static bool NeedsGraphEvents() { return needs_graph_events_; } 74 static bool NeedsGraphEvents() { return needs_graph_events_; }
75 75
76 static void ListenStream(const char* stream_id); 76 static bool ListenStream(const char* stream_id);
77 static void CancelStream(const char* stream_id); 77 static void CancelStream(const char* stream_id);
78 78
79 static void HandleEvent(ServiceEvent* event); 79 static void HandleEvent(ServiceEvent* event);
80 80
81 static void RegisterIsolateEmbedderCallback( 81 static void RegisterIsolateEmbedderCallback(
82 const char* name, 82 const char* name,
83 Dart_ServiceRequestCallback callback, 83 Dart_ServiceRequestCallback callback,
84 void* user_data); 84 void* user_data);
85 85
86 static void RegisterRootEmbedderCallback( 86 static void RegisterRootEmbedderCallback(
87 const char* name, 87 const char* name,
88 Dart_ServiceRequestCallback callback, 88 Dart_ServiceRequestCallback callback,
89 void* user_data); 89 void* user_data);
90 90
91 static void SetEmbedderStreamCallbacks(
92 Dart_ServiceStreamListenCallback listen_callback,
93 Dart_ServiceStreamCancelCallback cancel_callback);
94
91 static void SendEchoEvent(Isolate* isolate, const char* text); 95 static void SendEchoEvent(Isolate* isolate, const char* text);
92 static void SendGraphEvent(Isolate* isolate); 96 static void SendGraphEvent(Isolate* isolate);
93 static void SendInspectEvent(Isolate* isolate, const Object& inspectee); 97 static void SendInspectEvent(Isolate* isolate, const Object& inspectee);
94 98
99 static void SendEmbedderEvent(Isolate* isolate,
100 const char* stream_id,
101 const char* event_kind,
102 const uint8_t* bytes,
103 intptr_t bytes_len);
104
105 static Dart_ServiceStreamListenCallback stream_listen_callback() {
106 return stream_listen_callback_;
107 }
108 static Dart_ServiceStreamCancelCallback stream_cancel_callback() {
109 return stream_cancel_callback_;
110 }
111
112 // Well-known stream ids.
113 static const char* const kIsolateStreamId;
114 static const char* const kDebugStreamId;
115 static const char* const kGCStreamId;
116 static const char* const kEchoStreamId;
117 static const char* const kGraphStreamId;
118
95 private: 119 private:
96 static void InvokeMethod(Isolate* isolate, const Array& message); 120 static void InvokeMethod(Isolate* isolate, const Array& message);
97 121
98 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, 122 static void EmbedderHandleMessage(EmbedderServiceHandler* handler,
99 JSONStream* js); 123 JSONStream* js);
100 124
101 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); 125 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name);
102 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); 126 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name);
103 127
104 static void SendEvent(const char* stream_id, 128 static void SendEvent(const char* stream_id,
105 const char* event_type, 129 const char* event_type,
106 const Object& eventMessage); 130 const Object& eventMessage);
107 // Does not take ownership of 'data'. 131 // Does not take ownership of 'data'.
108 static void SendEventWithData(const char* stream_id, 132 static void SendEventWithData(const char* stream_id,
109 const char* event_type, 133 const char* event_type,
110 const String& meta, 134 const String& meta,
111 const uint8_t* data, 135 const uint8_t* data,
112 intptr_t size); 136 intptr_t size);
113 137
114 static EmbedderServiceHandler* isolate_service_handler_head_; 138 static EmbedderServiceHandler* isolate_service_handler_head_;
115 static EmbedderServiceHandler* root_service_handler_head_; 139 static EmbedderServiceHandler* root_service_handler_head_;
140 static Dart_ServiceStreamListenCallback stream_listen_callback_;
141 static Dart_ServiceStreamCancelCallback stream_cancel_callback_;
116 142
117 static bool needs_isolate_events_; 143 static bool needs_isolate_events_;
118 static bool needs_debug_events_; 144 static bool needs_debug_events_;
119 static bool needs_gc_events_; 145 static bool needs_gc_events_;
120 static bool needs_echo_events_; 146 static bool needs_echo_events_;
121 static bool needs_graph_events_; 147 static bool needs_graph_events_;
122 }; 148 };
123 149
124 } // namespace dart 150 } // namespace dart
125 151
126 #endif // VM_SERVICE_H_ 152 #endif // VM_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698