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/object_id_ring.h" |
11 #include "vm/os_thread.h" | 12 #include "vm/os_thread.h" |
12 | 13 |
13 namespace dart { | 14 namespace dart { |
14 | 15 |
15 class Array; | 16 class Array; |
16 class EmbedderServiceHandler; | 17 class EmbedderServiceHandler; |
17 class GCEvent; | 18 class GCEvent; |
| 19 class GrowableObjectArray; |
18 class Instance; | 20 class Instance; |
19 class Isolate; | 21 class Isolate; |
20 class JSONStream; | 22 class JSONStream; |
21 class Object; | 23 class Object; |
22 class RawInstance; | 24 class RawInstance; |
23 class ServiceEvent; | 25 class ServiceEvent; |
24 class String; | 26 class String; |
25 | 27 |
| 28 class ServiceIdZone { |
| 29 public: |
| 30 ServiceIdZone(); |
| 31 virtual ~ServiceIdZone(); |
| 32 |
| 33 // Returned string will be zone allocated. |
| 34 virtual char* GetServiceId(const Object& obj) = 0; |
| 35 |
| 36 private: |
| 37 }; |
| 38 |
| 39 |
| 40 class RingServiceIdZone : public ServiceIdZone { |
| 41 public: |
| 42 explicit RingServiceIdZone(ObjectIdRing* ring, ObjectIdRing::IdPolicy policy); |
| 43 virtual ~RingServiceIdZone(); |
| 44 |
| 45 // Returned string will be zone allocated. |
| 46 virtual char* GetServiceId(const Object& obj); |
| 47 |
| 48 void set_policy(ObjectIdRing::IdPolicy policy) { |
| 49 policy_ = policy; |
| 50 } |
| 51 |
| 52 ObjectIdRing::IdPolicy policy() const { |
| 53 return policy_; |
| 54 } |
| 55 |
| 56 private: |
| 57 ObjectIdRing* ring_; |
| 58 ObjectIdRing::IdPolicy policy_; |
| 59 }; |
| 60 |
| 61 |
26 class Service : public AllStatic { | 62 class Service : public AllStatic { |
27 public: | 63 public: |
28 // Handles a message which is not directed to an isolate. | 64 // Handles a message which is not directed to an isolate. |
29 static void HandleRootMessage(const Array& message); | 65 static void HandleRootMessage(const Array& message); |
30 | 66 |
31 // Handles a message which is directed to a particular isolate. | 67 // Handles a message which is directed to a particular isolate. |
32 static void HandleIsolateMessage(Isolate* isolate, const Array& message); | 68 static void HandleIsolateMessage(Isolate* isolate, const Array& message); |
33 | 69 |
34 static bool NeedsEvents(); | 70 static bool NeedsEvents(); |
35 | 71 |
(...skipping 29 matching lines...) Expand all Loading... |
65 const uint8_t* data, | 101 const uint8_t* data, |
66 intptr_t size); | 102 intptr_t size); |
67 | 103 |
68 static EmbedderServiceHandler* isolate_service_handler_head_; | 104 static EmbedderServiceHandler* isolate_service_handler_head_; |
69 static EmbedderServiceHandler* root_service_handler_head_; | 105 static EmbedderServiceHandler* root_service_handler_head_; |
70 }; | 106 }; |
71 | 107 |
72 } // namespace dart | 108 } // namespace dart |
73 | 109 |
74 #endif // VM_SERVICE_H_ | 110 #endif // VM_SERVICE_H_ |
OLD | NEW |