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 27 matching lines...) Expand all Loading... |
38 public: | 38 public: |
39 enum InitializationPolicy { | 39 enum InitializationPolicy { |
40 ZeroInitialize, | 40 ZeroInitialize, |
41 DontInitialize | 41 DontInitialize |
42 }; | 42 }; |
43 | 43 |
44 ArrayBufferContents(); | 44 ArrayBufferContents(); |
45 ArrayBufferContents(unsigned numElements, unsigned elementByteSize, ArrayBuf
ferContents::InitializationPolicy); | 45 ArrayBufferContents(unsigned numElements, unsigned elementByteSize, ArrayBuf
ferContents::InitializationPolicy); |
46 | 46 |
47 // Use with care. data must be allocated with allocateMemory. | 47 // Use with care. data must be allocated with allocateMemory. |
48 // ArrayBufferContents will take ownership of the data and free it (using fr
eeMemorY) | 48 // ArrayBufferContents will take ownership of the data and free it (using fr
eeMemory) |
49 // upon destruction. | 49 // upon destruction. |
50 // This constructor will not call observer->StartObserving(), so it is a res
ponsibility | 50 // This constructor will not call observer->StartObserving(), so it is a res
ponsibility |
51 // of the caller to make sure JS knows about external memory. | 51 // of the caller to make sure JS knows about external memory. |
52 ArrayBufferContents(void* data, unsigned sizeInBytes, ArrayBufferDeallocatio
nObserver*); | 52 ArrayBufferContents(void* data, unsigned sizeInBytes, ArrayBufferDeallocatio
nObserver*); |
53 | 53 |
54 ~ArrayBufferContents(); | 54 ~ArrayBufferContents(); |
55 | 55 |
56 void clear(); | 56 void clear(); |
57 | 57 |
58 void* data() const { return m_data; } | 58 void* data() const { return m_data; } |
(...skipping 15 matching lines...) Expand all Loading... |
74 | 74 |
75 private: | 75 private: |
76 void* m_data; | 76 void* m_data; |
77 unsigned m_sizeInBytes; | 77 unsigned m_sizeInBytes; |
78 ArrayBufferDeallocationObserver* m_deallocationObserver; | 78 ArrayBufferDeallocationObserver* m_deallocationObserver; |
79 }; | 79 }; |
80 | 80 |
81 } // namespace WTF | 81 } // namespace WTF |
82 | 82 |
83 #endif // ArrayBufferContents_h | 83 #endif // ArrayBufferContents_h |
OLD | NEW |