aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDrawLooper.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-11-09 14:50:31 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-11-09 14:50:31 -0800
commit7c591161d021b7b0f04f9607a196113cdfd9916f (patch)
tree2ba8403c0655f168004bffbac49d76a4ecdfc689 /src/core/SkDrawLooper.cpp
parent27dcee1643b3b783ca0b2312e21f40f3766bd213 (diff)
Revert of Make SkSmallAllocator obey the RAII invariants and be expandable (patchset #6 id:100001 of https://codereview.chromium.org/2488523003/ )
Reason for revert: Crashing Mac Perf and Test bots. This is a flaky but extremely likely crash. I've only seen one Mac Perf or Test bot that had this patch that didn't crash. This should be easy to reproduce like this: $ gn gen out --args=is_debug=false $ ninja -C out dm $ out/dm -m xfermodes3 --config gpu This is crashing every time I run it on my laptop, and never when I revert this CL. Building in release and running --config gpu probably don't matter. Original issue's description: > Make SkSmallAllocator obey the RAII invariants and move to heap structures when needed. > > The biggest change is to the API which allowed code to bypass the > destruction invariants. This destruction bypass feature was needed in > only one use, and is totally encapsulated using createWithIniterT. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2488523003 > > Committed: https://skia.googlesource.com/skia/+/d5dc657b8c3ac916f98005dafdedafe02f023449 TBR=bungeman@google.com,herb@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2485853005
Diffstat (limited to 'src/core/SkDrawLooper.cpp')
-rw-r--r--src/core/SkDrawLooper.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/core/SkDrawLooper.cpp b/src/core/SkDrawLooper.cpp
index 4f495a71df..aa53f2e3a1 100644
--- a/src/core/SkDrawLooper.cpp
+++ b/src/core/SkDrawLooper.cpp
@@ -15,12 +15,9 @@
bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) const {
SkCanvas canvas;
SkSmallAllocator<1, 32> allocator;
+ void* buffer = allocator.reserveT<SkDrawLooper::Context>(this->contextSize());
- SkDrawLooper::Context* context = allocator.createWithIniterT<SkDrawLooper::Context>(
- this->contextSize(),
- [&](void* buffer) {
- return this->createContext(&canvas, buffer);
- });
+ SkDrawLooper::Context* context = this->createContext(&canvas, buffer);
for (;;) {
SkPaint p(paint);
if (context->next(&canvas, &p)) {
@@ -42,13 +39,10 @@ void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& s,
SkCanvas canvas;
SkSmallAllocator<1, 32> allocator;
+ void* buffer = allocator.reserveT<SkDrawLooper::Context>(this->contextSize());
*dst = src; // catch case where there are no loops
- SkDrawLooper::Context* context = allocator.createWithIniterT<SkDrawLooper::Context>(
- this->contextSize(),
- [&](void* buffer) {
- return this->createContext(&canvas, buffer);
- });
+ SkDrawLooper::Context* context = this->createContext(&canvas, buffer);
for (bool firstTime = true;; firstTime = false) {
SkPaint p(paint);
if (context->next(&canvas, &p)) {