| 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 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 class Array; |
| 14 class DebuggerEvent; | 15 class DebuggerEvent; |
| 16 class EmbedderServiceHandler; |
| 15 class GCEvent; | 17 class GCEvent; |
| 16 class EmbedderServiceHandler; | |
| 17 class Instance; | 18 class Instance; |
| 18 class Isolate; | 19 class Isolate; |
| 19 class JSONStream; | 20 class JSONStream; |
| 20 class Array; | 21 class Object; |
| 21 class RawInstance; | 22 class RawInstance; |
| 22 class String; | 23 class String; |
| 23 | 24 |
| 24 class Service : public AllStatic { | 25 class Service : public AllStatic { |
| 25 public: | 26 public: |
| 26 // Handles a message which is not directed to an isolate. | 27 // Handles a message which is not directed to an isolate. |
| 27 static void HandleRootMessage(const Instance& message); | 28 static void HandleRootMessage(const Instance& message); |
| 28 | 29 |
| 29 // Handles a message which is directed to a particular isolate. | 30 // Handles a message which is directed to a particular isolate. |
| 30 static void HandleIsolateMessage(Isolate* isolate, const Array& message); | 31 static void HandleIsolateMessage(Isolate* isolate, const Array& message); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 58 | 59 |
| 59 static void RegisterRootEmbedderCallback( | 60 static void RegisterRootEmbedderCallback( |
| 60 const char* name, | 61 const char* name, |
| 61 Dart_ServiceRequestCallback callback, | 62 Dart_ServiceRequestCallback callback, |
| 62 void* user_data); | 63 void* user_data); |
| 63 | 64 |
| 64 static bool IsServiceIsolate(Isolate* isolate) { | 65 static bool IsServiceIsolate(Isolate* isolate) { |
| 65 return isolate == service_isolate_; | 66 return isolate == service_isolate_; |
| 66 } | 67 } |
| 67 | 68 |
| 69 static void SendEchoEvent(Isolate* isolate); |
| 70 |
| 68 private: | 71 private: |
| 69 // These must be kept in sync with service/constants.dart | 72 // These must be kept in sync with service/constants.dart |
| 70 static const int kEventFamilyDebug = 0; | 73 static const int kEventFamilyDebug = 0; |
| 71 static const int kEventFamilyGC = 1; | 74 static const int kEventFamilyGC = 1; |
| 72 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug); | 75 static const uint32_t kEventFamilyDebugMask = (1 << kEventFamilyDebug); |
| 73 static const uint32_t kEventFamilyGCMask = (1 << kEventFamilyGC); | 76 static const uint32_t kEventFamilyGCMask = (1 << kEventFamilyGC); |
| 74 | 77 |
| 75 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 78 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
| 76 JSONStream* js); | 79 JSONStream* js); |
| 77 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 80 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
| 78 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 81 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
| 79 static Dart_Handle GetSource(const char* name); | 82 static Dart_Handle GetSource(const char* name); |
| 80 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, | 83 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, |
| 81 Dart_Handle url); | 84 Dart_Handle url); |
| 82 static void SendEvent(intptr_t eventId, const String& eventMessage); | 85 static void SendEvent(intptr_t eventId, const Object& eventMessage); |
| 86 // Does not take ownership of 'data'. |
| 87 static void SendEvent(intptr_t eventId, |
| 88 const String& meta, |
| 89 const uint8_t* data, |
| 90 intptr_t size); |
| 83 | 91 |
| 84 static EmbedderServiceHandler* isolate_service_handler_head_; | 92 static EmbedderServiceHandler* isolate_service_handler_head_; |
| 85 static EmbedderServiceHandler* root_service_handler_head_; | 93 static EmbedderServiceHandler* root_service_handler_head_; |
| 86 | 94 |
| 87 static Isolate* service_isolate_; | 95 static Isolate* service_isolate_; |
| 88 static Dart_LibraryTagHandler embedder_provided_handler_; | 96 static Dart_LibraryTagHandler embedder_provided_handler_; |
| 89 static Dart_Port port_; | 97 static Dart_Port port_; |
| 90 static uint32_t event_mask_; | 98 static uint32_t event_mask_; |
| 91 }; | 99 }; |
| 92 | 100 |
| 93 } // namespace dart | 101 } // namespace dart |
| 94 | 102 |
| 95 #endif // VM_SERVICE_H_ | 103 #endif // VM_SERVICE_H_ |
| OLD | NEW |