| 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 13 matching lines...) Expand all Loading... |
| 24 class String; | 24 class String; |
| 25 | 25 |
| 26 class Service : public AllStatic { | 26 class Service : public AllStatic { |
| 27 public: | 27 public: |
| 28 // Handles a message which is not directed to an isolate. | 28 // Handles a message which is not directed to an isolate. |
| 29 static void HandleRootMessage(const Array& message); | 29 static void HandleRootMessage(const Array& message); |
| 30 | 30 |
| 31 // Handles a message which is directed to a particular isolate. | 31 // Handles a message which is directed to a particular isolate. |
| 32 static void HandleIsolateMessage(Isolate* isolate, const Array& message); | 32 static void HandleIsolateMessage(Isolate* isolate, const Array& message); |
| 33 | 33 |
| 34 static bool EventMaskHas(uint32_t mask); | |
| 35 static void SetEventMask(uint32_t mask); | |
| 36 static bool NeedsEvents(); | 34 static bool NeedsEvents(); |
| 37 static bool NeedsDebuggerEvents(); | |
| 38 static bool NeedsGCEvents(); | |
| 39 | 35 |
| 40 static void HandleEvent(ServiceEvent* event); | 36 static void HandleEvent(ServiceEvent* event); |
| 41 static void HandleGCEvent(GCEvent* event); | 37 static void HandleGCEvent(GCEvent* event); |
| 42 | 38 |
| 43 static void RegisterIsolateEmbedderCallback( | 39 static void RegisterIsolateEmbedderCallback( |
| 44 const char* name, | 40 const char* name, |
| 45 Dart_ServiceRequestCallback callback, | 41 Dart_ServiceRequestCallback callback, |
| 46 void* user_data); | 42 void* user_data); |
| 47 | 43 |
| 48 static void RegisterRootEmbedderCallback( | 44 static void RegisterRootEmbedderCallback( |
| 49 const char* name, | 45 const char* name, |
| 50 Dart_ServiceRequestCallback callback, | 46 Dart_ServiceRequestCallback callback, |
| 51 void* user_data); | 47 void* user_data); |
| 52 | 48 |
| 53 static void SendEchoEvent(Isolate* isolate, const char* text); | 49 static void SendEchoEvent(Isolate* isolate, const char* text); |
| 54 static void SendGraphEvent(Isolate* isolate); | 50 static void SendGraphEvent(Isolate* isolate); |
| 55 | 51 |
| 56 private: | 52 private: |
| 57 static void InvokeMethod(Isolate* isolate, const Array& message); | 53 static void InvokeMethod(Isolate* isolate, const Array& message); |
| 58 | 54 |
| 59 // These must be kept in sync with service/constants.dart | |
| 60 static const int kEventFamilyDebug = 0; | |
| 61 static const int kEventFamilyGC = 1; | |
| 62 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug); | |
| 63 static const uint32_t kEventFamilyGCMask = (1 << kEventFamilyGC); | |
| 64 | |
| 65 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 55 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
| 66 JSONStream* js); | 56 JSONStream* js); |
| 67 | 57 |
| 68 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 58 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
| 69 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 59 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
| 70 | 60 |
| 71 static void SendEvent(intptr_t eventFamilyId, | 61 static void SendEvent(intptr_t eventType, |
| 72 intptr_t eventType, | |
| 73 const Object& eventMessage); | 62 const Object& eventMessage); |
| 74 // Does not take ownership of 'data'. | 63 // Does not take ownership of 'data'. |
| 75 static void SendEvent(intptr_t eventId, | 64 static void SendEvent(const String& meta, |
| 76 const String& meta, | |
| 77 const uint8_t* data, | 65 const uint8_t* data, |
| 78 intptr_t size); | 66 intptr_t size); |
| 79 | 67 |
| 80 static EmbedderServiceHandler* isolate_service_handler_head_; | 68 static EmbedderServiceHandler* isolate_service_handler_head_; |
| 81 static EmbedderServiceHandler* root_service_handler_head_; | 69 static EmbedderServiceHandler* root_service_handler_head_; |
| 82 | |
| 83 static uint32_t event_mask_; | |
| 84 }; | 70 }; |
| 85 | 71 |
| 86 } // namespace dart | 72 } // namespace dart |
| 87 | 73 |
| 88 #endif // VM_SERVICE_H_ | 74 #endif // VM_SERVICE_H_ |
| OLD | NEW |