mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Change from MutexLocker / MutexUnlocker to lock() and unlock() directly on property lock (#1900)
For performance reasons change to directly lock and unlock calls on the property lock instance
This commit is contained in:
committed by
appleguy
parent
93ee42db57
commit
7f4737217e
@@ -1055,9 +1055,10 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
- (void)__setNeedsLayout
|
||||
{
|
||||
ASDisplayNodeAssertThreadAffinity(self);
|
||||
ASDN::MutexLocker l(_propertyLock);
|
||||
_propertyLock.lock();
|
||||
|
||||
if ([self _hasDirtyLayout]) {
|
||||
_propertyLock.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1065,7 +1066,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
|
||||
if (_supernode) {
|
||||
ASDisplayNode *supernode = _supernode;
|
||||
ASDN::MutexUnlocker u(_propertyLock);
|
||||
_propertyLock.unlock();
|
||||
// Cause supernode's layout to be invalidated
|
||||
// We need to release the lock to prevent a deadlock
|
||||
[supernode setNeedsLayout];
|
||||
@@ -1090,6 +1091,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
CGFloat yDelta = (newSize.height - oldSize.height) * anchorPoint.y;
|
||||
self.position = CGPointMake(oldPosition.x + xDelta, oldPosition.y + yDelta);
|
||||
}
|
||||
_propertyLock.unlock();
|
||||
}
|
||||
|
||||
- (void)__setNeedsDisplay
|
||||
|
||||
Reference in New Issue
Block a user