aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrOp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ops/GrOp.cpp')
-rw-r--r--src/gpu/ops/GrOp.cpp50
1 files changed, 10 insertions, 40 deletions
diff --git a/src/gpu/ops/GrOp.cpp b/src/gpu/ops/GrOp.cpp
index f020cdef67..cab8ca1d18 100644
--- a/src/gpu/ops/GrOp.cpp
+++ b/src/gpu/ops/GrOp.cpp
@@ -7,57 +7,27 @@
#include "GrOp.h"
-#include "GrMemoryPool.h"
-#include "SkSpinlock.h"
-#include "SkTo.h"
-
-// TODO I noticed a small benefit to using a larger exclusive pool for ops. Its very small, but
-// seems to be mostly consistent. There is a lot in flux right now, but we should really revisit
-// this.
-
-
-// We use a global pool protected by a mutex(spinlock). Chrome may use the same GrContext on
-// different threads. The GrContext is not used concurrently on different threads and there is a
-// memory barrier between accesses of a context on different threads. Also, there may be multiple
-// GrContexts and those contexts may be in use concurrently on different threads.
-namespace {
-#if !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
-static SkSpinlock gOpPoolSpinLock;
-#endif
-class MemoryPoolAccessor {
-public:
-
-// We know in the Android framework there is only one GrContext.
-#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
- MemoryPoolAccessor() {}
- ~MemoryPoolAccessor() {}
-#else
- MemoryPoolAccessor() { gOpPoolSpinLock.acquire(); }
- ~MemoryPoolAccessor() { gOpPoolSpinLock.release(); }
-#endif
-
- GrMemoryPool* pool() const {
- static GrMemoryPool gPool(16384, 16384);
- return &gPool;
- }
-};
-}
-
int32_t GrOp::gCurrOpClassID = GrOp::kIllegalOpID;
int32_t GrOp::gCurrOpUniqueID = GrOp::kIllegalOpID;
+#ifdef SK_DEBUG
void* GrOp::operator new(size_t size) {
- return MemoryPoolAccessor().pool()->allocate(size);
+ // All GrOp-derived class should be allocated in a GrMemoryPool
+ SkASSERT(0);
+ return ::operator new(size);
}
void GrOp::operator delete(void* target) {
- return MemoryPoolAccessor().pool()->release(target);
+ // All GrOp-derived class should be released from their owning GrMemoryPool
+ SkASSERT(0);
+ ::operator delete(target);
}
+#endif
GrOp::GrOp(uint32_t classID)
- : fClassID(classID)
- , fUniqueID(kIllegalOpID) {
+ : fClassID(classID)
+ , fUniqueID(kIllegalOpID) {
SkASSERT(classID == SkToU32(fClassID));
SkDEBUGCODE(fBoundsFlags = kUninitialized_BoundsFlag);
}