OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 if (callback_ != NULL) (*callback_)(peer_); | 1582 if (callback_ != NULL) (*callback_)(peer_); |
1583 } | 1583 } |
1584 | 1584 |
1585 const T* data() { | 1585 const T* data() { |
1586 return data_; | 1586 return data_; |
1587 } | 1587 } |
1588 void* peer() { | 1588 void* peer() { |
1589 return peer_; | 1589 return peer_; |
1590 } | 1590 } |
1591 | 1591 |
| 1592 static intptr_t data_offset() { |
| 1593 return OFFSET_OF(ExternalStringData<T>, data_); |
| 1594 } |
| 1595 |
1592 private: | 1596 private: |
1593 const T* data_; | 1597 const T* data_; |
1594 void* peer_; | 1598 void* peer_; |
1595 Dart_PeerFinalizer callback_; | 1599 Dart_PeerFinalizer callback_; |
1596 }; | 1600 }; |
1597 | 1601 |
1598 | 1602 |
1599 class RawExternalOneByteString : public RawString { | 1603 class RawExternalOneByteString : public RawString { |
1600 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); | 1604 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); |
| 1605 public: |
| 1606 typedef ExternalStringData<uint8_t> ExternalData; |
1601 | 1607 |
1602 ExternalStringData<uint8_t>* external_data_; | 1608 private: |
| 1609 ExternalData* external_data_; |
1603 friend class Api; | 1610 friend class Api; |
1604 }; | 1611 }; |
1605 | 1612 |
1606 | 1613 |
1607 class RawExternalTwoByteString : public RawString { | 1614 class RawExternalTwoByteString : public RawString { |
1608 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); | 1615 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); |
| 1616 public: |
| 1617 typedef ExternalStringData<uint16_t> ExternalData; |
1609 | 1618 |
1610 ExternalStringData<uint16_t>* external_data_; | 1619 private: |
| 1620 ExternalData* external_data_; |
1611 friend class Api; | 1621 friend class Api; |
1612 }; | 1622 }; |
1613 | 1623 |
1614 | 1624 |
1615 class RawBool : public RawInstance { | 1625 class RawBool : public RawInstance { |
1616 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool); | 1626 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool); |
1617 | 1627 |
1618 bool value_; | 1628 bool value_; |
1619 }; | 1629 }; |
1620 | 1630 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2126 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2117 kTypedDataInt8ArrayViewCid + 15); | 2127 kTypedDataInt8ArrayViewCid + 15); |
2118 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2128 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2119 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2129 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2120 return (kNullCid - kTypedDataInt8ArrayCid); | 2130 return (kNullCid - kTypedDataInt8ArrayCid); |
2121 } | 2131 } |
2122 | 2132 |
2123 } // namespace dart | 2133 } // namespace dart |
2124 | 2134 |
2125 #endif // VM_RAW_OBJECT_H_ | 2135 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |