From ea3aee78c70975c976f277e347eeffb9f4d2c539 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sat, 26 May 2012 10:03:20 -0400 Subject: [PATCH] Backout 5baac057fc1a (bug 757933) due to red. --- gfx/src/nsRegion.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gfx/src/nsRegion.cpp b/gfx/src/nsRegion.cpp index 75e904bae9f0..d528b7d29509 100644 --- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -5,7 +5,6 @@ #include "nsRegion.h" #include "nsISupportsImpl.h" #include "nsTArray.h" -#include "mozilla/ThreadLocal.h" /* * The SENTINEL values below guaranties that a < or > @@ -184,43 +183,47 @@ void RgnRectMemoryAllocator::Free (nsRegion::RgnRect* aRect) // Global pool for nsRegion::RgnRect allocation -mozilla::ThreadLocal gRectPoolTlsIndex; +static PRUintn gRectPoolTlsIndex; void RgnRectMemoryAllocatorDTOR(void *priv) { - RgnRectMemoryAllocator* allocator = gRectPoolTlsIndex.get(); + RgnRectMemoryAllocator* allocator = (static_cast( + PR_GetThreadPrivate(gRectPoolTlsIndex))); delete allocator; } nsresult nsRegion::InitStatic() { - return gRectPoolTlsIndex.init() ? NS_OK : NS_ERROR_FAILURE; + return PR_NewThreadPrivateIndex(&gRectPoolTlsIndex, RgnRectMemoryAllocatorDTOR); } void nsRegion::ShutdownStatic() { - RgnRectMemoryAllocator* allocator = gRectPoolTlsIndex.get(); + RgnRectMemoryAllocator* allocator = (static_cast( + PR_GetThreadPrivate(gRectPoolTlsIndex))); if (!allocator) return; delete allocator; - gRectPoolTlsIndex.set(nsnull); + PR_SetThreadPrivate(gRectPoolTlsIndex, nsnull); } void* nsRegion::RgnRect::operator new (size_t) CPP_THROW_NEW { - RgnRectMemoryAllocator* allocator = gRectPoolTlsIndex.get(); + RgnRectMemoryAllocator* allocator = (static_cast( + PR_GetThreadPrivate(gRectPoolTlsIndex))); if (!allocator) { allocator = new RgnRectMemoryAllocator(INIT_MEM_CHUNK_ENTRIES); - gRectPoolTlsIndex.set(allocator); + PR_SetThreadPrivate(gRectPoolTlsIndex, allocator); } return allocator->Alloc (); } void nsRegion::RgnRect::operator delete (void* aRect, size_t) { - RgnRectMemoryAllocator* allocator = gRectPoolTlsIndex.get(); + RgnRectMemoryAllocator* allocator = (static_cast( + PR_GetThreadPrivate(gRectPoolTlsIndex))); if (!allocator) { NS_ERROR("Invalid nsRegion::RgnRect delete"); return;