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

Unified Diff: src/core/SkScaledImageCache.cpp

Issue 108613005: Ensure we call onUnlock only if onLock succeeded (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « src/core/SkPixelRef.cpp ('k') | src/images/SkImageRef_ashmem.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkScaledImageCache.cpp
diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp
index 7c8b66498e342f84e26a9d9236ef98bfc10eff49..2529b5f8ec60cd6a0b44de206a8d45001e405870 100644
--- a/src/core/SkScaledImageCache.cpp
+++ b/src/core/SkScaledImageCache.cpp
@@ -209,7 +209,6 @@ private:
SkDiscardableMemory* fDM;
size_t fRB;
bool fFirstTime;
- bool fIsLocked;
typedef SkPixelRef INHERITED;
};
@@ -225,7 +224,6 @@ SkOneShotDiscardablePixelRef::SkOneShotDiscardablePixelRef(const SkImageInfo& in
SkASSERT(dm->data());
fFirstTime = true;
- fIsLocked = false;
}
SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() {
@@ -235,6 +233,7 @@ SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() {
void* SkOneShotDiscardablePixelRef::onLockPixels(SkColorTable** ctable) {
if (fFirstTime) {
// we're already locked
+ SkASSERT(fDM->data());
fFirstTime = false;
return fDM->data();
}
@@ -255,10 +254,7 @@ void* SkOneShotDiscardablePixelRef::onLockPixels(SkColorTable** ctable) {
void SkOneShotDiscardablePixelRef::onUnlockPixels() {
SkASSERT(!fFirstTime);
- if (fIsLocked) {
- fIsLocked = false;
- fDM->unlock();
- }
+ fDM->unlock();
}
size_t SkOneShotDiscardablePixelRef::getAllocatedSizeInBytes() const {
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/images/SkImageRef_ashmem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698