Extract the fibonacci progression block size calculation.
Simplify it by using a common array for the fibonacci number.
Add unit tests to check extreme limits.
Change-Id: I270a713881590f7e17be58dc9072ab7a79a7388d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345124
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
There's no reason to use std::aligned_storage when it's simpler to use
an array and alignas(). This way you don't have to remember whether the
template arguments are size-then-align or align-then-size, you don't
have to remember to use the _t variant or typename ... ::type, and
there's no risk to forgetting the alignment parameter entirely.
It doesn't look like this was deprecated, but I still think this paper
makes good arguments for why we shouldn't use it:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1413r1.pdf
Bug: skia:10921
Change-Id: Ia64a2e43c4cba9b4d64138a7474e353a8eaf01a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333258
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
SkArenaAlloc has three fields that are used only for reset. Make a
subclass called SkArenaAllocWithReset which has the three
fields, and has the reset functionality.
An example of a reset() that is used instead of using a better scope
is PathOpsAngleAfter in PathOpsAngleTest.cpp.
Change-Id: Ie1965d128dfb7df9e022f4d18460d3f75f33e1a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307348
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).
Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Generate an array with initialized values based on
a function of the index.
Change-Id: I1d7d83ba9cacde47b8c736f26dedc15294929937
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289489
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This partially undoes 774168efac "Allow
CCPR in DDL mode (take 2)". The issue appears to have been the use of a
not fully defined type (destructor could not be instantiated) because
the private fields were also dllexported, requiring the destructors to
exist in all translation units which included the header. Only the parts
of the class which are actually public are now marked as exported.
Change-Id: I8a79bd5d8962e94c24f7563d496744bb278153fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214020
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Current strategy: everything from the top
Things to look at first are the manual changes:
- added tools/rewrite_includes.py
- removed -Idirectives from BUILD.gn
- various compile.sh simplifications
- tweak tools/embed_resources.py
- update gn/find_headers.py to write paths from the top
- update gn/gn_to_bp.py SkUserConfig.h layout
so that #include "include/config/SkUserConfig.h" always
gets the header we want.
No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
I'm looking at making SkArenaAlloc independent of Skia.
Here's a bit of low-hanging fruit.
Nothing is using makeSkSp(). Good... it seems real dangerous.
Change-Id: Ib7154e7948a3c6d828376ef37935636b3b4695ff
Reviewed-on: https://skia-review.googlesource.com/132824
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
This reverts commit 0bc4d60fe0.
Reason for revert: https://chromium-swarm.appspot.com/task?id=38007b6df51fef10&refresh=10
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Caught signal 6 [Aborted], was running:
8888 image scanline_kNonNative_premul interlaced3.png
unit test ArenaAllocReallyBigAlloc
unit test ClampRange
565 image scaled_codec_premul_0.200 interlaced3.png_0.200
unit test ClipStack
Likely culprit:
unit test ArenaAllocReallyBigAlloc
Stack trace:
/mnt/pd0/s/w/ir/out/Debug/dm(+0x2381c1) [0x567aa1c1]
linux-gate.so.1(__kernel_sigreturn+0) [0xf770cca0]
linux-gate.so.1(__kernel_vsyscall+0x9) [0xf770cc89]
/lib/i386-linux-gnu/libc.so.6(gsignal+0xb0) [0xf7027dc0]
/lib/i386-linux-gnu/libc.so.6(abort+0x157) [0xf7029287]
/usr/lib/i386-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x16f) [0xf729d2ff]
/usr/lib/i386-linux-gnu/libstdc++.so.6(+0x71ea4) [0xf729aea4]
/usr/lib/i386-linux-gnu/libstdc++.so.6(+0x71f1d) [0xf729af1d]
/usr/lib/i386-linux-gnu/libstdc++.so.6(__cxa_rethrow+0) [0xf729b1d0]
/usr/lib/i386-linux-gnu/libstdc++.so.6(+0x727ff) [0xf729b7ff]
/usr/lib/i386-linux-gnu/libstdc++.so.6(_Znaj+0x18) [0xf729b898]
/mnt/pd0/s/w/ir/out/Debug/dm(_ZN12SkArenaAlloc11ensureSpaceEjj+0xa0) [0x56f113a6]
/mnt/pd0/s/w/ir/out/Debug/dm(+0x3c2462) [0x56934462]
/mnt/pd0/s/w/ir/out/Debug/dm(+0x239acb) [0x567abacb]
/mnt/pd0/s/w/ir/out/Debug/dm(+0x239bdc) [0x567abbdc]
/mnt/pd0/s/w/ir/out/Debug/dm(+0xa6417b) [0x56fd617b]
/mnt/pd0/s/w/ir/out/Debug/dm(_ZNKSt8functionIFvvEEclEv+0x20) [0x56f10504]
/mnt/pd0/s/w/ir/out/Debug/dm(_ZN12SkThreadPool4LoopEPv+0x298) [0x56f10bdb]
/mnt/pd0/s/w/ir/out/Debug/dm(+0xb39700) [0x570ab700]
/lib/i386-linux-gnu/libpthread.so.0(+0x627a) [0xf76df27a]
/lib/i386-linux-gnu/libc.so.6(clone+0x66) [0xf70e3b56]
Aborted
Command exited with code 134
Original change's description:
> Fix bogus math in object allocation.
>
> When a size_t is convert from a very large number to ptrdiff_t, it
> becomes negative causing the existing block to be used instead of
> allocating a new block.
>
> BUG=chromium:744109
>
> Change-Id: I0bf98e3fb924851c162f6eca43d29a3f40dc9eaa
> Reviewed-on: https://skia-review.googlesource.com/34541
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
TBR=bungeman@google.com,herb@google.com
Change-Id: I8ce2b45d13178395247dabd7af6853354399721c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:744109
Reviewed-on: https://skia-review.googlesource.com/35000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
When a size_t is convert from a very large number to ptrdiff_t, it
becomes negative causing the existing block to be used instead of
allocating a new block.
BUG=chromium:744109
Change-Id: I0bf98e3fb924851c162f6eca43d29a3f40dc9eaa
Reviewed-on: https://skia-review.googlesource.com/34541
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Make the constructors for SkArenaAlloc unambiguous.
TBR=mtklein@google.com
Change-Id: Iaa6419574e78e17bf746f5f9bcdf99c9d6c9d727
Reviewed-on: https://skia-review.googlesource.com/13540
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
* Reset the Arena state.
* Call all the dtors before deleting the blocks.
Change-Id: I6d90463966ac7bf9f0a4fda229f67d508c86bebb
Reviewed-on: https://skia-review.googlesource.com/7308
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
* Reset the Arena state.
* Call all the dtors before deleting the blocks.
TBR=mtklein@google.com
Change-Id: Iac320fec16e572cc9a6184c1f580089ab720f036
Reviewed-on: https://skia-review.googlesource.com/7221
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>