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

Unified Diff: src/lazy/SkDiscardablePixelRef.cpp

Issue 940323003: Revert of Make SkPixelRef::isLocked() debug-only, remove related dead code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months 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/lazy/SkDiscardablePixelRef.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkDiscardablePixelRef.cpp
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index b6dec1b3a1129b85ccccbb65edf50255bdc1bad3..50988587a7c1030cf3fd56727e104011f31b4870 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -18,7 +18,6 @@
, fDMFactory(fact)
, fRowBytes(rowBytes)
, fDiscardableMemory(NULL)
- , fDiscardableMemoryIsLocked(false)
{
SkASSERT(fGenerator != NULL);
SkASSERT(fRowBytes > 0);
@@ -29,9 +28,8 @@
}
SkDiscardablePixelRef::~SkDiscardablePixelRef() {
- if (fDiscardableMemoryIsLocked) {
+ if (this->isLocked()) {
fDiscardableMemory->unlock();
- fDiscardableMemoryIsLocked = false;
}
SkDELETE(fDiscardableMemory);
SkSafeUnref(fDMFactory);
@@ -41,7 +39,6 @@
bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
if (fDiscardableMemory != NULL) {
if (fDiscardableMemory->lock()) {
- fDiscardableMemoryIsLocked = true;
rec->fPixels = fDiscardableMemory->data();
rec->fColorTable = fCTable.get();
rec->fRowBytes = fRowBytes;
@@ -49,20 +46,16 @@
}
SkDELETE(fDiscardableMemory);
fDiscardableMemory = NULL;
- fDiscardableMemoryIsLocked = false;
}
const size_t size = this->info().getSafeSize(fRowBytes);
if (fDMFactory != NULL) {
fDiscardableMemory = fDMFactory->create(size);
- fDiscardableMemoryIsLocked = true;
} else {
fDiscardableMemory = SkDiscardableMemory::Create(size);
- fDiscardableMemoryIsLocked = true;
}
if (NULL == fDiscardableMemory) {
- fDiscardableMemoryIsLocked = false;
return false; // Memory allocation failed.
}
@@ -79,7 +72,6 @@
break;
default:
fDiscardableMemory->unlock();
- fDiscardableMemoryIsLocked = false;
SkDELETE(fDiscardableMemory);
fDiscardableMemory = NULL;
return false;
@@ -104,7 +96,6 @@
void SkDiscardablePixelRef::onUnlockPixels() {
fDiscardableMemory->unlock();
- fDiscardableMemoryIsLocked = false;
}
bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst,
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698