mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-21 05:39:01 +00:00
Address first comments
This commit is contained in:
parent
01fed69b26
commit
bf6fbd173d
@ -718,7 +718,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
int32_t transitionID = [self _startNewTransition];
|
int32_t transitionID = [self _startNewTransition];
|
||||||
|
|
||||||
ASDisplayNodePerformBlockOnEverySubnode(self, ^(ASDisplayNode * _Nonnull node) {
|
ASDisplayNodePerformBlockOnEverySubnode(self, ^(ASDisplayNode * _Nonnull node) {
|
||||||
ASDisplayNodeAssert([node _hasTransitionInProgress] == NO, @"Can't start a transition when one of the subnodes is performing one.");
|
ASDisplayNodeAssert([node _isTransitionInProgress] == NO, @"Can't start a transition when one of the subnodes is performing one.");
|
||||||
node.hierarchyState |= ASHierarchyStateLayoutPending;
|
node.hierarchyState |= ASHierarchyStateLayoutPending;
|
||||||
node.pendingTransitionID = transitionID;
|
node.pendingTransitionID = transitionID;
|
||||||
});
|
});
|
||||||
@ -821,7 +821,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
- (void)cancelLayoutTransitionsInProgress
|
- (void)cancelLayoutTransitionsInProgress
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_propertyLock);
|
ASDN::MutexLocker l(_propertyLock);
|
||||||
if ([self _hasTransitionInProgress]) {
|
if ([self _isTransitionInProgress]) {
|
||||||
// Cancel transition in progress
|
// Cancel transition in progress
|
||||||
[self _finishOrCancelTransition];
|
[self _finishOrCancelTransition];
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
_usesImplicitHierarchyManagement = value;
|
_usesImplicitHierarchyManagement = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)_hasTransitionInProgress
|
- (BOOL)_isTransitionInProgress
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_propertyLock);
|
ASDN::MutexLocker l(_propertyLock);
|
||||||
return _transitionInProgress;
|
return _transitionInProgress;
|
||||||
@ -2445,7 +2445,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trampoline to the main thread if necessary
|
// Trampoline to the main thread if necessary
|
||||||
if (ASDisplayNodeThreadIsMain() == NO && layoutTransition.canTransitionAsynchronous == NO) {
|
if (ASDisplayNodeThreadIsMain() == NO && layoutTransition.isSynchronous == NO) {
|
||||||
|
|
||||||
// Subnode insertions and removals need to happen always on the main thread if at least one subnode is already loaded
|
// Subnode insertions and removals need to happen always on the main thread if at least one subnode is already loaded
|
||||||
ASPerformBlockOnMainThread(^{
|
ASPerformBlockOnMainThread(^{
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
/**
|
/**
|
||||||
* Returns if the layout transition can happen asynchronously
|
* Returns if the layout transition can happen asynchronously
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly, assign) BOOL canTransitionAsynchronous;
|
@property (nonatomic, readonly, assign, getter=isSynchronous) BOOL synchronous;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a newly initialized layout transition
|
* Returns a newly initialized layout transition
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
* Search the whole layout stack if at least one layout has a layoutable object that can not be layed out asynchronous.
|
* Search the whole layout stack if at least one layout has a layoutable object that can not be layed out asynchronous.
|
||||||
* This can be the case for example if a node was already loaded
|
* This can be the case for example if a node was already loaded
|
||||||
*/
|
*/
|
||||||
static BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
||||||
// Queue used to keep track of sublayouts while traversing this layout in a BFS fashion.
|
// Queue used to keep track of sublayouts while traversing this layout in a BFS fashion.
|
||||||
std::queue<ASLayout *> queue;
|
std::queue<ASLayout *> queue;
|
||||||
queue.push(layout);
|
queue.push(layout);
|
||||||
@ -71,7 +71,7 @@ static BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)canTransitionAsynchronous
|
- (BOOL)isSynchronous
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_propertyLock);
|
ASDN::MutexLocker l(_propertyLock);
|
||||||
return ASLayoutCanTransitionAsynchronous(_pendingLayout);
|
return ASLayoutCanTransitionAsynchronous(_pendingLayout);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user