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

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

Issue 2627153004: Use TLS storage for thread ids in wtf/ThreadingPThreads (Closed)
Patch Set: esprehn suggestion Created 3 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 WTF_MAKE_NONCOPYABLE(WTFThreadData); 46 WTF_MAKE_NONCOPYABLE(WTFThreadData);
47 47
48 public: 48 public:
49 WTFThreadData(); 49 WTFThreadData();
50 ~WTFThreadData(); 50 ~WTFThreadData();
51 51
52 AtomicStringTable& getAtomicStringTable() { return *m_atomicStringTable; } 52 AtomicStringTable& getAtomicStringTable() { return *m_atomicStringTable; }
53 53
54 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } 54 ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
55 55
56 ThreadIdentifier threadId() { return m_threadId; }
esprehn 2017/01/12 19:38:49 const
Charlie Harrison 2017/01/12 19:44:33 Done.
57
56 private: 58 private:
57 std::unique_ptr<AtomicStringTable> m_atomicStringTable; 59 std::unique_ptr<AtomicStringTable> m_atomicStringTable;
58 std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU; 60 std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU;
59 61
62 ThreadIdentifier m_threadId;
63
60 static ThreadSpecific<WTFThreadData>* staticData; 64 static ThreadSpecific<WTFThreadData>* staticData;
61 friend WTFThreadData& wtfThreadData(); 65 friend WTFThreadData& wtfThreadData();
62 }; 66 };
63 67
64 inline WTFThreadData& wtfThreadData() { 68 inline WTFThreadData& wtfThreadData() {
65 // WTFThreadData is used on main thread before it could possibly be used 69 // WTFThreadData is used on main thread before it could possibly be used
66 // on secondary ones, so there is no need for synchronization here. 70 // on secondary ones, so there is no need for synchronization here.
67 if (!WTFThreadData::staticData) 71 if (!WTFThreadData::staticData)
68 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>; 72 WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
69 return **WTFThreadData::staticData; 73 return **WTFThreadData::staticData;
70 } 74 }
71 75
72 } // namespace WTF 76 } // namespace WTF
73 77
74 using WTF::WTFThreadData; 78 using WTF::WTFThreadData;
75 using WTF::wtfThreadData; 79 using WTF::wtfThreadData;
76 80
77 #endif // WTFThreadData_h 81 #endif // WTFThreadData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/ThreadingPthreads.cpp ('k') | third_party/WebKit/Source/wtf/WTFThreadData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698