Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: third_party/WebKit/Source/wtf/WTFThreadData.h

Issue 1389383003: WIP: Introduce CompressibleString Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto crrev.com/1564773002 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/BUILD.gn ('k') | third_party/WebKit/Source/wtf/WTFThreadData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
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 WTF { 38 namespace WTF {
39 39
40 class AtomicStringTable; 40 class AtomicStringTable;
41 class CompressibleStringTable;
41 struct ICUConverterWrapper; 42 struct ICUConverterWrapper;
42 43
43 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); 44 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*);
45 typedef void (*CompressibleStringTableDestructor)(CompressibleStringTable*);
44 46
45 class WTF_EXPORT WTFThreadData { 47 class WTF_EXPORT WTFThreadData {
46 WTF_MAKE_NONCOPYABLE(WTFThreadData); 48 WTF_MAKE_NONCOPYABLE(WTFThreadData);
47 public: 49 public:
48 WTFThreadData(); 50 WTFThreadData();
49 ~WTFThreadData(); 51 ~WTFThreadData();
50 52
51 AtomicStringTable* atomicStringTable() 53 AtomicStringTable* atomicStringTable()
52 { 54 {
53 return m_atomicStringTable; 55 return m_atomicStringTable;
54 } 56 }
55 57
58 CompressibleStringTable* compressibleStringTable()
59 {
60 return m_compressibleStringTable;
61 }
62
56 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } 63 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
57 64
58 private: 65 private:
59 AtomicStringTable* m_atomicStringTable; 66 AtomicStringTable* m_atomicStringTable;
60 AtomicStringTableDestructor m_atomicStringTableDestructor; 67 AtomicStringTableDestructor m_atomicStringTableDestructor;
68 CompressibleStringTable* m_compressibleStringTable;
69 CompressibleStringTableDestructor m_compressibleStringTableDestructor;
61 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; 70 OwnPtr<ICUConverterWrapper> m_cachedConverterICU;
62 71
63 static ThreadSpecific<WTFThreadData>* staticData; 72 static ThreadSpecific<WTFThreadData>* staticData;
64 friend WTFThreadData& wtfThreadData(); 73 friend WTFThreadData& wtfThreadData();
65 friend class AtomicStringTable; 74 friend class AtomicStringTable;
75 friend class CompressibleStringTable;
66 }; 76 };
67 77
68 inline WTFThreadData& wtfThreadData() 78 inline WTFThreadData& wtfThreadData()
69 { 79 {
70 // WRT WebCore: 80 // WRT WebCore:
71 // WTFThreadData is used on main thread before it could possibly be used 81 // WTFThreadData is used on main thread before it could possibly be used
72 // on secondary ones, so there is no need for synchronization here. 82 // on secondary ones, so there is no need for synchronization here.
73 // WRT JavaScriptCore: 83 // WRT JavaScriptCore:
74 // wtfThreadData() is initially called from initializeThreading(), ensuri ng 84 // wtfThreadData() is initially called from initializeThreading(), ensuri ng
75 // this is initially called in a pthread_once locked context. 85 // this is initially called in a pthread_once locked context.
76 if (!WTFThreadData::staticData) 86 if (!WTFThreadData::staticData)
77 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; 87 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
78 return **WTFThreadData::staticData; 88 return **WTFThreadData::staticData;
79 } 89 }
80 90
81 } // namespace WTF 91 } // namespace WTF
82 92
83 using WTF::WTFThreadData; 93 using WTF::WTFThreadData;
84 using WTF::wtfThreadData; 94 using WTF::wtfThreadData;
85 95
86 #endif // WTFThreadData_h 96 #endif // WTFThreadData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/BUILD.gn ('k') | third_party/WebKit/Source/wtf/WTFThreadData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698