diff options
| author | 2013-08-22 01:43:24 +0000 | |
|---|---|---|
| committer | 2013-08-22 01:43:24 +0000 | |
| commit | 243a026b89bfe0b7b549665882d053c40ab0785f (patch) | |
| tree | b906a744367597c63842272f44f971a706980481 /libs/hwui/PathCache.cpp | |
| parent | d5ea6e113cfd573859f0966ae71cdcfd3d5e5f51 (diff) | |
| parent | 5d923200846ed59e813373bde789d97d4ccc40b5 (diff) | |
Merge "Second attempt at avoiding infinite loop in PathCache::trim() Bug #10347089" into klp-dev
Diffstat (limited to 'libs/hwui/PathCache.cpp')
| -rw-r--r-- | libs/hwui/PathCache.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index 25afe63267fe..5df64080b102 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -214,7 +214,22 @@ void PathCache::operator()(PathDescription& entry, PathTexture*& texture) { void PathCache::removeTexture(PathTexture* texture) { if (texture) { const uint32_t size = texture->width * texture->height; - mSize -= size; + + // If there is a pending task we must wait for it to return + // before attempting our cleanup + const sp<Task<SkBitmap*> >& task = texture->task(); + if (task != NULL) { + SkBitmap* bitmap = task->getResult(); + texture->clearTask(); + } else { + // If there is a pending task, the path was not added + // to the cache and the size wasn't increased + if (size > mSize) { + ALOGE("Removing path texture of size %d will leave " + "the cache in an inconsistent state", size); + } + mSize -= size; + } PATH_LOGD("PathCache::delete name, size, mSize = %d, %d, %d", texture->id, size, mSize); |