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 { | |
haraken
2016/01/19 07:43:36
Add a TODO and mention that the blink namespace sh
hajimehoshi
2016/01/19 10:19:21
Done.
| |
39 | |
40 class CompressibleStringTable; | |
41 | |
42 typedef void (*CompressibleStringTableDestructor)(CompressibleStringTable*); | |
43 | |
44 } | |
45 | |
38 namespace WTF { | 46 namespace WTF { |
39 | 47 |
40 class AtomicStringTable; | 48 class AtomicStringTable; |
41 struct ICUConverterWrapper; | 49 struct ICUConverterWrapper; |
42 | 50 |
43 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); | 51 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); |
44 | 52 |
45 class WTF_EXPORT WTFThreadData { | 53 class WTF_EXPORT WTFThreadData { |
46 WTF_MAKE_NONCOPYABLE(WTFThreadData); | 54 WTF_MAKE_NONCOPYABLE(WTFThreadData); |
47 public: | 55 public: |
48 WTFThreadData(); | 56 WTFThreadData(); |
49 ~WTFThreadData(); | 57 ~WTFThreadData(); |
50 | 58 |
51 AtomicStringTable* atomicStringTable() | 59 AtomicStringTable* atomicStringTable() |
52 { | 60 { |
53 return m_atomicStringTable; | 61 return m_atomicStringTable; |
54 } | 62 } |
55 | 63 |
64 blink::CompressibleStringTable* compressibleStringTable() | |
65 { | |
66 return m_compressibleStringTable; | |
67 } | |
68 | |
56 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } | 69 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } |
57 | 70 |
58 private: | 71 private: |
59 AtomicStringTable* m_atomicStringTable; | 72 AtomicStringTable* m_atomicStringTable; |
60 AtomicStringTableDestructor m_atomicStringTableDestructor; | 73 AtomicStringTableDestructor m_atomicStringTableDestructor; |
74 blink::CompressibleStringTable* m_compressibleStringTable; | |
75 blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor ; | |
61 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; | 76 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; |
62 | 77 |
63 static ThreadSpecific<WTFThreadData>* staticData; | 78 static ThreadSpecific<WTFThreadData>* staticData; |
64 friend WTFThreadData& wtfThreadData(); | 79 friend WTFThreadData& wtfThreadData(); |
65 friend class AtomicStringTable; | 80 friend class AtomicStringTable; |
81 friend class blink::CompressibleStringTable; | |
66 }; | 82 }; |
67 | 83 |
68 inline WTFThreadData& wtfThreadData() | 84 inline WTFThreadData& wtfThreadData() |
69 { | 85 { |
70 // WRT WebCore: | 86 // WRT WebCore: |
71 // WTFThreadData is used on main thread before it could possibly be used | 87 // WTFThreadData is used on main thread before it could possibly be used |
72 // on secondary ones, so there is no need for synchronization here. | 88 // on secondary ones, so there is no need for synchronization here. |
73 // WRT JavaScriptCore: | 89 // WRT JavaScriptCore: |
74 // wtfThreadData() is initially called from initializeThreading(), ensuri ng | 90 // wtfThreadData() is initially called from initializeThreading(), ensuri ng |
75 // this is initially called in a pthread_once locked context. | 91 // this is initially called in a pthread_once locked context. |
76 if (!WTFThreadData::staticData) | 92 if (!WTFThreadData::staticData) |
77 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; | 93 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; |
78 return **WTFThreadData::staticData; | 94 return **WTFThreadData::staticData; |
79 } | 95 } |
80 | 96 |
81 } // namespace WTF | 97 } // namespace WTF |
82 | 98 |
83 using WTF::WTFThreadData; | 99 using WTF::WTFThreadData; |
84 using WTF::wtfThreadData; | 100 using WTF::wtfThreadData; |
85 | 101 |
86 #endif // WTFThreadData_h | 102 #endif // WTFThreadData_h |
OLD | NEW |