Changeset 225667 in webkit
- Timestamp:
- Dec 7, 2017 7:02:26 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r225663 r225667 1 2017-12-07 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Use WTF::RecursiveLockAdapter instead of using pthread_mutex_t with recursive lock option 4 https://bugs.webkit.org/show_bug.cgi?id=180449 5 6 Reviewed by Mark Lam. 7 8 Use WTF::RecursiveLockAdapter<StaticLock> instead. We can remove pthread_mutex_xxx, 9 pthread_once and FontLocker wrapper. 10 11 * platform/graphics/FontCache.cpp: 12 (WebCore::FontCache::getCachedFontPlatformData): 13 (WebCore::FontCache::fontForPlatformData): 14 (WebCore::FontCache::purgeInactiveFontData): 15 (WebCore::FontCache::inactiveFontCount): 16 (initFontCacheLockOnce): Deleted. 17 (FontLocker::FontLocker): Deleted. 18 (FontLocker::~FontLocker): Deleted. 19 1 20 2017-12-07 Eric Carlson <eric.carlson@apple.com> 2 21 -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r223476 r225667 51 51 52 52 #if PLATFORM(IOS) 53 #include <wtf/Noncopyable.h> 54 55 // FIXME: We may be able to simplify this code using C++11 threading primitives, including std::call_once(). 56 static pthread_mutex_t fontLock; 57 58 static void initFontCacheLockOnce() 59 { 60 pthread_mutexattr_t mutexAttribute; 61 pthread_mutexattr_init(&mutexAttribute); 62 pthread_mutexattr_settype(&mutexAttribute, PTHREAD_MUTEX_RECURSIVE); 63 pthread_mutex_init(&fontLock, &mutexAttribute); 64 pthread_mutexattr_destroy(&mutexAttribute); 65 } 66 67 static pthread_once_t initFontLockControl = PTHREAD_ONCE_INIT; 68 69 class FontLocker { 70 WTF_MAKE_NONCOPYABLE(FontLocker); 71 public: 72 FontLocker() 73 { 74 pthread_once(&initFontLockControl, initFontCacheLockOnce); 75 int lockcode = pthread_mutex_lock(&fontLock); 76 ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontLock lock failed with code:%d", lockcode); 77 } 78 ~FontLocker() 79 { 80 int lockcode = pthread_mutex_unlock(&fontLock); 81 ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontLock unlock failed with code:%d", lockcode); 82 } 83 }; 53 #include <wtf/Lock.h> 54 #include <wtf/RecursiveLockAdapter.h> 55 56 using RecursiveStaticLock = WTF::RecursiveLockAdapter<StaticLock>; 57 static RecursiveStaticLock fontLock; 58 84 59 #endif // PLATFORM(IOS) 85 60 … … 233 208 { 234 209 #if PLATFORM(IOS) 235 FontLocker fontLocker;210 auto locker = holdLock(fontLock); 236 211 #endif 237 212 … … 361 336 { 362 337 #if PLATFORM(IOS) 363 FontLocker fontLocker;338 auto locker = holdLock(fontLock); 364 339 #endif 365 340 … … 394 369 395 370 #if PLATFORM(IOS) 396 FontLocker fontLocker;371 auto locker = holdLock(fontLock); 397 372 #endif 398 373 … … 438 413 { 439 414 #if PLATFORM(IOS) 440 FontLocker fontLocker;415 auto locker = holdLock(fontLock); 441 416 #endif 442 417 unsigned count = 0;
Note: See TracChangeset
for help on using the changeset viewer.