| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 if (!other.m_data) | 97 if (!other.m_data) |
| 98 return; | 98 return; |
| 99 memcpy(other.m_data, m_data, m_sizeInBytes); | 99 memcpy(other.m_data, m_data, m_sizeInBytes); |
| 100 other.m_sizeInBytes = m_sizeInBytes; | 100 other.m_sizeInBytes = m_sizeInBytes; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void ArrayBufferContents::allocateMemory(size_t size, InitializationPolicy polic
y, void*& data) | 103 void ArrayBufferContents::allocateMemory(size_t size, InitializationPolicy polic
y, void*& data) |
| 104 { | 104 { |
| 105 if (s_adjustAmountOfExternalAllocatedMemoryFunction) | 105 if (s_adjustAmountOfExternalAllocatedMemoryFunction) |
| 106 s_adjustAmountOfExternalAllocatedMemoryFunction(static_cast<int>(size)); | 106 s_adjustAmountOfExternalAllocatedMemoryFunction(static_cast<int>(size)); |
| 107 data = partitionAllocGenericFlags(WTF::Partitions::getBufferPartition(), Par
titionAllocReturnNull, size); | 107 data = partitionAllocGenericFlags(WTF::Partitions::bufferPartition(), Partit
ionAllocReturnNull, size); |
| 108 if (policy == ZeroInitialize && data) | 108 if (policy == ZeroInitialize && data) |
| 109 memset(data, '\0', size); | 109 memset(data, '\0', size); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void ArrayBufferContents::freeMemory(void* data, size_t size) | 112 void ArrayBufferContents::freeMemory(void* data, size_t size) |
| 113 { | 113 { |
| 114 partitionFreeGeneric(WTF::Partitions::getBufferPartition(), data); | 114 partitionFreeGeneric(WTF::Partitions::bufferPartition(), data); |
| 115 if (s_adjustAmountOfExternalAllocatedMemoryFunction) | 115 if (s_adjustAmountOfExternalAllocatedMemoryFunction) |
| 116 s_adjustAmountOfExternalAllocatedMemoryFunction(-static_cast<int>(size))
; | 116 s_adjustAmountOfExternalAllocatedMemoryFunction(-static_cast<int>(size))
; |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace WTF | 119 } // namespace WTF |
| OLD | NEW |