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

Unified Diff: runtime/vm/dart_api_message.h

Issue 9407010: Move MessageWriter from snapshot files to dart_api_message files (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_message.h
diff --git a/runtime/vm/dart_api_message.h b/runtime/vm/dart_api_message.h
index d8a4339e7f5ea369b9c108cab584c33b5714e0c1..76a97884f4abab28d1ba37f437b10805a5caecbb 100644
--- a/runtime/vm/dart_api_message.h
+++ b/runtime/vm/dart_api_message.h
@@ -82,6 +82,48 @@ class ApiMessageReader : public BaseReader {
Dart_CObject dynamic_type_marker;
};
+
+class ApiMessageWriter : public BaseWriter {
+ public:
+ ApiMessageWriter(uint8_t** buffer, ReAlloc alloc)
+ : BaseWriter(buffer, alloc), object_id_(0) {
+ ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes - 1);
+ }
+ ~ApiMessageWriter() { }
+
+ // Writes a message of integers.
+ void WriteMessage(intptr_t field_count, intptr_t *data);
+
+ void WriteCMessage(Dart_CObject* object);
+
+ void FinalizeBuffer() {
+ BaseWriter::FinalizeBuffer(Snapshot::kMessage);
+ }
+
+ private:
+ static const intptr_t kDartCObjectTypeBits = 4;
+ static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1;
+ static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask;
+ static const intptr_t kDartCObjectMarkOffset = 1;
+
+ void MarkCObject(Dart_CObject* object, intptr_t object_id);
+ void UnmarkCObject(Dart_CObject* object);
+ bool IsCObjectMarked(Dart_CObject* object);
+ intptr_t GetMarkedCObjectMark(Dart_CObject* object);
+ void UnmarkAllCObjects(Dart_CObject* object);
+
+ void WriteSmi(int64_t value);
+ void WriteMint(Dart_CObject* object, int64_t value);
+ void WriteInt32(Dart_CObject* object);
+ void WriteInt64(Dart_CObject* object);
+ void WriteInlinedHeader(Dart_CObject* object);
+ void WriteCObject(Dart_CObject* object);
+
+ intptr_t object_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter);
+};
+
} // namespace dart
#endif // VM_DART_API_MESSAGE_H_
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698