Title: [92553] trunk/Source/WebCore
Revision
92553
Author
[email protected]
Date
2011-08-06 10:00:48 -0700 (Sat, 06 Aug 2011)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92552 => 92553)


--- trunk/Source/WebCore/ChangeLog	2011-08-06 16:17:14 UTC (rev 92552)
+++ trunk/Source/WebCore/ChangeLog	2011-08-06 17:00:48 UTC (rev 92553)
@@ -1,3 +1,17 @@
+2011-08-06  Dan Bernstein  <[email protected]>
+
+        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  <[email protected]>
 
         Potential Leaks - RetainPtr<> over retaining Create'd objects

Modified: trunk/Source/WebCore/platform/ThreadGlobalData.cpp (92552 => 92553)


--- trunk/Source/WebCore/platform/ThreadGlobalData.cpp	2011-08-06 16:17:14 UTC (rev 92552)
+++ trunk/Source/WebCore/platform/ThreadGlobalData.cpp	2011-08-06 17:00:48 UTC (rev 92553)
@@ -35,7 +35,6 @@
 #include <wtf/text/StringImpl.h>
 
 #if USE(ICU_UNICODE)
-#include "LineBreakIteratorPoolICU.h"
 #include "TextCodecICU.h"
 #endif
 
@@ -83,15 +82,6 @@
     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)
@@ -102,7 +92,6 @@
 #if USE(ICU_UNICODE)
     delete m_cachedConverterICU;
     m_cachedConverterICU = 0;
-    m_lineBreakIteratorPool = nullptr;
 #endif
 
     delete m_eventNames;

Modified: trunk/Source/WebCore/platform/ThreadGlobalData.h (92552 => 92553)


--- trunk/Source/WebCore/platform/ThreadGlobalData.h	2011-08-06 16:17:14 UTC (rev 92552)
+++ trunk/Source/WebCore/platform/ThreadGlobalData.h	2011-08-06 17:00:48 UTC (rev 92553)
@@ -42,7 +42,6 @@
 namespace WebCore {
 
     class EventNames;
-    class LineBreakIteratorPool;
     class ThreadTimers;
 
     struct ICUConverterWrapper;
@@ -60,7 +59,6 @@
 
 #if USE(ICU_UNICODE)
         ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
-        LineBreakIteratorPool& lineBreakIteratorPool();
 #endif
 
 #if PLATFORM(MAC)
@@ -77,7 +75,6 @@
 
 #if USE(ICU_UNICODE)
         ICUConverterWrapper* m_cachedConverterICU;
-        OwnPtr<LineBreakIteratorPool> m_lineBreakIteratorPool;
 #endif
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/platform/text/LineBreakIteratorPoolICU.h (92552 => 92553)


--- trunk/Source/WebCore/platform/text/LineBreakIteratorPoolICU.h	2011-08-06 16:17:14 UTC (rev 92552)
+++ trunk/Source/WebCore/platform/text/LineBreakIteratorPoolICU.h	2011-08-06 17:00:48 UTC (rev 92553)
@@ -27,11 +27,12 @@
 #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 @@
 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 @@
     typedef Vector<Entry, capacity> Pool;
     Pool m_pool;
     HashMap<UBreakIterator*, AtomicString> m_vendedIterators;
+
+    friend WTF::ThreadSpecific<LineBreakIteratorPool>::operator LineBreakIteratorPool*();
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to