summaryrefslogtreecommitdiff
path: root/third_party/base/allocator/partition_allocator/partition_alloc.h
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-05-16 19:19:22 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-16 19:19:22 +0000
commit98ec53359b8e61e717440f280d3fcc101fe140bb (patch)
tree013925477fa27d2e1077ceaebab5fdf1ee6432e3 /third_party/base/allocator/partition_allocator/partition_alloc.h
parentcda8e00478e97f005fc1d22bc01af7818e6f5101 (diff)
downloadpdfium-98ec53359b8e61e717440f280d3fcc101fe140bb.tar.xz
Add support for PartionRealloc to return nullptr
Currently the PartitionRealloc code path will only exit, with no option to return nullptr on failure, unlike PartitionAlloc code path. This CL refactors the realloc code path to be similar to alloc code path, following the upstream patch: https://chromium-review.googlesource.com/c/chromium/src/+/1044971 This also changes the version of realloc exposed to third party C libs to have the nullptr behaviour, like the exposed version of alloc. This CL is a redo of https://pdfium-review.googlesource.com/c/pdfium/+/31990 BUG=chromium:783022 Change-Id: Ib1b659079585dfd0423d683b8a2c7b6758a22a01 Reviewed-on: https://pdfium-review.googlesource.com/32613 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Chris Palmer <palmer@chromium.org>
Diffstat (limited to 'third_party/base/allocator/partition_allocator/partition_alloc.h')
-rw-r--r--third_party/base/allocator/partition_allocator/partition_alloc.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc.h b/third_party/base/allocator/partition_allocator/partition_alloc.h
index 87db329af2..69fba97d62 100644
--- a/third_party/base/allocator/partition_allocator/partition_alloc.h
+++ b/third_party/base/allocator/partition_allocator/partition_alloc.h
@@ -432,9 +432,15 @@ BASE_EXPORT NOINLINE void* PartitionAllocSlowPath(PartitionRootBase*,
size_t,
PartitionBucket*);
BASE_EXPORT NOINLINE void PartitionFreeSlowPath(PartitionPage*);
-BASE_EXPORT NOINLINE void* PartitionReallocGeneric(PartitionRootGeneric*,
- void*,
- size_t,
+BASE_EXPORT NOINLINE void* PartitionReallocGenericFlags(
+ PartitionRootGeneric* root,
+ int flags,
+ void* ptr,
+ size_t new_size,
+ const char* type_name);
+BASE_EXPORT NOINLINE void* PartitionReallocGeneric(PartitionRootGeneric* root,
+ void* ptr,
+ size_t new_size,
const char* type_name);
BASE_EXPORT void PartitionDumpStats(PartitionRoot*,