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

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

Issue 1583263002: Experimental CompressibleString UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: haraken's review 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
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 17 matching lines...) Expand all
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 // TODO(hajimehoshi): CompressibleStringTable should be moved from blink to WTF
41 // namespace. Fix this forward declaration when we do this.
42 class CompressibleStringTable;
43
44 typedef void (*CompressibleStringTableDestructor)(CompressibleStringTable*);
45
46 }
47
38 namespace WTF { 48 namespace WTF {
39 49
40 class AtomicStringTable; 50 class AtomicStringTable;
41 struct ICUConverterWrapper; 51 struct ICUConverterWrapper;
42 52
43 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); 53 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*);
44 54
45 class WTF_EXPORT WTFThreadData { 55 class WTF_EXPORT WTFThreadData {
46 WTF_MAKE_NONCOPYABLE(WTFThreadData); 56 WTF_MAKE_NONCOPYABLE(WTFThreadData);
47 public: 57 public:
48 WTFThreadData(); 58 WTFThreadData();
49 ~WTFThreadData(); 59 ~WTFThreadData();
50 60
51 AtomicStringTable* atomicStringTable() 61 AtomicStringTable* atomicStringTable()
52 { 62 {
53 return m_atomicStringTable; 63 return m_atomicStringTable;
54 } 64 }
55 65
66 blink::CompressibleStringTable* compressibleStringTable()
67 {
68 return m_compressibleStringTable;
69 }
70
56 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } 71 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
57 72
58 private: 73 private:
59 AtomicStringTable* m_atomicStringTable; 74 AtomicStringTable* m_atomicStringTable;
60 AtomicStringTableDestructor m_atomicStringTableDestructor; 75 AtomicStringTableDestructor m_atomicStringTableDestructor;
76 blink::CompressibleStringTable* m_compressibleStringTable;
77 blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor ;
61 OwnPtr<ICUConverterWrapper> m_cachedConverterICU; 78 OwnPtr<ICUConverterWrapper> m_cachedConverterICU;
62 79
63 static ThreadSpecific<WTFThreadData>* staticData; 80 static ThreadSpecific<WTFThreadData>* staticData;
64 friend WTFThreadData& wtfThreadData(); 81 friend WTFThreadData& wtfThreadData();
65 friend class AtomicStringTable; 82 friend class AtomicStringTable;
83 friend class blink::CompressibleStringTable;
66 }; 84 };
67 85
68 inline WTFThreadData& wtfThreadData() 86 inline WTFThreadData& wtfThreadData()
69 { 87 {
70 // WRT WebCore: 88 // WRT WebCore:
71 // 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
72 // on secondary ones, so there is no need for synchronization here. 90 // on secondary ones, so there is no need for synchronization here.
73 // WRT JavaScriptCore: 91 // WRT JavaScriptCore:
74 // wtfThreadData() is initially called from initializeThreading(), ensuri ng 92 // wtfThreadData() is initially called from initializeThreading(), ensuri ng
75 // this is initially called in a pthread_once locked context. 93 // this is initially called in a pthread_once locked context.
76 if (!WTFThreadData::staticData) 94 if (!WTFThreadData::staticData)
77 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; 95 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
78 return **WTFThreadData::staticData; 96 return **WTFThreadData::staticData;
79 } 97 }
80 98
81 } // namespace WTF 99 } // namespace WTF
82 100
83 using WTF::WTFThreadData; 101 using WTF::WTFThreadData;
84 using WTF::wtfThreadData; 102 using WTF::wtfThreadData;
85 103
86 #endif // WTFThreadData_h 104 #endif // WTFThreadData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698