OLD | NEW |
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_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 | 61 |
62 class Service : public AllStatic { | 62 class Service : public AllStatic { |
63 public: | 63 public: |
64 // Handles a message which is not directed to an isolate. | 64 // Handles a message which is not directed to an isolate. |
65 static void HandleRootMessage(const Array& message); | 65 static void HandleRootMessage(const Array& message); |
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 NeedsEvents(); |
71 static bool NeedsDebugEvents() { return needs_debug_events_; } | |
72 static bool NeedsGCEvents() { return needs_gc_events_; } | |
73 static bool NeedsEchoEvents() { return needs_echo_events_; } | |
74 static bool NeedsGraphEvents() { return needs_graph_events_; } | |
75 | |
76 static void ListenStream(const char* stream_id); | |
77 static void CancelStream(const char* stream_id); | |
78 | 71 |
79 static void HandleEvent(ServiceEvent* event); | 72 static void HandleEvent(ServiceEvent* event); |
80 | 73 |
81 static void RegisterIsolateEmbedderCallback( | 74 static void RegisterIsolateEmbedderCallback( |
82 const char* name, | 75 const char* name, |
83 Dart_ServiceRequestCallback callback, | 76 Dart_ServiceRequestCallback callback, |
84 void* user_data); | 77 void* user_data); |
85 | 78 |
86 static void RegisterRootEmbedderCallback( | 79 static void RegisterRootEmbedderCallback( |
87 const char* name, | 80 const char* name, |
88 Dart_ServiceRequestCallback callback, | 81 Dart_ServiceRequestCallback callback, |
89 void* user_data); | 82 void* user_data); |
90 | 83 |
91 static void SendEchoEvent(Isolate* isolate, const char* text); | 84 static void SendEchoEvent(Isolate* isolate, const char* text); |
92 static void SendGraphEvent(Isolate* isolate); | 85 static void SendGraphEvent(Isolate* isolate); |
93 static void SendInspectEvent(Isolate* isolate, const Object& inspectee); | 86 static void SendInspectEvent(Isolate* isolate, const Object& inspectee); |
94 | 87 |
95 private: | 88 private: |
96 static void InvokeMethod(Isolate* isolate, const Array& message); | 89 static void InvokeMethod(Isolate* isolate, const Array& message); |
97 | 90 |
98 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 91 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
99 JSONStream* js); | 92 JSONStream* js); |
100 | 93 |
101 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 94 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
102 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 95 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
103 | 96 |
104 static void SendEvent(const char* stream_id, | 97 static void SendEvent(intptr_t eventType, |
105 const char* event_type, | |
106 const Object& eventMessage); | 98 const Object& eventMessage); |
107 // Does not take ownership of 'data'. | 99 // Does not take ownership of 'data'. |
108 static void SendEventWithData(const char* stream_id, | 100 static void SendEvent(const String& meta, |
109 const char* event_type, | 101 const uint8_t* data, |
110 const String& meta, | 102 intptr_t size); |
111 const uint8_t* data, | |
112 intptr_t size); | |
113 | 103 |
114 static EmbedderServiceHandler* isolate_service_handler_head_; | 104 static EmbedderServiceHandler* isolate_service_handler_head_; |
115 static EmbedderServiceHandler* root_service_handler_head_; | 105 static EmbedderServiceHandler* root_service_handler_head_; |
116 | |
117 static bool needs_isolate_events_; | |
118 static bool needs_debug_events_; | |
119 static bool needs_gc_events_; | |
120 static bool needs_echo_events_; | |
121 static bool needs_graph_events_; | |
122 }; | 106 }; |
123 | 107 |
124 } // namespace dart | 108 } // namespace dart |
125 | 109 |
126 #endif // VM_SERVICE_H_ | 110 #endif // VM_SERVICE_H_ |
OLD | NEW |