Move the shared LineBreakIteratorPool from ThreadGlobalData into its own ThreadSpecific
[WebKit-https.git] / Source / WebCore / platform / text / LineBreakIteratorPoolICU.h
index 11b1150312d9638c1ee7da0491ba6e9df59edd77..d8e2ccbcd8f11a817de3da413eeae1d404eb72e9 100644 (file)
 #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 {
@@ -41,7 +42,8 @@ class LineBreakIteratorPool {
 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); }
@@ -92,6 +94,8 @@ private:
     typedef Vector<Entry, capacity> Pool;
     Pool m_pool;
     HashMap<UBreakIterator*, AtomicString> m_vendedIterators;
+
+    friend WTF::ThreadSpecific<LineBreakIteratorPool>::operator LineBreakIteratorPool*();
 };
 
 }