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

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

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent 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 25 matching lines...) Expand all
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 struct ICUConverterWrapper; 41 struct ICUConverterWrapper;
42 42
43 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); 43 typedef void (*AtomicStringTableDestructor)(AtomicStringTable*);
44 44
45 class WTF_EXPORT WTFThreadData { 45 class WTF_EXPORT WTFThreadData {
46 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 46 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
47 WTF_MAKE_NONCOPYABLE(WTFThreadData); 47 WTF_MAKE_NONCOPYABLE(WTFThreadData);
48 public:
49 WTFThreadData();
50 ~WTFThreadData();
51 48
52 AtomicStringTable* atomicStringTable() 49 public:
53 { 50 WTFThreadData();
54 return m_atomicStringTable; 51 ~WTFThreadData();
55 }
56 52
57 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } 53 AtomicStringTable* atomicStringTable() { return m_atomicStringTable; }
58 54
59 private: 55 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
60 AtomicStringTable* m_atomicStringTable;
61 AtomicStringTableDestructor m_atomicStringTableDestructor;
62 OwnPtr<ICUConverterWrapper> m_cachedConverterICU;
63 56
64 static ThreadSpecific<WTFThreadData>* staticData; 57 private:
65 friend WTFThreadData& wtfThreadData(); 58 AtomicStringTable* m_atomicStringTable;
66 friend class AtomicStringTable; 59 AtomicStringTableDestructor m_atomicStringTableDestructor;
60 OwnPtr<ICUConverterWrapper> m_cachedConverterICU;
61
62 static ThreadSpecific<WTFThreadData>* staticData;
63 friend WTFThreadData& wtfThreadData();
64 friend class AtomicStringTable;
67 }; 65 };
68 66
69 inline WTFThreadData& wtfThreadData() 67 inline WTFThreadData& wtfThreadData() {
70 { 68 // WRT WebCore:
71 // WRT WebCore: 69 // WTFThreadData is used on main thread before it could possibly be used
72 // WTFThreadData is used on main thread before it could possibly be used 70 // on secondary ones, so there is no need for synchronization here.
73 // on secondary ones, so there is no need for synchronization here. 71 // WRT JavaScriptCore:
74 // WRT JavaScriptCore: 72 // wtfThreadData() is initially called from initializeThreading(), ensuring
75 // wtfThreadData() is initially called from initializeThreading(), ensuri ng 73 // this is initially called in a pthread_once locked context.
76 // this is initially called in a pthread_once locked context. 74 if (!WTFThreadData::staticData)
77 if (!WTFThreadData::staticData) 75 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
78 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; 76 return **WTFThreadData::staticData;
79 return **WTFThreadData::staticData;
80 } 77 }
81 78
82 } // namespace WTF 79 } // namespace WTF
83 80
84 using WTF::WTFThreadData; 81 using WTF::WTFThreadData;
85 using WTF::wtfThreadData; 82 using WTF::wtfThreadData;
86 83
87 #endif // WTFThreadData_h 84 #endif // WTFThreadData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/WTFExport.h ('k') | third_party/WebKit/Source/wtf/WTFThreadData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698