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:
Michael Schneider
2016-07-11 17:04:47 -07:00
committed by appleguy
parent 93ee42db57
commit 7f4737217e

View File

@@ -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