Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AsyncDisplayKit/ASCollectionNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;
- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread.
Expand All @@ -182,7 +182,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchUpdates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;
- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Blocks execution of the main thread until all section and item updates are committed to the view. This method must be called from the main thread.
Expand Down
4 changes: 2 additions & 2 deletions AsyncDisplayKit/ASCollectionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.");
- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.");

/**
* Perform a batch of updates asynchronously. This method must be called from the main thread.
Expand All @@ -236,7 +236,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchUpdates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.");
- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.");

/**
* Reload everything from scratch, destroying the working range and all cached nodes.
Expand Down
4 changes: 2 additions & 2 deletions AsyncDisplayKit/ASDisplayNode+Subclasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ NS_ASSUME_NONNULL_BEGIN
* @note Called on the display queue and/or main queue (MUST BE THREAD SAFE)
*/
+ (void)drawRect:(CGRect)bounds withParameters:(nullable id <NSObject>)parameters
isCancelled:(__attribute((noescape)) asdisplaynode_iscancelled_block_t)isCancelledBlock
isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock
isRasterizing:(BOOL)isRasterizing;

/**
Expand All @@ -212,7 +212,7 @@ NS_ASSUME_NONNULL_BEGIN
* @note Called on the display queue and/or main queue (MUST BE THREAD SAFE)
*/
+ (nullable UIImage *)displayWithParameters:(nullable id<NSObject>)parameters
isCancelled:(__attribute((noescape)) asdisplaynode_iscancelled_block_t)isCancelledBlock;
isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock;

/**
* @abstract Delegate override for drawParameters
Expand Down
4 changes: 2 additions & 2 deletions AsyncDisplayKit/ASTableNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;
- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread.
Expand All @@ -159,7 +159,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchUpdates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;
- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread.
Expand Down
9 changes: 5 additions & 4 deletions AsyncDisplayKit/Details/_ASDisplayLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//

#import <UIKit/UIKit.h>
#import <AsyncDisplayKit/ASBaseDefines.h>

@class ASDisplayNode;
@protocol _ASDisplayLayerDelegate;
Expand Down Expand Up @@ -103,27 +104,27 @@ typedef BOOL(^asdisplaynode_iscancelled_block_t)(void);
@param isCancelledBlock Execute this block to check whether the current drawing operation has been cancelled to avoid unnecessary work. A return value of YES means cancel drawing and return.
@param isRasterizing YES if the layer is being rasterized into another layer, in which case drawRect: probably wants to avoid doing things like filling its bounds with a zero-alpha color to clear the backing store.
*/
+ (void)drawRect:(CGRect)bounds withParameters:(id<NSObject>)parameters isCancelled:(__attribute((noescape)) asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing;
+ (void)drawRect:(CGRect)bounds withParameters:(id<NSObject>)parameters isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing;

/**
@summary Delegate override to provide new layer contents as a UIImage.
@param parameters An object describing all of the properties you need to draw. Return this from -drawParametersForAsyncLayer:
@param isCancelledBlock Execute this block to check whether the current drawing operation has been cancelled to avoid unnecessary work. A return value of YES means cancel drawing and return.
@return A UIImage with contents that are ready to display on the main thread. Make sure that the image is already decoded before returning it here.
*/
+ (UIImage *)displayWithParameters:(id<NSObject>)parameters isCancelled:(__attribute((noescape)) asdisplaynode_iscancelled_block_t)isCancelledBlock;
+ (UIImage *)displayWithParameters:(id<NSObject>)parameters isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock;

/**
* @abstract instance version of drawRect class method
* @see drawRect:withParameters:isCancelled:isRasterizing class method
*/
- (void)drawRect:(CGRect)bounds withParameters:(id <NSObject>)parameters isCancelled:(__attribute((noescape)) asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing;
- (void)drawRect:(CGRect)bounds withParameters:(id <NSObject>)parameters isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing;

/**
* @abstract instance version of display class method
* @see displayWithParameters:isCancelled class method
*/
- (UIImage *)displayWithParameters:(id <NSObject>)parameters isCancelled:(__attribute((noescape)) asdisplaynode_iscancelled_block_t)isCancelled;
- (UIImage *)displayWithParameters:(id <NSObject>)parameters isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelled;

// Called on the main thread only

Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/Layout/ASLayoutElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ extern NSString * const ASLayoutElementStyleLayoutPositionProperty;

@protocol ASLayoutElementStylability

- (instancetype)styledWithBlock:(__attribute__((noescape)) void (^)(__kindof ASLayoutElementStyle *style))styleBlock;
- (instancetype)styledWithBlock:(AS_NOESCAPE void (^)(__kindof ASLayoutElementStyle *style))styleBlock;

@end

Expand Down
4 changes: 2 additions & 2 deletions AsyncDisplayKit/Private/ASCollectionView+Undeprecated.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;
- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Perform a batch of updates asynchronously. This method must be called from the main thread.
Expand All @@ -142,7 +142,7 @@ NS_ASSUME_NONNULL_BEGIN
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchUpdates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;
- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Reload everything from scratch, destroying the working range and all cached nodes.
Expand Down
3 changes: 2 additions & 1 deletion AsyncDisplayKitTests/ASPerformanceTestContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import <Foundation/Foundation.h>
#import <XCTest/XCTestAssertionsImpl.h>
#import <AsyncDisplayKit/ASBaseDefines.h>

#define ASXCTAssertRelativePerformanceInRange(test, caseName, min, max) \
_XCTPrimitiveAssertLessThanOrEqual(self, test.results[caseName].relativePerformance, @#caseName, max, @#max);\
Expand All @@ -32,7 +33,7 @@ typedef void (^ASTestPerformanceCaseBlock)(NSUInteger i, dispatch_block_t startM
/**
* The first case you add here will be considered the reference case.
*/
- (void)addCaseWithName:(NSString *)caseName block:(__attribute((noescape)) ASTestPerformanceCaseBlock)block;
- (void)addCaseWithName:(NSString *)caseName block:(AS_NOESCAPE ASTestPerformanceCaseBlock)block;

@property (nonatomic, copy, readonly) NSDictionary<NSString *, ASPerformanceTestResult *> *results;

Expand Down
4 changes: 2 additions & 2 deletions AsyncDisplayKitTests/ASPerformanceTestContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ - (BOOL)areAllUserInfosEqual
return YES;
}

- (void)addCaseWithName:(NSString *)caseName block:(__attribute((noescape)) ASTestPerformanceCaseBlock)block
- (void)addCaseWithName:(NSString *)caseName block:(AS_NOESCAPE ASTestPerformanceCaseBlock)block
{
ASDisplayNodeAssert(_results[caseName] == nil, @"Already have a case named %@", caseName);
ASPerformanceTestResult *result = [[ASPerformanceTestResult alloc] init];
Expand All @@ -91,7 +91,7 @@ - (void)addCaseWithName:(NSString *)caseName block:(__attribute((noescape)) ASTe
}

/// Returns total work time
- (CFTimeInterval)_testPerformanceForCaseWithBlock:(__attribute((noescape)) ASTestPerformanceCaseBlock)block
- (CFTimeInterval)_testPerformanceForCaseWithBlock:(AS_NOESCAPE ASTestPerformanceCaseBlock)block
{
__block CFTimeInterval time = 0;
for (NSInteger i = 0; i < _iterationCount; i++) {
Expand Down
7 changes: 7 additions & 0 deletions Base/ASBaseDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@

#define ASOVERLOADABLE __attribute__((overloadable))


#if __has_attribute(noescape)
#define AS_NOESCAPE __attribute__((noescape))
#else
#define AS_NOESCAPE
#endif

/// Ensure that class is of certain kind
#define ASDynamicCast(x, c) ({ \
id __val = x;\
Expand Down