skia2/include/private
Benoît Lizé 916351bd6e [core] Allow SkArenaAlloc to query malloc() for usable size
When allocating memory with malloc(), allocators can provide a larger
size than requested. SkArenaAlloc tries to guess what jemalloc would
return, and align its allocation requests on the to-be-provided
size. Some platforms (e.g. glibc or bionic with malloc_usable_size(),
macOS with malloc_size()) can provide the actual value.

This CL adds support to skia's malloc() wrappers to get this data, and
to SkArenaAlloc to use it. Note that as is, this is a no-op in skia
proper. Indeed, clients can (and do, for instance Chromium does)
override sk_malloc() (and friends), so Skia cannot assume that
sk_malloc() memory comes from malloc().

To implement this, a client needs to override sk_malloc_usable_size() to
return the actual value.

Bug: chromium:1335342
Change-Id: Id8ea177e9adccc9c4446fe379b6f05e726ea07ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549516
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2022-07-12 16:08:14 +00:00
..
chromium Add StrikePinner::assertValid() to diagnose cache missing problem 2022-07-01 13:01:21 +00:00
gpu Replace SK_ARRAY_COUNT with std::size() for skia/src/gpu 2022-06-29 15:57:58 +00:00
BUILD.bazel [bazel] Add "skia_internal" target that exposes private API for tests/tools. 2022-06-02 11:23:50 +00:00
OWNERS Reland "Add OWNERS to include (and include/private) to enforce API review" 2021-09-27 18:20:19 +00:00
SingleOwner.h [graphite] Add basic stubs for ResourceCache. 2022-02-04 19:25:11 +00:00
SkBitmaskEnum.h Fix modifier key handling in OS X to allow command-keys to work. 2020-07-01 16:07:03 +00:00
SkChecksum.h Add std::string/string_view support to SkGoodHash. 2022-03-03 18:09:00 +00:00
SkColorData.h Convert color data to skvx::float4 from Sk4f 2022-05-19 19:45:23 +00:00
SkDeque.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkEncodedInfo.h Make copy of skcms checkout in //modules/skcms 2022-06-30 12:05:13 +00:00
SkFixed.h move SkTPin to include/private 2020-10-16 19:45:11 +00:00
SkFloatBits.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFloatingPoint.h Remove old sk_float_rsqrt_portable code 2022-03-23 13:14:09 +00:00
SkHalf.h Convert color data to skvx::float4 from Sk4f 2022-05-19 19:45:23 +00:00
SkIDChangeListener.h Remove bug-prone SkIDChangeListener singleThreaded arg 2021-02-26 17:05:53 +00:00
SkImageInfoPriv.h Reland "Add kR8_unorm_SkColorType" 2022-02-10 18:00:19 +00:00
SkMacros.h Add 'packed' to description of SK_BEGIN_REQUIRE_DENSE. 2022-06-15 22:59:43 +00:00
SkMalloc.h [core] Allow SkArenaAlloc to query malloc() for usable size 2022-07-12 16:08:14 +00:00
SkMutex.h Assert in ~SkMutex that the mutex is unowned. 2022-02-14 15:23:12 +00:00
SkNoncopyable.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkOnce.h experimental support for go/fibers 2019-10-28 16:48:55 +00:00
SkOpts_spi.h Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
SkPathRef.h Reland "[includes] Remove include link between SkPathRef.h and SkRRect.h" 2022-03-07 15:15:05 +00:00
SkSafe32.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkSafe_math.h Guard against buggy ucrt\math.h. 2016-11-28 15:40:23 +00:00
SkSemaphore.h Reland "Cache hb_face." 2020-05-19 17:42:14 +00:00
SkShadowFlags.h Add ShadowFlag to use only blurs for concave shapes. 2022-04-27 18:02:26 +00:00
SkSLDefines.h Add ExpressionArray::clone. 2022-01-24 14:25:46 +00:00
SkSLIRNode.h Switched SkSL positions from int to Position 2022-03-14 17:06:17 +00:00
SkSLLayout.h Remove no-op versions of skstd::to_string. 2022-02-03 22:33:41 +00:00
SkSLModifiers.h Added threadgroup modifier to compute shaders 2022-06-29 18:06:28 +00:00
SkSLProgramElement.h Switched SkSL positions from int to Position 2022-03-14 17:06:17 +00:00
SkSLProgramKind.h Added preliminary SkSL Metal compute shader support 2022-06-15 18:52:42 +00:00
SkSLSampleUsage.h Use varyings to implement MatrixEffects applied to DeviceCoord FPs. 2021-08-02 19:39:13 +00:00
SkSLStatement.h Remove InlineMarker IR node. 2022-04-29 17:40:58 +00:00
SkSLString.h [includes] Enforce IWYU on sksl code 2022-03-21 12:43:02 +00:00
SkSLSymbol.h Switched SkSL positions from int to Position 2022-03-14 17:06:17 +00:00
SkSpinlock.h Add thread safety annotations. 2019-05-10 13:40:38 +00:00
SkStringView.h Remove skstd::string_view entirely. 2022-02-01 21:16:41 +00:00
SkTArray.h Disable the CFI sanitizer only when casting pointers. 2022-06-01 15:10:35 +00:00
SkTDArray.h Add SkPaintParamsKey::Header structure. 2022-06-16 17:51:10 +00:00
SkTemplates.h Remove static from template functions in headers. 2022-02-08 20:17:04 +00:00
SkTFitsIn.h Add support for MSVC run-time checks (and control flow guard) 2019-02-04 20:55:24 +00:00
SkTHash.h Use SkTHashMap for the MetalCodeGenerator. 2022-03-04 19:01:18 +00:00
SkThreadAnnotations.h Update Google3 thread annotations. 2022-02-09 15:47:22 +00:00
SkThreadID.h Mark SkGetThreadID SK_SPI in debug. 2020-07-07 21:50:55 +00:00
SkTLogic.h Remove skstd::size and skstd::data. 2022-02-03 20:47:16 +00:00
SkTo.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkTPin.h switch SkTPin impl to pin NaN to lo 2020-10-16 21:08:51 +00:00
SkUniquePaintParamsID.h [graphite] Move ShaderCodeDictionary, SkPaintParamsKey, and UniquePaintParamsID to include/private 2022-01-13 14:22:11 +00:00
SkVx.h Remove unchecked_bit_puns. 2022-06-28 19:24:19 +00:00
SkWeakRefCnt.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00