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

Unified Diff: runtime/vm/object.h

Issue 11464011: Windows complains: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | « no previous file | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 15808)
+++ runtime/vm/object.h (working copy)
@@ -4669,8 +4669,41 @@
};
-class Uint8ClampedArray : public Uint8Array {
+class Uint8ClampedArray : public ByteArray {
public:
+ intptr_t ByteLength() const {
+ return Length();
+ }
+
+ uint8_t At(intptr_t index) const {
+ ASSERT((index >= 0) && (index < Length()));
+ return raw_ptr()->data_[index];
+ }
+
+ void SetAt(intptr_t index, uint8_t value) const {
+ ASSERT((index >= 0) && (index < Length()));
+ raw_ptr()->data_[index] = value;
+ }
+
+ static const intptr_t kBytesPerElement = 1;
+ static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
+
+ static intptr_t data_offset() {
+ return OFFSET_OF(RawUint8ClampedArray, data_);
+ }
+
+ static intptr_t InstanceSize() {
+ ASSERT(sizeof(RawUint8ClampedArray) ==
+ OFFSET_OF(RawUint8ClampedArray, data_));
+ return 0;
+ }
+
+ static intptr_t InstanceSize(intptr_t len) {
+ ASSERT(0 <= len && len <= kMaxElements);
+ return RoundedAllocationSize(
+ sizeof(RawUint8ClampedArray) + (len * kBytesPerElement));
+ }
+
static RawUint8ClampedArray* New(intptr_t len,
Heap::Space space = Heap::kNew);
static RawUint8ClampedArray* New(const uint8_t* data,
@@ -4678,7 +4711,13 @@
Heap::Space space = Heap::kNew);
private:
- HEAP_OBJECT_IMPLEMENTATION(Uint8ClampedArray, Uint8Array);
+ uint8_t* ByteAddr(intptr_t byte_offset) const {
+ ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
+ return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
+ }
+
+ HEAP_OBJECT_IMPLEMENTATION(Uint8ClampedArray, ByteArray);
+ friend class ByteArray;
friend class Class;
};
« no previous file with comments | « no previous file | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698