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

Unified Diff: src/core/SkColorTable.cpp

Issue 719213008: SkColorTable locking serves no purpose anymore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: oops Created 6 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/SkBitmapProcState_procs.h ('k') | src/core/SkConfig8888.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorTable.cpp
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 0d033ec2be9e87cbcc08e7de6209c7889d583b1e..cb9f00cd0edb2ed40c20e975bca7da90bbe527ac 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -19,11 +19,8 @@ void SkColorTable::init(const SkPMColor colors[], int count) {
f16BitCache = NULL;
fCount = count;
fColors = reinterpret_cast<SkPMColor*>(sk_malloc_throw(count * sizeof(SkPMColor)));
-
+
memcpy(fColors, colors, count * sizeof(SkPMColor));
-
- SkDEBUGCODE(fColorLockCount = 0;)
- SkDEBUGCODE(f16BitCacheLockCount = 0;)
}
// As copy constructor is hidden in the class hierarchy, we need to call
@@ -43,18 +40,10 @@ SkColorTable::SkColorTable(const SkPMColor colors[], int count) {
}
SkColorTable::~SkColorTable() {
- SkASSERT(fColorLockCount == 0);
- SkASSERT(f16BitCacheLockCount == 0);
-
sk_free(fColors);
sk_free(f16BitCache);
}
-void SkColorTable::unlockColors() {
- SkASSERT(fColorLockCount != 0);
- SkDEBUGCODE(sk_atomic_dec(&fColorLockCount);)
-}
-
#include "SkColorPriv.h"
static inline void build_16bitcache(uint16_t dst[], const SkPMColor src[],
@@ -64,13 +53,11 @@ static inline void build_16bitcache(uint16_t dst[], const SkPMColor src[],
}
}
-const uint16_t* SkColorTable::lock16BitCache() {
+const uint16_t* SkColorTable::read16BitCache() {
if (NULL == f16BitCache) {
f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t));
build_16bitcache(f16BitCache, fColors, fCount);
}
-
- SkDEBUGCODE(sk_atomic_inc(&f16BitCacheLockCount));
return f16BitCache;
}
@@ -78,9 +65,6 @@ const uint16_t* SkColorTable::lock16BitCache() {
SkColorTable::SkColorTable(SkReadBuffer& buffer) {
f16BitCache = NULL;
- SkDEBUGCODE(fColorLockCount = 0;)
- SkDEBUGCODE(f16BitCacheLockCount = 0;)
-
if (buffer.isVersionLT(SkReadBuffer::kRemoveColorTableAlpha_Version)) {
/*fAlphaType = */buffer.readUInt();
}
« no previous file with comments | « src/core/SkBitmapProcState_procs.h ('k') | src/core/SkConfig8888.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698