OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 unsigned byteOffset() const | 66 unsigned byteOffset() const |
67 { | 67 { |
68 return m_byteOffset; | 68 return m_byteOffset; |
69 } | 69 } |
70 | 70 |
71 virtual unsigned byteLength() const = 0; | 71 virtual unsigned byteLength() const = 0; |
72 | 72 |
73 void setNeuterable(bool flag) { m_isNeuterable = flag; } | 73 void setNeuterable(bool flag) { m_isNeuterable = flag; } |
74 bool isNeuterable() const { return m_isNeuterable; } | 74 bool isNeuterable() const { return m_isNeuterable; } |
| 75 bool isShared() const { return m_buffer ? m_buffer->isShared() : false; } |
75 | 76 |
76 virtual ~ArrayBufferView(); | 77 virtual ~ArrayBufferView(); |
77 | 78 |
78 protected: | 79 protected: |
79 ArrayBufferView(PassRefPtr<ArrayBuffer>, unsigned byteOffset); | 80 ArrayBufferView(PassRefPtr<ArrayBuffer>, unsigned byteOffset); |
80 | 81 |
81 inline bool setImpl(ArrayBufferView*, unsigned byteOffset); | 82 inline bool setImpl(ArrayBufferView*, unsigned byteOffset); |
82 | 83 |
83 // Helper to verify that a given sub-range of an ArrayBuffer is | 84 // Helper to verify that a given sub-range of an ArrayBuffer is |
84 // within range. | 85 // within range. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 char* base = static_cast<char*>(baseAddress()); | 127 char* base = static_cast<char*>(baseAddress()); |
127 memmove(base + byteOffset, array->baseAddress(), array->byteLength()); | 128 memmove(base + byteOffset, array->baseAddress(), array->byteLength()); |
128 return true; | 129 return true; |
129 } | 130 } |
130 | 131 |
131 } // namespace WTF | 132 } // namespace WTF |
132 | 133 |
133 using WTF::ArrayBufferView; | 134 using WTF::ArrayBufferView; |
134 | 135 |
135 #endif // ArrayBufferView_h | 136 #endif // ArrayBufferView_h |
OLD | NEW |