| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #ifndef WTFThreadData_h | 27 #ifndef WTFThreadData_h |
| 28 #define WTFThreadData_h | 28 #define WTFThreadData_h |
| 29 | 29 |
| 30 #include "wtf/HashMap.h" | 30 #include "wtf/HashMap.h" |
| 31 #include "wtf/HashSet.h" | 31 #include "wtf/HashSet.h" |
| 32 #include "wtf/Noncopyable.h" | 32 #include "wtf/Noncopyable.h" |
| 33 #include "wtf/ThreadSpecific.h" | 33 #include "wtf/ThreadSpecific.h" |
| 34 #include "wtf/Threading.h" | 34 #include "wtf/Threading.h" |
| 35 #include "wtf/WTFExport.h" | 35 #include "wtf/WTFExport.h" |
| 36 #include "wtf/text/StringHash.h" | 36 #include "wtf/text/StringHash.h" |
| 37 #include <memory> |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 // TODO(hajimehoshi): CompressibleStringTable should be moved from blink to WTF | 41 // TODO(hajimehoshi): CompressibleStringTable should be moved from blink to WTF |
| 41 // namespace. Fix this forward declaration when we do this. | 42 // namespace. Fix this forward declaration when we do this. |
| 42 class CompressibleStringTable; | 43 class CompressibleStringTable; |
| 43 | 44 |
| 44 typedef void (*CompressibleStringTableDestructor)(CompressibleStringTable*); | 45 typedef void (*CompressibleStringTableDestructor)(CompressibleStringTable*); |
| 45 | 46 |
| 46 } | 47 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 return m_compressibleStringTable; | 70 return m_compressibleStringTable; |
| 70 } | 71 } |
| 71 | 72 |
| 72 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } | 73 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 AtomicStringTable* m_atomicStringTable; | 76 AtomicStringTable* m_atomicStringTable; |
| 76 AtomicStringTableDestructor m_atomicStringTableDestructor; | 77 AtomicStringTableDestructor m_atomicStringTableDestructor; |
| 77 blink::CompressibleStringTable* m_compressibleStringTable; | 78 blink::CompressibleStringTable* m_compressibleStringTable; |
| 78 blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor
; | 79 blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor
; |
| 79 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; | 80 std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU; |
| 80 | 81 |
| 81 static ThreadSpecific<WTFThreadData>* staticData; | 82 static ThreadSpecific<WTFThreadData>* staticData; |
| 82 friend WTFThreadData& wtfThreadData(); | 83 friend WTFThreadData& wtfThreadData(); |
| 83 friend class AtomicStringTable; | 84 friend class AtomicStringTable; |
| 84 friend class blink::CompressibleStringTable; | 85 friend class blink::CompressibleStringTable; |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 inline WTFThreadData& wtfThreadData() | 88 inline WTFThreadData& wtfThreadData() |
| 88 { | 89 { |
| 89 // WTFThreadData is used on main thread before it could possibly be used | 90 // WTFThreadData is used on main thread before it could possibly be used |
| 90 // on secondary ones, so there is no need for synchronization here. | 91 // on secondary ones, so there is no need for synchronization here. |
| 91 if (!WTFThreadData::staticData) | 92 if (!WTFThreadData::staticData) |
| 92 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; | 93 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; |
| 93 return **WTFThreadData::staticData; | 94 return **WTFThreadData::staticData; |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace WTF | 97 } // namespace WTF |
| 97 | 98 |
| 98 using WTF::WTFThreadData; | 99 using WTF::WTFThreadData; |
| 99 using WTF::wtfThreadData; | 100 using WTF::wtfThreadData; |
| 100 | 101 |
| 101 #endif // WTFThreadData_h | 102 #endif // WTFThreadData_h |
| OLD | NEW |