Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: tools/LazyDecodeBitmap.cpp

Issue 83563002: Implement SkAshmemDiscardableMemory (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: final rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/DiscardableMemoryTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/LazyDecodeBitmap.cpp
diff --git a/tools/LazyDecodeBitmap.cpp b/tools/LazyDecodeBitmap.cpp
index 9e850e5753b6b26f6b67396abd480be8dba32e63..f5ff1477d342afd8ef8d344fe46b5b4aeed406bb 100644
--- a/tools/LazyDecodeBitmap.cpp
+++ b/tools/LazyDecodeBitmap.cpp
@@ -17,7 +17,6 @@
__SK_FORCE_IMAGE_DECODER_LINKING;
-// TODO(halcanary) Use this flag when ashmem-backed discardable memory lands.
DEFINE_bool(useVolatileCache, false, "Use a volatile cache for deferred image decoding pixels. "
"Only meaningful if --deferImageDecoding is set to true and the platform has an "
"implementation.");
@@ -39,9 +38,11 @@ bool sk_tools::LazyDecodeBitmap(const void* src,
return false;
}
SkDiscardableMemory::Factory* pool = NULL;
- if (info.fWidth * info.fHeight > 32 * 1024) {
+ if ((!FLAGS_useVolatileCache) || (info.fWidth * info.fHeight < 32 * 1024)) {
// how to do switching with SkDiscardableMemory.
pool = SkGetGlobalDiscardableMemoryPool();
+ // Only meaningful if platform has a default discardable
+ // memory implementation that differs from the global DM pool.
}
return SkDiscardablePixelRef::Install(gen.detach(), dst, pool);
}
« no previous file with comments | « tests/DiscardableMemoryTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698