Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 { | 736 { |
| 737 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 737 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| 738 void* result = malloc(size); | 738 void* result = malloc(size); |
| 739 RELEASE_ASSERT(result); | 739 RELEASE_ASSERT(result); |
| 740 return result; | 740 return result; |
| 741 #else | 741 #else |
| 742 ASSERT(root->initialized); | 742 ASSERT(root->initialized); |
| 743 size_t requestedSize = size; | 743 size_t requestedSize = size; |
| 744 size = partitionCookieSizeAdjustAdd(size); | 744 size = partitionCookieSizeAdjustAdd(size); |
| 745 PartitionBucket* bucket = partitionGenericSizeToBucket(root, size); | 745 PartitionBucket* bucket = partitionGenericSizeToBucket(root, size); |
| 746 // TODO(bashi): Remove following RELEAE_ASSERT()s once we find the cause of | |
| 747 // http://crbug.com/514141 | |
| 748 #if OS(ANDROID) | |
| 749 RELEASE_ASSERT(bucket >= &root->buckets[0] || bucket == &PartitionRootGeneri c::gPagedBucket); | |
|
bashi
2015/11/06 10:01:25
bucket can be &PartitionRootGeneric::gPageBucket
| |
| 750 RELEASE_ASSERT(bucket <= &root->buckets[kGenericNumBuckets - 1] || bucket == &PartitionRootGeneric::gPagedBucket); | |
| 751 #endif | |
| 746 spinLockLock(&root->lock); | 752 spinLockLock(&root->lock); |
| 747 void* ret = partitionBucketAlloc(root, flags, size, bucket); | 753 void* ret = partitionBucketAlloc(root, flags, size, bucket); |
| 748 spinLockUnlock(&root->lock); | 754 spinLockUnlock(&root->lock); |
| 749 PartitionAllocHooks::allocationHookIfEnabled(ret, requestedSize); | 755 PartitionAllocHooks::allocationHookIfEnabled(ret, requestedSize); |
| 750 return ret; | 756 return ret; |
| 751 #endif | 757 #endif |
| 752 } | 758 } |
| 753 | 759 |
| 754 ALWAYS_INLINE void* partitionAllocGeneric(PartitionRootGeneric* root, size_t siz e) | 760 ALWAYS_INLINE void* partitionAllocGeneric(PartitionRootGeneric* root, size_t siz e) |
| 755 { | 761 { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 using WTF::partitionAlloc; | 867 using WTF::partitionAlloc; |
| 862 using WTF::partitionFree; | 868 using WTF::partitionFree; |
| 863 using WTF::partitionAllocGeneric; | 869 using WTF::partitionAllocGeneric; |
| 864 using WTF::partitionFreeGeneric; | 870 using WTF::partitionFreeGeneric; |
| 865 using WTF::partitionReallocGeneric; | 871 using WTF::partitionReallocGeneric; |
| 866 using WTF::partitionAllocActualSize; | 872 using WTF::partitionAllocActualSize; |
| 867 using WTF::partitionAllocSupportsGetSize; | 873 using WTF::partitionAllocSupportsGetSize; |
| 868 using WTF::partitionAllocGetSize; | 874 using WTF::partitionAllocGetSize; |
| 869 | 875 |
| 870 #endif // WTF_PartitionAlloc_h | 876 #endif // WTF_PartitionAlloc_h |
| OLD | NEW |