OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 ~DataHolder(); | 87 ~DataHolder(); |
88 | 88 |
89 void allocateNew(unsigned sizeInBytes, SharingType isShared, Initializat
ionPolicy); | 89 void allocateNew(unsigned sizeInBytes, SharingType isShared, Initializat
ionPolicy); |
90 void adopt(void* data, unsigned sizeInBytes, SharingType isShared); | 90 void adopt(void* data, unsigned sizeInBytes, SharingType isShared); |
91 void copyMemoryTo(DataHolder& other); | 91 void copyMemoryTo(DataHolder& other); |
92 | 92 |
93 void* data() const { return m_data; } | 93 void* data() const { return m_data; } |
94 unsigned sizeInBytes() const { return m_sizeInBytes; } | 94 unsigned sizeInBytes() const { return m_sizeInBytes; } |
95 bool isShared() const { return m_isShared == Shared; } | 95 bool isShared() const { return m_isShared == Shared; } |
96 | 96 |
| 97 void setAllocated(bool allocate) { m_malloc = allocate; } |
| 98 bool isAllocated() const { return m_malloc; } |
| 99 |
97 private: | 100 private: |
98 void* m_data; | 101 void* m_data; |
| 102 bool m_malloc; |
99 unsigned m_sizeInBytes; | 103 unsigned m_sizeInBytes; |
100 SharingType m_isShared; | 104 SharingType m_isShared; |
101 }; | 105 }; |
102 | 106 |
103 RefPtr<DataHolder> m_holder; | 107 RefPtr<DataHolder> m_holder; |
104 static AdjustAmountOfExternalAllocatedMemoryFunction s_adjustAmountOfExterna
lAllocatedMemoryFunction; | 108 static AdjustAmountOfExternalAllocatedMemoryFunction s_adjustAmountOfExterna
lAllocatedMemoryFunction; |
105 }; | 109 }; |
106 | 110 |
107 } // namespace WTF | 111 } // namespace WTF |
108 | 112 |
109 #endif // ArrayBufferContents_h | 113 #endif // ArrayBufferContents_h |
OLD | NEW |