| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 void* data() const { return m_holder ? m_holder->data() : nullptr; } | 66 void* data() const { return m_holder ? m_holder->data() : nullptr; } |
| 67 unsigned sizeInBytes() const { return m_holder ? m_holder->sizeInBytes() : 0
; } | 67 unsigned sizeInBytes() const { return m_holder ? m_holder->sizeInBytes() : 0
; } |
| 68 bool isShared() const { return m_holder ? m_holder->isShared() : false; } | 68 bool isShared() const { return m_holder ? m_holder->isShared() : false; } |
| 69 | 69 |
| 70 void transfer(ArrayBufferContents& other); | 70 void transfer(ArrayBufferContents& other); |
| 71 void shareWith(ArrayBufferContents& other); | 71 void shareWith(ArrayBufferContents& other); |
| 72 void copyTo(ArrayBufferContents& other); | 72 void copyTo(ArrayBufferContents& other); |
| 73 | 73 |
| 74 static void allocateMemory(size_t, InitializationPolicy, void*&); | 74 static void allocateMemory(size_t, InitializationPolicy, void*&); |
| 75 static void allocateMemoryOrNull(size_t, InitializationPolicy, void*&); |
| 75 static void freeMemory(void*, size_t); | 76 static void freeMemory(void*, size_t); |
| 76 static void setAdjustAmoutOfExternalAllocatedMemoryFunction(AdjustAmountOfEx
ternalAllocatedMemoryFunction function) | 77 static void setAdjustAmoutOfExternalAllocatedMemoryFunction(AdjustAmountOfEx
ternalAllocatedMemoryFunction function) |
| 77 { | 78 { |
| 78 ASSERT(!s_adjustAmountOfExternalAllocatedMemoryFunction); | 79 ASSERT(!s_adjustAmountOfExternalAllocatedMemoryFunction); |
| 79 s_adjustAmountOfExternalAllocatedMemoryFunction = function; | 80 s_adjustAmountOfExternalAllocatedMemoryFunction = function; |
| 80 } | 81 } |
| 81 | 82 |
| 82 private: | 83 private: |
| 83 class DataHolder : public ThreadSafeRefCounted<DataHolder> { | 84 class DataHolder : public ThreadSafeRefCounted<DataHolder> { |
| 84 WTF_MAKE_NONCOPYABLE(DataHolder); | 85 WTF_MAKE_NONCOPYABLE(DataHolder); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 100 SharingType m_isShared; | 101 SharingType m_isShared; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 RefPtr<DataHolder> m_holder; | 104 RefPtr<DataHolder> m_holder; |
| 104 static AdjustAmountOfExternalAllocatedMemoryFunction s_adjustAmountOfExterna
lAllocatedMemoryFunction; | 105 static AdjustAmountOfExternalAllocatedMemoryFunction s_adjustAmountOfExterna
lAllocatedMemoryFunction; |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 } // namespace WTF | 108 } // namespace WTF |
| 108 | 109 |
| 109 #endif // ArrayBufferContents_h | 110 #endif // ArrayBufferContents_h |
| OLD | NEW |