| 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" |
| 11 #include "vm/os_thread.h" | 11 #include "vm/os_thread.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 class Array; | 15 class Array; |
| 16 class DebuggerEvent; | 16 class DebuggerEvent; |
| 17 class EmbedderServiceHandler; | 17 class EmbedderServiceHandler; |
| 18 class GCEvent; | 18 class GCEvent; |
| 19 class Instance; | 19 class Instance; |
| 20 class Isolate; | 20 class Isolate; |
| 21 class JSONStream; | 21 class JSONStream; |
| 22 class Object; | 22 class Object; |
| 23 class RawInstance; | 23 class RawInstance; |
| 24 class String; | 24 class String; |
| 25 | 25 |
| 26 class Service : public AllStatic { | 26 class Service : public AllStatic { |
| 27 public: | 27 public: |
| 28 static const char* kServiceIsolateName; | 28 static const char* kIsolateName; |
| 29 static bool IsServiceIsolateName(const char* name); | 29 static bool IsServiceIsolateName(const char* name); |
| 30 | 30 |
| 31 // Handles a message which is not directed to an isolate. | 31 // Handles a message which is not directed to an isolate. |
| 32 static void HandleRootMessage(const Instance& message); | 32 static void HandleRootMessage(const Instance& message); |
| 33 | 33 |
| 34 // Handles a message which is directed to a particular isolate. | 34 // Handles a message which is directed to a particular isolate. |
| 35 static void HandleIsolateMessage(Isolate* isolate, const Array& message); | 35 static void HandleIsolateMessage(Isolate* isolate, const Array& message); |
| 36 | 36 |
| 37 static Isolate* GetServiceIsolate(void* callback_data); | 37 static Isolate* GetServiceIsolate(void* callback_data); |
| 38 static bool SendIsolateStartupMessage(); | 38 static bool SendIsolateStartupMessage(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 static void SendEchoEvent(Isolate* isolate); | 75 static void SendEchoEvent(Isolate* isolate); |
| 76 static void SendGraphEvent(Isolate* isolate); | 76 static void SendGraphEvent(Isolate* isolate); |
| 77 | 77 |
| 78 static void MaybeInjectVMServiceLibrary(Isolate* isolate); | 78 static void MaybeInjectVMServiceLibrary(Isolate* isolate); |
| 79 | 79 |
| 80 static void RunService(); | 80 static void RunService(); |
| 81 | 81 |
| 82 static void FinishedInitializing(); | 82 static void FinishedInitializing(); |
| 83 | 83 |
| 84 static Dart_IsolateCreateCallback create_callback() { |
| 85 return create_callback_; |
| 86 } |
| 87 |
| 84 private: | 88 private: |
| 85 // These must be kept in sync with service/constants.dart | 89 // These must be kept in sync with service/constants.dart |
| 86 static const int kEventFamilyDebug = 0; | 90 static const int kEventFamilyDebug = 0; |
| 87 static const int kEventFamilyGC = 1; | 91 static const int kEventFamilyGC = 1; |
| 88 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug); | 92 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug); |
| 89 static const uint32_t kEventFamilyGCMask = (1 << kEventFamilyGC); | 93 static const uint32_t kEventFamilyGCMask = (1 << kEventFamilyGC); |
| 90 | 94 |
| 91 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 95 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
| 92 JSONStream* js); | 96 JSONStream* js); |
| 93 | 97 |
| 94 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 98 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
| 95 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 99 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
| 96 static Dart_Handle GetSource(const char* name); | 100 static Dart_Handle GetSource(const char* name); |
| 97 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, | 101 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, |
| 98 Dart_Handle url); | 102 Dart_Handle url); |
| 99 | 103 |
| 100 static void SendEvent(intptr_t eventId, const Object& eventMessage); | 104 static void SendEvent(intptr_t eventId, const Object& eventMessage); |
| 101 // Does not take ownership of 'data'. | 105 // Does not take ownership of 'data'. |
| 102 static void SendEvent(intptr_t eventId, | 106 static void SendEvent(intptr_t eventId, |
| 103 const String& meta, | 107 const String& meta, |
| 104 const uint8_t* data, | 108 const uint8_t* data, |
| 105 intptr_t size); | 109 intptr_t size); |
| 106 | 110 |
| 107 static EmbedderServiceHandler* isolate_service_handler_head_; | 111 static EmbedderServiceHandler* isolate_service_handler_head_; |
| 108 static EmbedderServiceHandler* root_service_handler_head_; | 112 static EmbedderServiceHandler* root_service_handler_head_; |
| 109 | 113 |
| 110 | 114 |
| 115 static Dart_IsolateCreateCallback create_callback_; |
| 111 static Monitor* monitor_; | 116 static Monitor* monitor_; |
| 112 static bool initializing_; | 117 static bool initializing_; |
| 113 static Isolate* service_isolate_; | 118 static Isolate* service_isolate_; |
| 114 static Dart_Port service_port_; | 119 static Dart_Port service_port_; |
| 115 static Dart_Port load_port_; | 120 static Dart_Port load_port_; |
| 116 static uint32_t event_mask_; | 121 static uint32_t event_mask_; |
| 117 }; | 122 }; |
| 118 | 123 |
| 119 } // namespace dart | 124 } // namespace dart |
| 120 | 125 |
| 121 #endif // VM_SERVICE_H_ | 126 #endif // VM_SERVICE_H_ |
| OLD | NEW |