Changeset 161849 in webkit
- Timestamp:
- Jan 12, 2014 6:23:52 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r161840 r161849 1 2014-01-12 Anders Carlsson <andersca@apple.com> 2 3 Remove the last remaining uses of AtomicallyInitializedStatic 4 https://bugs.webkit.org/show_bug.cgi?id=126863 5 6 Reviewed by Darin Adler. 7 8 * wtf/HashTable.cpp: 9 (WTF::hashTableStatsMutex): 10 (WTF::HashTableStats::recordCollisionAtCount): 11 (WTF::HashTableStats::dumpStats): 12 * wtf/unicode/icu/CollatorICU.cpp: 13 (WTF::cachedCollatorMutex): 14 (WTF::Collator::createCollator): 15 (WTF::Collator::releaseCollator): 16 1 17 2014-01-12 Darin Adler <darin@apple.com> 2 18 -
trunk/Source/WTF/wtf/HashTable.cpp
r135469 r161849 20 20 #include "config.h" 21 21 #include "HashTable.h" 22 22 23 #include "DataLog.h" 24 #include <mutex> 23 25 24 26 namespace WTF { … … 34 36 int HashTableStats::numReinserts; 35 37 36 static Mutex& hashTableStatsMutex()38 static std::mutex& hashTableStatsMutex() 37 39 { 38 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); 39 return mutex; 40 static std::once_flag onceFlag; 41 static std::mutex* mutex; 42 std::call_once(onceFlag, []{ 43 mutex = std::make_unique<std::mutex>().release(); 44 }); 45 46 return *mutex; 40 47 } 41 48 42 49 void HashTableStats::recordCollisionAtCount(int count) 43 50 { 44 MutexLocker lock(hashTableStatsMutex()); 51 std::lock_guard<std::mutex> lock(hashTableStatsMutex()); 52 45 53 if (count > maxCollisions) 46 54 maxCollisions = count; … … 51 59 void HashTableStats::dumpStats() 52 60 { 53 MutexLockerlock(hashTableStatsMutex());61 std::lock_guard<std::mutex> lock(hashTableStatsMutex()); 54 62 55 63 dataLogF("\nWTF::HashTable statistics\n\n"); -
trunk/Source/WTF/wtf/unicode/icu/CollatorICU.cpp
r156968 r161849 32 32 #if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION 33 33 34 #include <mutex> 34 35 #include <wtf/Assertions.h> 35 36 #include <wtf/StringExtras.h> 36 #include <wtf/Threading.h>37 37 #include <unicode/ucol.h> 38 38 #include <string.h> … … 46 46 47 47 static UCollator* cachedCollator; 48 static Mutex& cachedCollatorMutex() 48 49 static std::mutex& cachedCollatorMutex() 49 50 { 50 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); 51 return mutex; 51 static std::once_flag onceFlag; 52 static std::mutex* mutex; 53 std::call_once(onceFlag, []{ 54 mutex = std::make_unique<std::mutex>().release(); 55 }); 56 57 return *mutex; 52 58 } 53 59 … … 105 111 106 112 { 107 Locker<Mutex> lock(cachedCollatorMutex());113 std::lock_guard<std::mutex> lock(cachedCollatorMutex()); 108 114 if (cachedCollator) { 109 115 const char* cachedCollatorLocale = ucol_getLocaleByType(cachedCollator, ULOC_REQUESTED_LOCALE, &status); … … 118 124 && ((UCOL_LOWER_FIRST == cachedCollatorLowerFirst && m_lowerFirst) || (UCOL_UPPER_FIRST == cachedCollatorLowerFirst && !m_lowerFirst))) { 119 125 m_collator = cachedCollator; 120 cachedCollator = 0;126 cachedCollator = nullptr; 121 127 return; 122 128 } … … 141 147 { 142 148 { 143 Locker<Mutex> lock(cachedCollatorMutex());149 std::lock_guard<std::mutex> lock(cachedCollatorMutex()); 144 150 if (cachedCollator) 145 151 ucol_close(cachedCollator); 146 152 cachedCollator = m_collator; 147 m_collator = 0;153 m_collator = nullptr; 148 154 } 149 155 } -
trunk/Source/WebKit2/ChangeLog
r161836 r161849 1 2014-01-12 Anders Carlsson <andersca@apple.com> 2 3 Remove the last remaining uses of AtomicallyInitializedStatic 4 https://bugs.webkit.org/show_bug.cgi?id=126863 5 6 Reviewed by Darin Adler. 7 8 * Shared/mac/SecItemShim.cpp: 9 (WebKit::responseMap): 10 1 11 2014-01-12 Dan Bernstein <mitz@apple.com> 2 12 -
trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp
r161148 r161849 38 38 #include <Security/Security.h> 39 39 #include <dlfcn.h> 40 #include <mutex> 40 41 41 42 namespace WebKit { … … 43 44 static BlockingResponseMap<SecItemResponseData>& responseMap() 44 45 { 45 AtomicallyInitializedStatic(BlockingResponseMap<SecItemResponseData>*, responseMap = new BlockingResponseMap<SecItemResponseData>); 46 static std::once_flag onceFlag; 47 static BlockingResponseMap<SecItemResponseData>* responseMap; 48 49 std::call_once(onceFlag, []{ 50 responseMap = std::make_unique<BlockingResponseMap<SecItemResponseData>>().release(); 51 }); 52 46 53 return *responseMap; 47 54 }
Note: See TracChangeset
for help on using the changeset viewer.