| 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> | |
| 38 | 37 |
| 39 namespace blink { | 38 namespace blink { |
| 40 | 39 |
| 41 // TODO(hajimehoshi): CompressibleStringTable should be moved from blink to WTF | 40 // TODO(hajimehoshi): CompressibleStringTable should be moved from blink to WTF |
| 42 // namespace. Fix this forward declaration when we do this. | 41 // namespace. Fix this forward declaration when we do this. |
| 43 class CompressibleStringTable; | 42 class CompressibleStringTable; |
| 44 | 43 |
| 45 typedef void (*CompressibleStringTableDestructor)(CompressibleStringTable*); | 44 typedef void (*CompressibleStringTableDestructor)(CompressibleStringTable*); |
| 46 | 45 |
| 47 } | 46 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 return m_compressibleStringTable; | 69 return m_compressibleStringTable; |
| 71 } | 70 } |
| 72 | 71 |
| 73 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } | 72 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } |
| 74 | 73 |
| 75 private: | 74 private: |
| 76 AtomicStringTable* m_atomicStringTable; | 75 AtomicStringTable* m_atomicStringTable; |
| 77 AtomicStringTableDestructor m_atomicStringTableDestructor; | 76 AtomicStringTableDestructor m_atomicStringTableDestructor; |
| 78 blink::CompressibleStringTable* m_compressibleStringTable; | 77 blink::CompressibleStringTable* m_compressibleStringTable; |
| 79 blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor
; | 78 blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor
; |
| 80 std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU; | 79 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; |
| 81 | 80 |
| 82 static ThreadSpecific<WTFThreadData>* staticData; | 81 static ThreadSpecific<WTFThreadData>* staticData; |
| 83 friend WTFThreadData& wtfThreadData(); | 82 friend WTFThreadData& wtfThreadData(); |
| 84 friend class AtomicStringTable; | 83 friend class AtomicStringTable; |
| 85 friend class blink::CompressibleStringTable; | 84 friend class blink::CompressibleStringTable; |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 inline WTFThreadData& wtfThreadData() | 87 inline WTFThreadData& wtfThreadData() |
| 89 { | 88 { |
| 90 // WTFThreadData is used on main thread before it could possibly be used | 89 // WTFThreadData is used on main thread before it could possibly be used |
| 91 // on secondary ones, so there is no need for synchronization here. | 90 // on secondary ones, so there is no need for synchronization here. |
| 92 if (!WTFThreadData::staticData) | 91 if (!WTFThreadData::staticData) |
| 93 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; | 92 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; |
| 94 return **WTFThreadData::staticData; | 93 return **WTFThreadData::staticData; |
| 95 } | 94 } |
| 96 | 95 |
| 97 } // namespace WTF | 96 } // namespace WTF |
| 98 | 97 |
| 99 using WTF::WTFThreadData; | 98 using WTF::WTFThreadData; |
| 100 using WTF::wtfThreadData; | 99 using WTF::wtfThreadData; |
| 101 | 100 |
| 102 #endif // WTFThreadData_h | 101 #endif // WTFThreadData_h |
| OLD | NEW |