Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Unified Diff: runtime/vm/snapshot.h

Issue 9325022: Decode the Dart message into a Dart_CMessage structure before calling the native port callback (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/snapshot.h
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 166ea06ee89e899b0714b4203faf0dee7705f29d..cc793504a3339cf4792d51baa743aa858cccb892 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -421,29 +421,41 @@ struct Dart_CObject_Internal : public Dart_CObject {
// Reads a message snapshot into C structure.
class CMessageReader : public BaseReader {
public:
+ // Creates a message reader where the allocated Dart_CMessage
+ // structure and all the allocated Dart_CObject structures are
+ // allocated using the supplied allocation function.
CMessageReader(const uint8_t* buffer, intptr_t length, ReAlloc alloc);
+ // Creates a message reader where the allocated Dart_CMessage
+ // structure and all the allocated Dart_CObject structures are
+ // allocated in the supplied zone. The supplied zone will also be
+ // used for temporary allocations for message decoding.
+ CMessageReader(const uint8_t* buffer, intptr_t length, Zone* zone);
siva 2012/02/04 01:55:43 Ditto comment regarding this version of the constr
Søren Gjesse 2012/02/06 16:25:52 See comment in native_message_handler.cc
~CMessageReader() { }
Dart_CMessage* ReadMessage();
private:
- // Allocates a Dart_CObject object on the C heap.
+ // Allocate a piece of memory for the decoded message data.
+ uint8_t* Allocate(uint8_t* ptr, intptr_t old_size, intptr_t new_size);
+ // Allocates a Dart_CObject object.
Dart_CObject* AllocateDartCObject();
- // Allocates a Dart_CObject object with the specified type on the C heap.
+ // Allocates a Dart_CObject object with the specified type.
Dart_CObject* AllocateDartCObject(Dart_CObject::Type type);
- // Allocates a Dart_CObject object for the null object on the C heap.
+ // Allocates a Dart_CObject object for the null object.
Dart_CObject* AllocateDartCObjectNull();
- // Allocates a Dart_CObject object for a boolean object on the C heap.
+ // Allocates a Dart_CObject object for a boolean object.
Dart_CObject* AllocateDartCObjectBool(bool value);
- // Allocates a Dart_CObject object for for a 32-bit integer on the C heap.
+ // Allocates a Dart_CObject object for for a 32-bit integer.
Dart_CObject* AllocateDartCObjectInt32(int32_t value);
- // Allocates a Dart_CObject object for a double on the C heap.
+ // Allocates a Dart_CObject object for a double.
Dart_CObject* AllocateDartCObjectDouble(double value);
- // Allocates a Dart_CObject object for string data on the C heap.
+ // Allocates a Dart_CObject object for string data.
Dart_CObject* AllocateDartCObjectString(intptr_t length);
- // Allocates a C array of Dart_CObject objects on the C heap.
+ // Allocates a C array of Dart_CObject objects.
Dart_CObject* AllocateDartCObjectArray(intptr_t length);
+ void Init();
+
intptr_t LookupInternalClass(intptr_t class_header);
Dart_CObject* ReadInlinedObject(intptr_t object_id);
Dart_CObject* ReadObjectImpl(intptr_t header);
@@ -458,6 +470,10 @@ class CMessageReader : public BaseReader {
return reinterpret_cast<Dart_CObject_Internal*>(object);
}
+ // Allocation of the structures for the decoded message happens
+ // either in the supplied zone or using the supplied allocation
+ // function.
+ Zone* zone_;
siva 2012/02/04 01:55:43 Ditto comment.
ReAlloc alloc_;
GrowableArray<Dart_CObject*> backward_references_;

Powered by Google App Engine
This is Rietveld 408576698