OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 #ifndef VM_DART_API_MESSAGE_H_ | |
6 #define VM_DART_API_MESSAGE_H_ | |
7 | |
8 #include "vm/dart_api_state.h" | |
9 #include "vm/snapshot.h" | |
10 | |
11 namespace dart { | |
12 | |
13 // Reads a message snapshot into a C structure. | |
14 class ApiMessageReader : public BaseReader { | |
15 public: | |
16 ApiMessageReader(const uint8_t* buffer, intptr_t length, ReAlloc alloc); | |
17 ~ApiMessageReader() { } | |
18 | |
19 Dart_CObject* ReadMessage(); | |
20 | |
21 private: | |
22 // Allocates a Dart_CObject object. | |
23 Dart_CObject* AllocateDartCObject(); | |
24 // Allocates a Dart_CObject object with the specified type. | |
25 Dart_CObject* AllocateDartCObject(Dart_CObject::Type type); | |
26 // Allocates a Dart_CObject object for the null object. | |
27 Dart_CObject* AllocateDartCObjectNull(); | |
28 // Allocates a Dart_CObject object for a boolean object. | |
29 Dart_CObject* AllocateDartCObjectBool(bool value); | |
30 // Allocates a Dart_CObject object for for a 32-bit integer. | |
31 Dart_CObject* AllocateDartCObjectInt32(int32_t value); | |
32 // Allocates a Dart_CObject object for a double. | |
33 Dart_CObject* AllocateDartCObjectDouble(double value); | |
34 // Allocates a Dart_CObject object for string data. | |
35 Dart_CObject* AllocateDartCObjectString(intptr_t length); | |
36 // Allocates a C array of Dart_CObject objects. | |
37 Dart_CObject* AllocateDartCObjectArray(intptr_t length); | |
38 | |
39 void Init(); | |
40 | |
41 intptr_t LookupInternalClass(intptr_t class_header); | |
42 Dart_CObject* ReadInlinedObject(intptr_t object_id); | |
43 Dart_CObject* ReadObjectImpl(intptr_t header); | |
44 Dart_CObject* ReadIndexedObject(intptr_t object_id); | |
45 Dart_CObject* ReadObject(); | |
46 | |
47 // Add object to backward references. | |
48 void AddBackwardReference(intptr_t id, Dart_CObject* obj); | |
49 | |
50 Dart_CObject_Internal* AsInternal(Dart_CObject* object) { | |
siva
2012/02/09 00:45:29
Looks like Dart_CObject_Internal is still defined
Søren Gjesse
2012/02/09 08:44:01
Done.
| |
51 ASSERT(object->type >= Dart_CObject::kNumberOfTypes); | |
52 return reinterpret_cast<Dart_CObject_Internal*>(object); | |
53 } | |
54 | |
55 // Allocation of the structures for the decoded message happens | |
56 // either in the supplied zone or using the supplied allocation | |
57 // function. | |
58 ReAlloc alloc_; | |
59 ApiGrowableArray<Dart_CObject*> backward_references_; | |
60 | |
61 Dart_CObject type_arguments_marker; | |
62 Dart_CObject dynamic_type_marker; | |
63 }; | |
64 | |
65 } // namespace dart | |
66 | |
67 #endif // VM_DART_API_MESSAGE_H_ | |
OLD | NEW |