Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 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 | 37 |
| 38 namespace blink { | |
| 39 | |
| 40 class CompressibleStringTable; | |
| 41 | |
| 42 } // namespace blink | |
| 43 | |
| 38 namespace WTF { | 44 namespace WTF { |
| 39 | 45 |
| 40 class AtomicStringTable; | 46 class AtomicStringTable; |
| 41 struct ICUConverterWrapper; | 47 struct ICUConverterWrapper; |
| 42 | 48 |
| 43 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); | 49 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); |
| 50 typedef void (*CompressibleStringTableDestructor)(blink::CompressibleStringTable *); | |
|
haraken
2015/11/26 11:50:03
Hmm, it's not nice to write 'blink::' in wtf. It's
hajimehoshi
2015/11/27 11:03:58
Sure, I'll move this to wtf soon again.
hajimehoshi
2015/11/30 05:26:59
We found that CompressibleString depends on blink:
| |
| 44 | 51 |
| 45 class WTF_EXPORT WTFThreadData { | 52 class WTF_EXPORT WTFThreadData { |
| 46 WTF_MAKE_NONCOPYABLE(WTFThreadData); | 53 WTF_MAKE_NONCOPYABLE(WTFThreadData); |
| 47 public: | 54 public: |
| 48 WTFThreadData(); | 55 WTFThreadData(); |
| 49 ~WTFThreadData(); | 56 ~WTFThreadData(); |
| 50 | 57 |
| 51 AtomicStringTable* atomicStringTable() | 58 AtomicStringTable* atomicStringTable() |
| 52 { | 59 { |
| 53 return m_atomicStringTable; | 60 return m_atomicStringTable; |
| 54 } | 61 } |
| 55 | 62 |
| 63 blink::CompressibleStringTable* compressibleStringTable() | |
| 64 { | |
| 65 return m_compressibleStringTable; | |
| 66 } | |
| 67 | |
| 56 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } | 68 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } |
| 57 | 69 |
| 58 private: | 70 private: |
| 59 AtomicStringTable* m_atomicStringTable; | 71 AtomicStringTable* m_atomicStringTable; |
| 60 AtomicStringTableDestructor m_atomicStringTableDestructor; | 72 AtomicStringTableDestructor m_atomicStringTableDestructor; |
| 73 blink::CompressibleStringTable* m_compressibleStringTable; | |
| 74 CompressibleStringTableDestructor m_compressibleStringTableDestructor; | |
| 61 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; | 75 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; |
| 62 | 76 |
| 63 static ThreadSpecific<WTFThreadData>* staticData; | 77 static ThreadSpecific<WTFThreadData>* staticData; |
| 64 friend WTFThreadData& wtfThreadData(); | 78 friend WTFThreadData& wtfThreadData(); |
| 65 friend class AtomicStringTable; | 79 friend class AtomicStringTable; |
| 80 friend class blink::CompressibleStringTable; | |
| 66 }; | 81 }; |
| 67 | 82 |
| 68 inline WTFThreadData& wtfThreadData() | 83 inline WTFThreadData& wtfThreadData() |
| 69 { | 84 { |
| 70 // WRT WebCore: | 85 // WRT WebCore: |
| 71 // WTFThreadData is used on main thread before it could possibly be used | 86 // WTFThreadData is used on main thread before it could possibly be used |
| 72 // on secondary ones, so there is no need for synchronization here. | 87 // on secondary ones, so there is no need for synchronization here. |
| 73 // WRT JavaScriptCore: | 88 // WRT JavaScriptCore: |
| 74 // wtfThreadData() is initially called from initializeThreading(), ensuri ng | 89 // wtfThreadData() is initially called from initializeThreading(), ensuri ng |
| 75 // this is initially called in a pthread_once locked context. | 90 // this is initially called in a pthread_once locked context. |
| 76 if (!WTFThreadData::staticData) | 91 if (!WTFThreadData::staticData) |
| 77 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; | 92 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; |
| 78 return **WTFThreadData::staticData; | 93 return **WTFThreadData::staticData; |
| 79 } | 94 } |
| 80 | 95 |
| 81 } // namespace WTF | 96 } // namespace WTF |
| 82 | 97 |
| 83 using WTF::WTFThreadData; | 98 using WTF::WTFThreadData; |
| 84 using WTF::wtfThreadData; | 99 using WTF::wtfThreadData; |
| 85 | 100 |
| 86 #endif // WTFThreadData_h | 101 #endif // WTFThreadData_h |
| OLD | NEW |