summaryrefslogtreecommitdiff
path: root/third_party/base
AgeCommit message (Collapse)Author
2018-07-10Fix duplicate symbols in Chromium builds.Lei Zhang
Commit 43f6bc80 copied over Chromium's base/debug/alias.cc, but that confuses Windows builds and Linux jumbo builds in Chromium. To fix this, wrap PDFium's copy in the pdfium namespace. BUG=chromium:860850 TBR=dsinclair@chromium.org Change-Id: I1ceec28b9ce6c2893bf030a5b6564dce6d6ec376 Reviewed-on: https://pdfium-review.googlesource.com/37430 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-09Prevent FX_OutOfMemoryTerminate() from being folded by the linker.Lei Zhang
Copy base::debug::Alias() from Chromium. Use it to prevent ICF from combining FX_OutOfMemoryTerminate() with similar functions. BUG=chromium:860850 Change-Id: Ifccb05c0218f86e44b9bb235847e01383ec36b3f Reviewed-on: https://pdfium-review.googlesource.com/37290 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-02Add pdfium::Vector2D<>()Tom Sepez
Many of the FX_Alloc's that have not been converted to std::vector are using FX_Alloc2D and the safe math it performs under the covers. Make an equivalent function for returning a vector to avoid burdening callers with the safe math equivalents. Use it in one place. Change-Id: Ie4a280351b7370b755f2a1928f8b2d84fe007c03 Reviewed-on: https://pdfium-review.googlesource.com/36770 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-27Update third_party/base/template_util.h.Lei Zhang
Copy over Chromium's base/template_util.h from r538740. Change-Id: I7553570ef14dd5c803edbcd544b08c72b4f7123b Reviewed-on: https://pdfium-review.googlesource.com/34670 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-17Update third_party/base/compiler_specific.h.Lei Zhang
Import Chromium's base/compiler_specific.h from r537069. Now that FALLTHROUGH is available via compiler_specific.h, remove FX_FALLTHROUGH. Change-Id: I8b9631a4f007673e10e0c26951dfd61e9dcada30 Reviewed-on: https://pdfium-review.googlesource.com/32639 Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: 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-05-16Update third_party/base/bits.h.Lei Zhang
Pick up https://crrev.com/515947 and https://crrev.com/542972 Change-Id: Idccd388ee2f9cc71ace7ed5f598c820754e87b6e Reviewed-on: https://pdfium-review.googlesource.com/32631 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-11Fix issues with PDFium third_party/base/span.hTom Sepez
Remove stray const in operator[] that was introduced when downgrading from C++14 to C++11 syntax. Add missing Get() in first() that was introduced when converting to UnownedPtr. Prevent ASAN from flagging spans where the UnownedPtr points to byte N+1 of a N byte object, and the span is empty. This is legal in C for ordinary pointers so long as the pointer isn't de-referenced, but is not allowed per the rules for UnownedPtr. Change-Id: Ic143c5ef4e37c1cf86f0a3e5408be6e2076a85e2 Reviewed-on: https://pdfium-review.googlesource.com/30212 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-09Make pdfium::span<> be based off of UnownedPtr<>.Tom Sepez
Because we can get the lifetime check for free if we do this. This requires adding some "constexpr/noexcept" to UnownedPtr to make the types line up with what span.h requires. Change-Id: I45918f8723122082036eed959f769644ab4c509f Reviewed-on: https://pdfium-review.googlesource.com/29672 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-06Add span.h from chromium base.chromium/3392Tom Sepez
Allows indexing with better bounds-checking to occur. Some small modifications are required to deal with PDFium being intentionally held at C++11 compliance, not C++14. Use in one place as check on correctness. Change-Id: Id2875cf0a93980112bc536a93c4f9ec5306c0dac Reviewed-on: https://pdfium-review.googlesource.com/29671 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Chris Palmer <palmer@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-02Remove third_party/build/build_config.h.Lei Zhang
Use build/build_config.h instead. Having two build_config.h files is confusing. Change-Id: I4bd9c76ab6d913ee0aaa8b2f9c17b94bfba2d128 Reviewed-on: https://pdfium-review.googlesource.com/25111 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Chris Palmer <palmer@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-24Support compiling pdfium with emscripten.Henrique Nakashima
Bug: chromium:804907 Change-Id: I3562653fbc26d669d1e0a99894a69da032a0349e Reviewed-on: https://pdfium-review.googlesource.com/23810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-01-16Add support for pdfium use partitionalloc on loongson platform.Wang Qing
Because system pagesize is 4K on general system, such as x86 etc. But Loongson have 16K system pagesize and unable to print pages with use print preview. Therefore, the relevant pagesize places needs to be changed. Also refer to: https://chromium.googlesource.com/chromium/src/+/0752dbc988222d7edef2ef7c4e19555089c35fdf Bug: 801045 R= palmer@chromium.org Change-Id: Icc5ceae7b8a66be0ced1abb448a80c23fa518f34 Reviewed-on: https://pdfium-review.googlesource.com/22735 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-01-04Convert usages of pdfium::Optional to OptionalRyan Harrison
Change-Id: I29769f78eaad10c6a8b79e27524336c4f330377e Reviewed-on: https://pdfium-review.googlesource.com/22258 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-11-30Run clang-tidy modernize-use-nullptr on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md Bug: chromium:778942 Change-Id: I5d94299404647d231c0dc8ef8b75a6c0539f378c Reviewed-on: https://pdfium-review.googlesource.com/19972 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-30Run clang-tidy modernize-use-bool-literals on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md Bug: chromium:778955 Change-Id: Ib037ed749539e4380fb336fc6fa85648fc506118 Reviewed-on: https://pdfium-review.googlesource.com/19990 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Run clang-tidy modernize-use-auto on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md Bug: chromium:776257 Change-Id: I1f6637cde8b3e41825993a736bed6763dd7beacb Reviewed-on: https://pdfium-review.googlesource.com/19971 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Run clang-tidy modernize-use-equals-{delete,default} on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md In some cases the the tool leaves behind a string of commas where it replaced a member initializer list (https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with: git diff --name-only | \ xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/' Bug: chromium:778959, chromium:778957 Change-Id: I23e60d3d6c8bc9e8574d425710a0441cb5510d6b Reviewed-on: https://pdfium-review.googlesource.com/19970 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-07Fix PartitionAlloc cookies for small in-place reallocs.Lei Zhang
This ports the non-test portion of Chromium commit r514411 to PDFium. BUG=chromium:781473 Change-Id: Iab203edf3cb49a491aca5e524815a15e74f47581 Reviewed-on: https://pdfium-review.googlesource.com/17990 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Only use the yield instruction on architectures that support it.Andrew Weintraub
This is a downstream patch of https://crrev.com/502028. Change-Id: Ib78784093332a81a7afd6959c66f5e266540f6d3 Reviewed-on: https://pdfium-review.googlesource.com/17350 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Remove extraneous ;sDan Sinclair
Bug: pdfium:912 Change-Id: Iea61260ccc972627950b470a44ab21dbd2b4045b Reviewed-on: https://pdfium-review.googlesource.com/15170 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-27Enable PRINTF_FORMAT for clangDan Sinclair
This ports https://chromium-review.googlesource.com/c/chromium/src/+/599127 from Chromium to PDFium. Because VC++ does not have format-string checking for user-defined functions during normal compiles, because clang-cl had its format-string checking disabled, because some files are only compiled on Windows, and because VC++'s /analyze doesn't build all targets, and because VC++'s format-string checking is more lenient than clang's... 50 warnings about format-string mismatches crept in to Chromium's build. Seven of these were somewhat serious, with four being wchar_t*/char* mismatches because of base::FilePath and the other three being size_t/%d mismatches. Now that all of the mismatches are corrected this change enables PRINTF_FORMAT checking with clang-cl so that these bugs never return. Bug: pdfium:909 Change-Id: I683592f5015b31b4dd04dfe81e6866389b544efe Reviewed-on: https://pdfium-review.googlesource.com/14834 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-22Add pdfium::Optional to third_party/baseRyan Harrison
It is intended to use this class instead of the std::pair<bool, Foo*> pattern that has been used for guarded pointer returns in PDFium. Change-Id: Id3e305d6cdb329c84e1d827c855423d3efae42c0 Reviewed-on: https://pdfium-review.googlesource.com/11610 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-04-25Fix a self-inclusion in third_party/base/stl_util.h.Lei Zhang
Change-Id: I7a2fc956236005fca4848bd2be6db4585bc4e7d7 Reviewed-on: https://pdfium-review.googlesource.com/4477 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-20Take ContainsValue() change from base stl_util.hTom Sepez
Allows us to apply this same predicate onto ordinary arrays. Change-Id: I917be09ed5e55167657c9af97f45f2ea2dbc6ab4 Reviewed-on: https://pdfium-review.googlesource.com/4270 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-12Pull in the latest PartitionAlloc fixes from upstream.Chris Palmer
BUG=pdfium:691 Change-Id: If6f1e200e763827ec640b2b79171f3899ea7927e Reviewed-on: https://pdfium-review.googlesource.com/4050 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
2017-03-17Add pdfium::clamp() as a placeholder for std::clamp().chromium/3046Lei Zhang
Ue it to fix a typo as well. BUG=pdfium:634 Change-Id: I2d686242ffb841aedc2fae6a3cf7a00bea667404 Reviewed-on: https://pdfium-review.googlesource.com/3113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-16Import PartitionAlloc from Chromium.Chris Palmer
We'll add callers in a later CL. BUG=pdfium:678 Change-Id: I98c8b2832c4750df326218e24ee8c1bd33b89b50 Reviewed-on: https://pdfium-review.googlesource.com/3066 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-15Add IndexInBounds() convenience routine.Tom Sepez
Avoid writing |Type| in CollectionSize<Type>() so that index type can change without rewriting conditions. Change-Id: I40c94ca39148b379908760ba9b861114b88af7bb Reviewed-on: https://pdfium-review.googlesource.com/3056 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-01-23Update safe numerics package to get bitwise opstsepez
Fix callers conventions to avoid ambiguity. Fix bad bounds check unmasked by change. Directly include headers no longer pulled in by numerics itself. Review-Url: https://codereview.chromium.org/2640143003
2016-11-07Force compiler to deduce src type for checked_cast<dst, src>.tsepez
Otherwise, we might be silently doing an unsafe cast before applying the check if the actual argument doesn't match the exact src type. Review-Url: https://codereview.chromium.org/2484953003
2016-11-02Take more current safe_math_impl.h from upstream.chromium/2908tsepez
Corresponds to version dfd77a987650965071d0fddfbe0b806ce62ba337. Major change is to handle div by 0 without exceptions. Safe shift is not yet present. TBR=thestig@chromium.org TBR=jschuh@chromium.org Review-Url: https://codereview.chromium.org/2473513002
2016-10-21Fix some div by 0s in safe_math_impl.hchromium/2898tsepez
The majority of these are already upstream in base/, the remainder will need upstreaming. Also pull some upstream changes to reduce diffing. Upstream CL is https://codereview.chromium.org/2440143003/ BUG=657436 Review-Url: https://chromiumcodereview.appspot.com/2441753003
2016-10-03Add ptr_util.h from base until std::make_unique<> availabletsepez
Review-Url: https://codereview.chromium.org/2386273004
2016-09-12Make CFX_Obeservable::Observer into a pointer-ish type;tsepez
This may be a better design because it avoids having a level of indirection that the Observer required. Review-Url: https://codereview.chromium.org/2326763002
2016-08-19Introduce pdfium::FakeUniquePtr for keys to sets of unique ptrs.tsepez
Review-Url: https://codereview.chromium.org/2262473002
2016-03-22Re-enable MSVC warning 4702Wei Li
BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1821423002 .
2016-03-09Move ScopedSetInsertion to third_party/base/stl_util.hTom Sepez
Also move ScopedFileStream, since it isn't specific to the parser, and belongs with the fxcrt object it manipulates. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1780063003 .
2016-02-08Remove CFX_PtrArray from xfa/include/fwlTom Sepez
Fix IWYU in stl_util.h R=thestig@chromium.org Review URL: https://codereview.chromium.org/1672283002 .
2016-01-25Merge to XFA: Remove CFX_SegmentedArray use from master.Tom Sepez
Unfortunately, it is still used on the xfa/ side, so exclude it only for non-xfa builds. Original Review URL: https://codereview.chromium.org/1618273004 . (cherry picked from commit c64e4007ee4561ec2ed3ce986191caf9b024ef55) TBR=ochang@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1631863003 .
2015-12-24Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr.Lei Zhang
TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1547833002 . (cherry picked from commit d20dfba2ae10e8aeb328328f09da79ff904110a8) Review URL: https://codereview.chromium.org/1545183002 .
2015-12-22Merge to XFA: Start using allowed C++11 features.Lei Zhang
TBR=dml@google.com, thakis@chromium.org Review URL: https://codereview.chromium.org/1544923002 . Review URL: https://codereview.chromium.org/1545823002 . (cherry picked from commit ba2586d2c0a50df14aa2549a0a841e1d4b9af4b6) (cherry picked from commit 87f7d29531dabfd66e547a6be31a08272ff631d5) Review URL: https://codereview.chromium.org/1542213002 .
2015-12-22Merge to XFA: Add ContainsKey() and ContainsValue() and use them where ↵Lei Zhang
appropriate. TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1540263003 . (cherry picked from commit 1fc92867ca53f0fba4272fbee3814d844f487495) Review URL: https://codereview.chromium.org/1542193002 .
2015-12-09XFA: Fix win8 gn build under chromium checkout (non-xfa)Tom Sepez
The no nominmax config was lost when moving from master. Fix a few other small differences along the way, and fully conditionalize the build of tiff. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1514633002 .
2015-11-12Merge to XFA: Remove relative includes.Lei Zhang
That refer to parent directories. TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1434223002 . (cherry picked from commit 22bc4227fbbda5a5e9abad2a2c0a98c04fe7f228) Review URL: https://codereview.chromium.org/1439223003 .
2015-10-09Merge to XFA: Sanitize CJBig2_SymbolDict's memory usage.Lei Zhang
- Use std::vector<JBig2ArithCtx> instead of storing pointers to arrays. - Make CJBig2_SymbolDict's members private with accessors. - Use std::vector<JBig2ArithCtx> in related places. - Steal Chromium's vector_as_array() and use it as an adaptor as needed. BUG=514891 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1388203003 . (cherry picked from commit 3acb1ef909a22368507ed13817c4988c818e3aee) Review URL: https://codereview.chromium.org/1401533004 .
2015-09-22Merge to XFA: Change nonstd::unique_ptr to take a custom deleter.Lei Zhang
Code is mostly stolen from Chromium's scoped_ptr. - Add unit tests. - Use this to fix a leak. BUG=chromium:531408 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1351383004 . (cherry picked from commit cef2a9c51bee4b987fc813013d45dad6535a9a46) Review URL: https://codereview.chromium.org/1358163003 .
2015-09-22Merge to XFA: Add nonstd::unique_ptr move assigment operator.Tom Sepez
(cherry picked from commit dd7a7f012424ec8505830710ac0dd0183203c189) Original Review URL: https://codereview.chromium.org/1358163002 . TBR=jyasskin@chromium.org Review URL: https://codereview.chromium.org/1362763002 .
2015-09-17Merge to XFA: Fix a #include in fpdf_page_func.cpp.Lei Zhang
Not sure why building with gyp was working despite the missing '../' but it wasn't working in stricter build systems. TBR=dml@google.com Review URL: https://codereview.chromium.org/1321293003. (cherry picked from commit fa31d9630aadfe101d3b35e26ce0fc926ec1505b) Review URL: https://codereview.chromium.org/1345313003 .
2015-09-15Merge to XFA: Add move ctor to nonstd::unique_ptr.Tom Sepez
(cherry picked from commit ac8fda05418b7c96255d320fdec296935c552187) (cherry picked from commit 72d51871ae152163eeb9b005fd0a74d5c1651cd2) Original Review URL: https://codereview.chromium.org/1338383002 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1344873002 .