Merge pull request #1539 from nguyenhuy/remove_ASDisplayNode_async_sizing

[ASDisplayNode][Refactoring] Remove internal and unused async sizing methods
This commit is contained in:
appleguy
2016-04-16 16:53:55 -07:00
2 changed files with 4 additions and 41 deletions

View File

@@ -681,6 +681,10 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
});
void (^transitionBlock)() = ^{
if ([self _shouldAbortTransitionWithID:transitionID]) {
return;
}
ASLayout *newLayout;
{
ASLayoutableSetCurrentContext(ASLayoutableContextMake(transitionID, NO));
@@ -2599,19 +2603,6 @@ static const char *ASDisplayNodeDrawingPriorityKey = "ASDrawingPriority";
_flags.isInHierarchy = inHierarchy;
}
+ (dispatch_queue_t)asyncSizingQueue
{
static dispatch_queue_t asyncSizingQueue = NULL;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
asyncSizingQueue = dispatch_queue_create("org.AsyncDisplayKit.ASDisplayNode.asyncSizingQueue", DISPATCH_QUEUE_CONCURRENT);
// we use the highpri queue to prioritize UI rendering over other async operations
dispatch_set_target_queue(asyncSizingQueue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));
});
return asyncSizingQueue;
}
- (BOOL)_hasTransitionsInProgress
{
ASDN::MutexLocker l(_propertyLock);
@@ -2639,33 +2630,6 @@ static const char *ASDisplayNodeDrawingPriorityKey = "ASDrawingPriority";
return [_transitionSentinel increment];
}
// Calls completion with nil to indicated cancellation
- (void)_enqueueAsyncSizingWithSentinel:(ASSentinel *)sentinel completion:(void(^)(ASDisplayNode *n))completion;
{
int32_t sentinelValue = sentinel.value;
// This is what we're going to use for sizing. Hope you like it :D
CGRect bounds = self.bounds;
dispatch_async([[self class] asyncSizingQueue], ^{
// Check sentinel before, bail early
if (sentinel.value != sentinelValue)
return dispatch_async(dispatch_get_main_queue(), ^{ completion(nil); });
[self measure:bounds.size];
// Check sentinel after, bail early
if (sentinel.value != sentinelValue)
return dispatch_async(dispatch_get_main_queue(), ^{ completion(nil); });
// Success; not cancelled
dispatch_async(dispatch_get_main_queue(), ^{
completion(self);
});
});
}
- (id<ASLayoutable>)finalLayoutable
{
return self;

View File

@@ -75,7 +75,6 @@ for (ASDisplayNode *n in @[ nodes ]) {\
@interface ASDisplayNode (HackForTests)
+ (dispatch_queue_t)asyncSizingQueue;
- (id)initWithViewClass:(Class)viewClass;
- (id)initWithLayerClass:(Class)layerClass;