Revert "Reland "cache the creation of one GrAtlasTextOp""
This reverts commit dc3d67871202ce55ecbfbee761fe1d981254a3a1.
Reason for revert: Crashing on exit thread handler
Original change's description:
> Reland "cache the creation of one GrAtlasTextOp"
>
> This is a reland of 4b1fb7ca90a589260bf8044393a6970f947302a0
>
> Original change's description:
> > cache the creation of one GrAtlasTextOp
> >
> > GrAtlasTextOp has a high probability of being merged with the
> > previous op. This cache keeps using the same op to merge with
> > keeping memory warm.
> >
> > This show about 5.75% improvement in skpbench on desk_nytimes.
> >
> > When compiling for ios 9 or earlier, this optimization is
> > disabled.
> >
> > Change-Id: I13ccbef6dcd4b9d82103bf20bba7d94f3e4fb6f4
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376718
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Herb Derby <herb@google.com>
>
> Change-Id: I935a2965062b1fddb28806e85eb0fe055ba46ec2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380320
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
TBR=bsalomon@google.com,herb@google.com,michaelludwig@google.com
Change-Id: I3bc3329580460fcf8c0b49f655a88cb902da3d58
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382556
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 384d087..fcb28c6 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -31,50 +31,7 @@
#include "src/gpu/GrDrawOpTest.h"
#endif
-// This class was determined through experimentation. You would expect to use operator new/delete
-// in this code, but this crashed thread_local implementations of Android. Using malloc/free
-// seems to work on Android.
-namespace {
-struct CachedVoidPointer {
- ~CachedVoidPointer() { free(fPtr); }
- void* doNew(size_t size) {
- if (fPtr != nullptr) {
- void* result = fPtr;
- fPtr = nullptr;
- return result;
- }
-
- void* result = malloc(size);
- if (result == nullptr) {
- SK_ABORT("Out of memory.");
- }
- return result;
- }
-
- void doDelete(void* ptr) {
- if (fPtr == nullptr) {
- fPtr = ptr;
- return;
- }
-
- free(ptr);
- }
-
- void* fPtr = nullptr;
-};
-} // namespace
-
-// If we have thread local, then cache memory for a single GrAtlasTextOp.
-#if !defined(GR_OP_ALLOCATE_USE_POOL) && defined(GR_HAS_THREAD_LOCAL)
-static thread_local CachedVoidPointer gGrAtlasTextOpCache;
-void* GrAtlasTextOp::operator new(size_t s) {
- return gGrAtlasTextOpCache.doNew(s);
-}
-
-void GrAtlasTextOp::operator delete(void* b) noexcept {
- return gGrAtlasTextOpCache.doDelete(b);
-}
-#endif
+///////////////////////////////////////////////////////////////////////////////////////////////////
GrAtlasTextOp::GrAtlasTextOp(MaskType maskType,
bool needsTransform,