https://bugs.webkit.org/show_bug.cgi?id=65809
Reviewed by Darin Adler and Sam Weinig.
* platform/ThreadGlobalData.cpp:
(WebCore::ThreadGlobalData::destroy): Removed code to clear the m_lineBreakIteratorPool member
variable, which was removed.
* platform/ThreadGlobalData.h: Removed lineBreakIteratorPool() and associated member variable.
* platform/text/LineBreakIteratorPoolICU.h:
(WebCore::LineBreakIteratorPool::sharedPool): Changed to return a thread-specific pool.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@92553
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-08-06 Dan Bernstein <mitz@apple.com>
+
+ Move the shared LineBreakIteratorPool from ThreadGlobalData into its own ThreadSpecific
+ https://bugs.webkit.org/show_bug.cgi?id=65809
+
+ Reviewed by Darin Adler and Sam Weinig.
+
+ * platform/ThreadGlobalData.cpp:
+ (WebCore::ThreadGlobalData::destroy): Removed code to clear the m_lineBreakIteratorPool member
+ variable, which was removed.
+ * platform/ThreadGlobalData.h: Removed lineBreakIteratorPool() and associated member variable.
+ * platform/text/LineBreakIteratorPoolICU.h:
+ (WebCore::LineBreakIteratorPool::sharedPool): Changed to return a thread-specific pool.
+
2011-08-06 Joseph Pecoraro <joepeck@webkit.org>
Potential Leaks - RetainPtr<> over retaining Create'd objects
#include <wtf/text/StringImpl.h>
#if USE(ICU_UNICODE)
-#include "LineBreakIteratorPoolICU.h"
#include "TextCodecICU.h"
#endif
destroy();
}
-#if USE(ICU_UNICODE)
-LineBreakIteratorPool& ThreadGlobalData::lineBreakIteratorPool()
-{
- if (!m_lineBreakIteratorPool)
- m_lineBreakIteratorPool = LineBreakIteratorPool::create();
- return *m_lineBreakIteratorPool;
-}
-#endif
-
void ThreadGlobalData::destroy()
{
#if PLATFORM(MAC)
#if USE(ICU_UNICODE)
delete m_cachedConverterICU;
m_cachedConverterICU = 0;
- m_lineBreakIteratorPool = nullptr;
#endif
delete m_eventNames;
namespace WebCore {
class EventNames;
- class LineBreakIteratorPool;
class ThreadTimers;
struct ICUConverterWrapper;
#if USE(ICU_UNICODE)
ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
- LineBreakIteratorPool& lineBreakIteratorPool();
#endif
#if PLATFORM(MAC)
#if USE(ICU_UNICODE)
ICUConverterWrapper* m_cachedConverterICU;
- OwnPtr<LineBreakIteratorPool> m_lineBreakIteratorPool;
#endif
#if PLATFORM(MAC)
#define LineBreakIteratorPoolICU_h
#include "TextBreakIteratorInternalICU.h"
-#include "ThreadGlobalData.h"
#include <unicode/ubrk.h>
#include <wtf/Assertions.h>
#include <wtf/HashMap.h>
#include <wtf/PassOwnPtr.h>
+#include <wtf/ThreadSpecific.h>
+#include <wtf/text/AtomicString.h>
#include <wtf/text/CString.h>
namespace WebCore {
public:
static LineBreakIteratorPool& sharedPool()
{
- return threadGlobalData().lineBreakIteratorPool();
+ static WTF::ThreadSpecific<LineBreakIteratorPool>* pool = new WTF::ThreadSpecific<LineBreakIteratorPool>;
+ return **pool;
}
static PassOwnPtr<LineBreakIteratorPool> create() { return adoptPtr(new LineBreakIteratorPool); }
typedef Vector<Entry, capacity> Pool;
Pool m_pool;
HashMap<UBreakIterator*, AtomicString> m_vendedIterators;
+
+ friend WTF::ThreadSpecific<LineBreakIteratorPool>::operator LineBreakIteratorPool*();
};
}