Fix bug in GrCachedLayer reuse
authorrobertphillips <robertphillips@google.com>
Fri, 10 Oct 2014 18:38:29 +0000 (11:38 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 10 Oct 2014 18:38:29 +0000 (11:38 -0700)
commit7bb9ed756e8663afe68e1a5fc680d57f83a31fea
tree7c9eb9b8f282521f42aecb35b5623dbdff24dca2
parent294c32612d712eb56361ac5439271a91ae96862e
Fix bug in GrCachedLayer reuse

In the new MultiPictureDraw tests a single hoisted layer is reused multiple times. The previous plot locking scheme allowed GrCachedLayer objects to be aggressively deleted prematurely leaving the reusing GrHoistedLayer objects with dangling pointers.

This CL changes adds a new pseudo-ref to GrCachedLayer. (It can't be a real ref since the cached layers aren't deleted when it goes to 0).

NOTRY=true

Committed: https://skia.googlesource.com/skia/+/5c481666c9678f43e039ad605457be3854cf8de3

Review URL: https://codereview.chromium.org/640323002
src/gpu/GrLayerCache.cpp
src/gpu/GrLayerCache.h
src/gpu/GrLayerHoister.cpp
tests/GpuLayerCacheTest.cpp