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

Unified Diff: runtime/vm/raw_object.h

Issue 9195031: Add ByteArray interface and provide internal and external implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fewer templates 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/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 0c49b2e6a1bfee26b0a9680dd7d3479936f56f9d..ed8d037594fb8865222a96fb9dc93fb204d004ec 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -59,7 +59,9 @@ namespace dart {
V(Bool) \
V(Array) \
V(ImmutableArray) \
- V(ByteBuffer) \
+ V(ByteArray) \
+ V(InternalByteArray) \
+ V(ExternalByteArray) \
V(Closure) \
V(Stacktrace) \
V(JSRegExp) \
@@ -956,12 +958,30 @@ class RawImmutableArray : public RawArray {
};
-class RawByteBuffer : public RawInstance {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ByteBuffer);
+class RawByteArray : public RawInstance {
+ RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray);
+ protected:
RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
RawSmi* length_;
RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
+};
+
+
+class RawInternalByteArray : public RawByteArray {
+ RAW_HEAP_OBJECT_IMPLEMENTATION(InternalByteArray);
+
+ // Variable length data follows here.
+ uint8_t* data() {
+ uword address_of_length = reinterpret_cast<uword>(&length_);
+ return reinterpret_cast<uint8_t*>(address_of_length + kWordSize);
+ }
+};
+
+
+class RawExternalByteArray : public RawByteArray {
+ RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalByteArray);
+
uint8_t* data_;
};
« runtime/vm/object.cc ('K') | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698