OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef FlexibleArrayBufferView_h | 5 #ifndef FlexibleArrayBufferView_h |
6 #define FlexibleArrayBufferView_h | 6 #define FlexibleArrayBufferView_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/dom/DOMArrayBufferView.h" | 9 #include "core/dom/DOMArrayBufferView.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 void clear() { | 28 void clear() { |
29 m_full = nullptr; | 29 m_full = nullptr; |
30 m_smallData = nullptr; | 30 m_smallData = nullptr; |
31 m_smallLength = 0; | 31 m_smallLength = 0; |
32 } | 32 } |
33 | 33 |
34 bool isEmpty() const { return !m_full && !m_smallData; } | 34 bool isEmpty() const { return !m_full && !m_smallData; } |
35 bool isFull() const { return m_full; } | 35 bool isFull() const { return m_full; } |
| 36 bool isShared() const { return m_full && m_full->isShared(); } |
36 | 37 |
37 DOMArrayBufferView* full() const { | 38 DOMArrayBufferView* full() const { |
38 DCHECK(isFull()); | 39 DCHECK(isFull()); |
39 return m_full; | 40 return m_full; |
40 } | 41 } |
41 | 42 |
42 // WARNING: The pointer returned by baseAddressMaybeOnStack() may point to | 43 // WARNING: The pointer returned by baseAddressMaybeOnStack() may point to |
43 // temporary storage that is only valid during the life-time of the | 44 // temporary storage that is only valid during the life-time of the |
44 // FlexibleArrayBufferView object. | 45 // FlexibleArrayBufferView object. |
45 void* baseAddressMaybeOnStack() const { | 46 void* baseAddressMaybeOnStack() const { |
(...skipping 16 matching lines...) Expand all Loading... |
62 private: | 63 private: |
63 Member<DOMArrayBufferView> m_full; | 64 Member<DOMArrayBufferView> m_full; |
64 | 65 |
65 void* m_smallData; | 66 void* m_smallData; |
66 size_t m_smallLength; | 67 size_t m_smallLength; |
67 }; | 68 }; |
68 | 69 |
69 } // namespace blink | 70 } // namespace blink |
70 | 71 |
71 #endif // FlexibleArrayBufferView_h | 72 #endif // FlexibleArrayBufferView_h |
OLD | NEW |