summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_memory.h
AgeCommit message (Collapse)Author
2018-10-17Fix the static initialization order problem for PartitionAlloc.Lei Zhang
Inside fx_memory.cpp, the PartitionAllocatorGeneric objects are globals, so their initialization order is not well defined. BUG=chromium:896117 Change-Id: If4a345d6d7549b0e99a055859eaa67d5ec32c788 Reviewed-on: https://pdfium-review.googlesource.com/c/44170 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Use PartitionAllocZeroFill in FX_SafeAlloc().Lei Zhang
Avoid a manual memset(). BUG=pdfium:1171 Change-Id: I4f7708d8ad75ca7fa697f69a24fa0de55286b5fa Reviewed-on: https://pdfium-review.googlesource.com/c/44075 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Kill off some memset()s following FX_Alloc()Tom Sepez
Change-Id: I92aa74c86aef890fcb991f039b9707d680fdb83c Reviewed-on: https://pdfium-review.googlesource.com/c/43652 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-25Add FxAlignToBoundary<>() template helper function.Tom Sepez
Because I nearly botched this trivial calculation in the previous CL. Change-Id: I7438f9d3476d93b7899c2d7d761234769f53f9e3 Reviewed-on: https://pdfium-review.googlesource.com/43010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-16Add support for PartionRealloc to return nullptrRyan Harrison
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>
2018-02-12Rearrange allocator functions to avoid unreachable codeDaniel Bratell
FX_AllocOrDie, FX_AllocOrDie2D and FX_ReallocOrDie contained unreachable code which in jumbo builds with some Visual Studio versions/configurations resulted in a compiler warning. By reordering the code, the unreachable code can be removed. Bug: pdfium:964 Change-Id: I8c040a31ea6af0ca896d8f68297e263719d6bdfa Reviewed-on: https://pdfium-review.googlesource.com/26190 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-03Remove flags param from FXMEM_DefaultAlloc() and friends.Lei Zhang
Change-Id: I24404be0065156a1cfdec31bafdf72c27fa70142 Reviewed-on: https://pdfium-review.googlesource.com/17792 Reviewed-by: Chris Palmer <palmer@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-31Remove fx_basic.hDan Sinclair
This CL removes the fx_basic.h header and fixes up includes as needed. Change-Id: I49af32a8327bdbcda40c50a61ffbd75d06609040 Reviewed-on: https://pdfium-review.googlesource.com/12670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-13Use PartitionAlloc with PartitionAllocReturnNullNicolas Pena
This CL changes usage of PartitionAlloc in fx_memory to allow null return value for methods used by external C libraries. Change-Id: I8e2b5dcfb37e30370606afb9a71a7a1d3a28c097 Reviewed-on: https://pdfium-review.googlesource.com/7770 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-07Convert c-style casts in fx_memory.h into static_castsRyan Harrison
Change-Id: I53da7a36ce8503abd99f2525e8a5b394ee547b47 Reviewed-on: https://pdfium-review.googlesource.com/7353 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-06-22Add a |gGeneralPartitionAllocator| and use it in the |FX_*Alloc| wrappers.chromium/3142chromium/3141chromium/3140chromium/3139Chris Palmer
BUG=pdfium:690 Change-Id: I922279e4bdc8b411f47f49798155e8f9118c1396 Reviewed-on: https://pdfium-review.googlesource.com/6552 Commit-Queue: Chris Palmer <palmer@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-11Fixup Initialize spellingchromium/3097Dan Sinclair
Change-Id: Ibd8d70264d79afc0baabaa5093aceb21ee777196 Reviewed-on: https://pdfium-review.googlesource.com/5334 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-18Libtiff upstream: _TIFFcalloc additionNicolas Pena
Upstream commit: https://github.com/vadz/libtiff/commit/d60332057b9575ada4f264489582b13e30137be1 Bug: chromium:711638 Change-Id: I46de1a00f9bb8d5de8df64ec78a9d62dcb4352ed Reviewed-on: https://pdfium-review.googlesource.com/4310 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Fix unit tests to initialize PartitionAlloc.Chris Palmer
Tests need to be subclasses of FPDF_Test. BUG=pdfium:700 Change-Id: I317ec2c49567e58cb57c6222e387574226f594b3 Reviewed-on: https://pdfium-review.googlesource.com/3890 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
2017-03-26Use PartitionAlloc for JavaScript ArrayBuffers and strings.Chris Palmer
BUG=pdfium:681 Change-Id: I5073d80d9bd623b73e578d5ba2226c39c371bab0 Reviewed-on: https://pdfium-review.googlesource.com/3097 Commit-Queue: Chris Palmer <palmer@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-10-03Add ptr_util.h from base until std::make_unique<> availabletsepez
Review-Url: https://codereview.chromium.org/2386273004
2016-09-29Move core/fxcrt/include to core/fxcrtdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2382723003