| 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 NeedsEvents(); | 70 static bool NeedsIsolateEvents() { return needs_isolate_events_; } |
| 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); |
| 71 | 78 |
| 72 static void HandleEvent(ServiceEvent* event); | 79 static void HandleEvent(ServiceEvent* event); |
| 73 | 80 |
| 74 static void RegisterIsolateEmbedderCallback( | 81 static void RegisterIsolateEmbedderCallback( |
| 75 const char* name, | 82 const char* name, |
| 76 Dart_ServiceRequestCallback callback, | 83 Dart_ServiceRequestCallback callback, |
| 77 void* user_data); | 84 void* user_data); |
| 78 | 85 |
| 79 static void RegisterRootEmbedderCallback( | 86 static void RegisterRootEmbedderCallback( |
| 80 const char* name, | 87 const char* name, |
| 81 Dart_ServiceRequestCallback callback, | 88 Dart_ServiceRequestCallback callback, |
| 82 void* user_data); | 89 void* user_data); |
| 83 | 90 |
| 84 static void SendEchoEvent(Isolate* isolate, const char* text); | 91 static void SendEchoEvent(Isolate* isolate, const char* text); |
| 85 static void SendGraphEvent(Isolate* isolate); | 92 static void SendGraphEvent(Isolate* isolate); |
| 86 static void SendInspectEvent(Isolate* isolate, const Object& inspectee); | 93 static void SendInspectEvent(Isolate* isolate, const Object& inspectee); |
| 87 | 94 |
| 88 private: | 95 private: |
| 89 static void InvokeMethod(Isolate* isolate, const Array& message); | 96 static void InvokeMethod(Isolate* isolate, const Array& message); |
| 90 | 97 |
| 91 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 98 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
| 92 JSONStream* js); | 99 JSONStream* js); |
| 93 | 100 |
| 94 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 101 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
| 95 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 102 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
| 96 | 103 |
| 97 static void SendEvent(intptr_t eventType, | 104 static void SendEvent(const char* stream_id, |
| 105 const char* event_type, |
| 98 const Object& eventMessage); | 106 const Object& eventMessage); |
| 99 // Does not take ownership of 'data'. | 107 // Does not take ownership of 'data'. |
| 100 static void SendEvent(const String& meta, | 108 static void SendEventWithData(const char* stream_id, |
| 101 const uint8_t* data, | 109 const char* event_type, |
| 102 intptr_t size); | 110 const String& meta, |
| 111 const uint8_t* data, |
| 112 intptr_t size); |
| 103 | 113 |
| 104 static EmbedderServiceHandler* isolate_service_handler_head_; | 114 static EmbedderServiceHandler* isolate_service_handler_head_; |
| 105 static EmbedderServiceHandler* root_service_handler_head_; | 115 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_; |
| 106 }; | 122 }; |
| 107 | 123 |
| 108 } // namespace dart | 124 } // namespace dart |
| 109 | 125 |
| 110 #endif // VM_SERVICE_H_ | 126 #endif // VM_SERVICE_H_ |
| OLD | NEW |