[ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own. (#2754)

* [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own.

This also moves the @package definition of the instance variable to +FrameworkPrivate instead of Internal.h,
because Internal.h should ideally not be used outside of the ASDisplayNode file setup.  This has greatly reduced
the number of imports of Internal.h.

* [ASDisplayNode] Add ASDisplayNode+FrameworkSubclasses.h to share __instanceLock__ definition.
This commit is contained in:
appleguy
2016-12-12 19:42:41 -08:00
committed by GitHub
parent ad37ecfa74
commit eeb977e145
25 changed files with 74 additions and 54 deletions

View File

@@ -475,6 +475,7 @@
DE0702FC1C3671E900D7DE62 /* libAsyncDisplayKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 058D09AC195D04C000B7D73C /* libAsyncDisplayKit.a */; }; DE0702FC1C3671E900D7DE62 /* libAsyncDisplayKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 058D09AC195D04C000B7D73C /* libAsyncDisplayKit.a */; };
DE4843DC1C93EAC100A1F33B /* ASLayoutTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */; }; DE4843DC1C93EAC100A1F33B /* ASLayoutTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */; };
DE6EA3231C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */; }; DE6EA3231C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */; };
DE7EF4F81DFF77720082B84A /* ASDisplayNode+FrameworkSubclasses.h in Headers */ = {isa = PBXBuildFile; fileRef = DE7EF4F71DFF77720082B84A /* ASDisplayNode+FrameworkSubclasses.h */; };
DE84918D1C8FFF2B003D89E9 /* ASRunLoopQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 81EE384D1C8E94F000456208 /* ASRunLoopQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE84918D1C8FFF2B003D89E9 /* ASRunLoopQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 81EE384D1C8E94F000456208 /* ASRunLoopQueue.h */; settings = {ATTRIBUTES = (Public, ); }; };
DE84918E1C8FFF9F003D89E9 /* ASRunLoopQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 81EE384E1C8E94F000456208 /* ASRunLoopQueue.mm */; }; DE84918E1C8FFF9F003D89E9 /* ASRunLoopQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 81EE384E1C8E94F000456208 /* ASRunLoopQueue.mm */; };
DE89C1701DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = DE89C16A1DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.h */; }; DE89C1701DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = DE89C16A1DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.h */; };
@@ -1177,6 +1178,7 @@
DBDB83921C6E879900D0098C /* ASPagerFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPagerFlowLayout.h; sourceTree = "<group>"; }; DBDB83921C6E879900D0098C /* ASPagerFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPagerFlowLayout.h; sourceTree = "<group>"; };
DBDB83931C6E879900D0098C /* ASPagerFlowLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPagerFlowLayout.m; sourceTree = "<group>"; }; DBDB83931C6E879900D0098C /* ASPagerFlowLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPagerFlowLayout.m; sourceTree = "<group>"; };
DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+FrameworkPrivate.h"; sourceTree = "<group>"; }; DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+FrameworkPrivate.h"; sourceTree = "<group>"; };
DE7EF4F71DFF77720082B84A /* ASDisplayNode+FrameworkSubclasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+FrameworkSubclasses.h"; sourceTree = "<group>"; };
DE89C16A1DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementInspectorCell.h; sourceTree = "<group>"; }; DE89C16A1DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementInspectorCell.h; sourceTree = "<group>"; };
DE89C16B1DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLayoutElementInspectorCell.m; sourceTree = "<group>"; }; DE89C16B1DCEB9CC00D49D74 /* ASLayoutElementInspectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLayoutElementInspectorCell.m; sourceTree = "<group>"; };
DE89C16C1DCEB9CC00D49D74 /* ASLayoutElementInspectorNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementInspectorNode.h; sourceTree = "<group>"; }; DE89C16C1DCEB9CC00D49D74 /* ASLayoutElementInspectorNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementInspectorNode.h; sourceTree = "<group>"; };
@@ -1598,6 +1600,7 @@
058D0A09195D050800B7D73C /* ASDisplayNode+DebugTiming.h */, 058D0A09195D050800B7D73C /* ASDisplayNode+DebugTiming.h */,
058D0A0A195D050800B7D73C /* ASDisplayNode+DebugTiming.mm */, 058D0A0A195D050800B7D73C /* ASDisplayNode+DebugTiming.mm */,
DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */, DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */,
DE7EF4F71DFF77720082B84A /* ASDisplayNode+FrameworkSubclasses.h */,
058D0A0B195D050800B7D73C /* ASDisplayNode+UIViewBridge.mm */, 058D0A0B195D050800B7D73C /* ASDisplayNode+UIViewBridge.mm */,
058D0A0C195D050800B7D73C /* ASDisplayNodeInternal.h */, 058D0A0C195D050800B7D73C /* ASDisplayNodeInternal.h */,
6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */, 6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */,
@@ -1814,6 +1817,7 @@
69F10C871C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */, 69F10C871C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */,
B350623C1B010EFD0018CF92 /* _ASAsyncTransaction.h in Headers */, B350623C1B010EFD0018CF92 /* _ASAsyncTransaction.h in Headers */,
9C70F20D1CDBE9CB007D6C76 /* ASDefaultPlayButton.h in Headers */, 9C70F20D1CDBE9CB007D6C76 /* ASDefaultPlayButton.h in Headers */,
DE7EF4F81DFF77720082B84A /* ASDisplayNode+FrameworkSubclasses.h in Headers */,
68355B411CB57A6C001D4E68 /* ASImageContainerProtocolCategories.h in Headers */, 68355B411CB57A6C001D4E68 /* ASImageContainerProtocolCategories.h in Headers */,
7630FFA81C9E267E007A7C0E /* ASVideoNode.h in Headers */, 7630FFA81C9E267E007A7C0E /* ASVideoNode.h in Headers */,
B350623F1B010EFD0018CF92 /* _ASAsyncTransactionContainer.h in Headers */, B350623F1B010EFD0018CF92 /* _ASAsyncTransactionContainer.h in Headers */,

View File

@@ -11,15 +11,13 @@
#import "ASButtonNode.h" #import "ASButtonNode.h"
#import "ASStackLayoutSpec.h" #import "ASStackLayoutSpec.h"
#import "ASThread.h" #import "ASThread.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASBackgroundLayoutSpec.h" #import "ASBackgroundLayoutSpec.h"
#import "ASInsetLayoutSpec.h" #import "ASInsetLayoutSpec.h"
#import "ASAbsoluteLayoutSpec.h" #import "ASAbsoluteLayoutSpec.h"
@interface ASButtonNode () @interface ASButtonNode ()
{ {
ASDN::RecursiveMutex __instanceLock__;
NSAttributedString *_normalAttributedTitle; NSAttributedString *_normalAttributedTitle;
NSAttributedString *_highlightedAttributedTitle; NSAttributedString *_highlightedAttributedTitle;
NSAttributedString *_selectedAttributedTitle; NSAttributedString *_selectedAttributedTitle;

View File

@@ -12,7 +12,6 @@
#import "ASEqualityHelpers.h" #import "ASEqualityHelpers.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
#import "ASDisplayNodeInternal.h"
#import "ASDisplayNode+FrameworkPrivate.h" #import "ASDisplayNode+FrameworkPrivate.h"
#import "ASCollectionView+Undeprecated.h" #import "ASCollectionView+Undeprecated.h"
#import "ASTableView+Undeprecated.h" #import "ASTableView+Undeprecated.h"

View File

@@ -13,8 +13,8 @@
#import "ASCollectionInternal.h" #import "ASCollectionInternal.h"
#import "ASCollectionViewLayoutFacilitatorProtocol.h" #import "ASCollectionViewLayoutFacilitatorProtocol.h"
#import "ASCollectionNode.h" #import "ASCollectionNode.h"
#import "ASDisplayNodeInternal.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+Subclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASEnvironmentInternal.h" #import "ASEnvironmentInternal.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
#import "ASCellNode+Internal.h" #import "ASCellNode+Internal.h"
@@ -228,7 +228,7 @@
// and asserting here isn't an option it is a common pattern for users to clear // and asserting here isn't an option it is a common pattern for users to clear
// the delegate/dataSource in dealloc, which may be running on a background thread. // the delegate/dataSource in dealloc, which may be running on a background thread.
// It is important that we avoid retaining self in this block, so that this method is dealloc-safe. // It is important that we avoid retaining self in this block, so that this method is dealloc-safe.
ASCollectionView *view = (ASCollectionView *)_view; ASCollectionView *view = self.view;
ASPerformBlockOnMainThread(^{ ASPerformBlockOnMainThread(^{
view.asyncDelegate = delegate; view.asyncDelegate = delegate;
}); });
@@ -254,7 +254,7 @@
// and asserting here isn't an option it is a common pattern for users to clear // and asserting here isn't an option it is a common pattern for users to clear
// the delegate/dataSource in dealloc, which may be running on a background thread. // the delegate/dataSource in dealloc, which may be running on a background thread.
// It is important that we avoid retaining self in this block, so that this method is dealloc-safe. // It is important that we avoid retaining self in this block, so that this method is dealloc-safe.
ASCollectionView *view = (ASCollectionView *)_view; ASCollectionView *view = self.view;
ASPerformBlockOnMainThread(^{ ASPerformBlockOnMainThread(^{
view.asyncDataSource = dataSource; view.asyncDataSource = dataSource;
}); });

View File

@@ -9,8 +9,7 @@
// //
#import "ASDisplayNodeInternal.h" #import "ASDisplayNodeInternal.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASDisplayNode+Beta.h" #import "ASDisplayNode+Beta.h"
#import "AsyncDisplayKit+Debug.h" #import "AsyncDisplayKit+Debug.h"

View File

@@ -15,22 +15,22 @@
#import "_ASDisplayLayer.h" #import "_ASDisplayLayer.h"
#import "ASAssert.h" #import "ASAssert.h"
#import "ASDimension.h" #import "ASDimension.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASDisplayNodeInternal.h"
#import "ASDisplayNodeExtras.h" #import "ASDisplayNodeExtras.h"
#import "ASDisplayNode+Beta.h" #import "ASDisplayNode+Beta.h"
#import "ASLayout.h" #import "ASLayout.h"
#import "ASTextNode.h" #import "ASTextNode.h"
#import "ASImageNode+AnimatedImagePrivate.h" #import "ASImageNode+AnimatedImagePrivate.h"
#import "ASImageNode+CGExtras.h" #import "ASImageNode+CGExtras.h"
#import "AsyncDisplayKit+Debug.h" #import "AsyncDisplayKit+Debug.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
#import "ASEqualityHelpers.h" #import "ASEqualityHelpers.h"
#import "ASEqualityHashHelpers.h" #import "ASEqualityHashHelpers.h"
#import "ASWeakMap.h" #import "ASWeakMap.h"
// TODO: It would be nice to remove this dependency; it's the only subclass using more than +FrameworkSubclasses.h
#import "ASDisplayNodeInternal.h"
#include <functional> #include <functional>
struct ASImageNodeDrawParameters { struct ASImageNodeDrawParameters {
@@ -244,7 +244,7 @@ struct ASImageNodeDrawParameters {
_drawParameter = { _drawParameter = {
.bounds = self.bounds, .bounds = self.bounds,
.opaque = self.opaque, .opaque = self.opaque,
.contentsScale = _contentsScaleForDisplay, .contentsScale = self.contentsScaleForDisplay,
.backgroundColor = self.backgroundColor, .backgroundColor = self.backgroundColor,
.contentMode = self.contentMode, .contentMode = self.contentMode,
.cropEnabled = _cropEnabled, .cropEnabled = _cropEnabled,

View File

@@ -13,8 +13,7 @@
#import <tgmath.h> #import <tgmath.h>
#import "ASDisplayNodeInternal.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASDisplayNode+Subclasses.h"
#import "ASDisplayNodeExtras.h" #import "ASDisplayNodeExtras.h"
#import "ASInsetLayoutSpec.h" #import "ASInsetLayoutSpec.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"

View File

@@ -14,8 +14,7 @@
#import <AssetsLibrary/AssetsLibrary.h> #import <AssetsLibrary/AssetsLibrary.h>
#import "ASAvailability.h" #import "ASAvailability.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASDisplayNodeExtras.h" #import "ASDisplayNodeExtras.h"
#import "ASLog.h" #import "ASLog.h"
#import "ASPhotosFrameworkImageRequest.h" #import "ASPhotosFrameworkImageRequest.h"
@@ -84,7 +83,6 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
id _downloadIdentifier; id _downloadIdentifier;
// Properties // Properties
ASDN::RecursiveMutex __instanceLock__;
BOOL _shouldRenderProgressImages; BOOL _shouldRenderProgressImages;
//set on init only //set on init only

View File

@@ -11,10 +11,8 @@
#import "ASNetworkImageNode.h" #import "ASNetworkImageNode.h"
#import "ASBasicImageDownloader.h" #import "ASBasicImageDownloader.h"
#import "ASDisplayNodeInternal.h"
#import "ASDisplayNodeExtras.h" #import "ASDisplayNodeExtras.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASEqualityHelpers.h" #import "ASEqualityHelpers.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
#import "ASImageContainerProtocolCategories.h" #import "ASImageContainerProtocolCategories.h"

View File

@@ -13,8 +13,8 @@
#import "ASTableNode.h" #import "ASTableNode.h"
#import "ASTableViewInternal.h" #import "ASTableViewInternal.h"
#import "ASEnvironmentInternal.h" #import "ASEnvironmentInternal.h"
#import "ASDisplayNodeInternal.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+Subclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
#import "ASCellNode+Internal.h" #import "ASCellNode+Internal.h"
#import "AsyncDisplayKit+Debug.h" #import "AsyncDisplayKit+Debug.h"
@@ -197,7 +197,7 @@
// and asserting here isn't an option it is a common pattern for users to clear // and asserting here isn't an option it is a common pattern for users to clear
// the delegate/dataSource in dealloc, which may be running on a background thread. // the delegate/dataSource in dealloc, which may be running on a background thread.
// It is important that we avoid retaining self in this block, so that this method is dealloc-safe. // It is important that we avoid retaining self in this block, so that this method is dealloc-safe.
ASTableView *view = (ASTableView *)_view; ASTableView *view = self.view;
ASPerformBlockOnMainThread(^{ ASPerformBlockOnMainThread(^{
view.asyncDelegate = delegate; view.asyncDelegate = delegate;
}); });
@@ -224,7 +224,7 @@
// and asserting here isn't an option it is a common pattern for users to clear // and asserting here isn't an option it is a common pattern for users to clear
// the delegate/dataSource in dealloc, which may be running on a background thread. // the delegate/dataSource in dealloc, which may be running on a background thread.
// It is important that we avoid retaining self in this block, so that this method is dealloc-safe. // It is important that we avoid retaining self in this block, so that this method is dealloc-safe.
ASTableView *view = (ASTableView *)_view; ASTableView *view = self.view;
ASPerformBlockOnMainThread(^{ ASPerformBlockOnMainThread(^{
view.asyncDataSource = dataSource; view.asyncDataSource = dataSource;
}); });

View File

@@ -15,8 +15,7 @@
#import <tgmath.h> #import <tgmath.h>
#import "_ASDisplayLayer.h" #import "_ASDisplayLayer.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASDisplayNodeInternal.h"
#import "ASHighlightOverlayLayer.h" #import "ASHighlightOverlayLayer.h"
#import "ASDisplayNodeExtras.h" #import "ASDisplayNodeExtras.h"

View File

@@ -9,9 +9,7 @@
// //
#if TARGET_OS_IOS #if TARGET_OS_IOS
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
#import "ASDisplayNodeInternal.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASDisplayNode+Subclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASVideoNode.h" #import "ASVideoNode.h"
#import "ASEqualityHelpers.h" #import "ASEqualityHelpers.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"

View File

@@ -12,7 +12,7 @@
#import "ASVideoPlayerNode.h" #import "ASVideoPlayerNode.h"
#import "ASDefaultPlaybackButton.h" #import "ASDefaultPlaybackButton.h"
#import "ASDisplayNodeInternal.h" #import "ASDisplayNode+FrameworkSubclasses.h"
static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;

View File

@@ -13,7 +13,6 @@
#import "ASViewController.h" #import "ASViewController.h"
#import "ASAssert.h" #import "ASAssert.h"
#import "ASAvailability.h" #import "ASAvailability.h"
#import "ASDisplayNodeInternal.h"
#import "ASDisplayNode+FrameworkPrivate.h" #import "ASDisplayNode+FrameworkPrivate.h"
#import "ASLayout.h" #import "ASLayout.h"
#import "ASTraitCollection.h" #import "ASTraitCollection.h"

View File

@@ -13,8 +13,7 @@
#import "ASAssert.h" #import "ASAssert.h"
#import "ASCellNode.h" #import "ASCellNode.h"
#import "ASDisplayNodeExtras.h" #import "ASDisplayNodeExtras.h"
#import "ASDisplayNodeInternal.h" #import "ASDisplayNodeInternal.h" // Required for interfaceState and hierarchyState setter methods.
#import "ASMultidimensionalArrayUtils.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
#import "ASMultiDimensionalArrayUtils.h" #import "ASMultiDimensionalArrayUtils.h"
#import "ASWeakSet.h" #import "ASWeakSet.h"

View File

@@ -82,9 +82,9 @@ ASDISPLAYNODE_EXTERN_C_END
* Designated initializer * Designated initializer
*/ */
- (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement - (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement
size:(CGSize)size size:(CGSize)size
position:(CGPoint)position position:(CGPoint)position
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts NS_DESIGNATED_INITIALIZER; sublayouts:(nullable NSArray<ASLayout *> *)sublayouts NS_DESIGNATED_INITIALIZER;
/** /**
* Convenience class initializer for layout construction. * Convenience class initializer for layout construction.

View File

@@ -10,7 +10,7 @@
// of patent rights can be found in the PATENTS file in the same directory. // of patent rights can be found in the PATENTS file in the same directory.
// //
#import "ASDisplayNodeInternal.h" #import "ASDisplayNode+FrameworkPrivate.h"
#import <map> #import <map>
#import <atomic> #import <atomic>

View File

@@ -20,9 +20,6 @@
#import "ASThread.h" #import "ASThread.h"
@implementation ASStackLayoutSpec @implementation ASStackLayoutSpec
{
ASDN::RecursiveMutex __instanceLock__;
}
- (instancetype)init - (instancetype)init
{ {

View File

@@ -13,7 +13,7 @@
#import "_ASDisplayLayer.h" #import "_ASDisplayLayer.h"
#import "ASAssert.h" #import "ASAssert.h"
#import "ASDisplayNodeInternal.h" #import "ASDisplayNodeInternal.h"
#import "ASDisplayNode+FrameworkPrivate.h" #import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
@interface ASDisplayNode () <_ASDisplayLayerDelegate> @interface ASDisplayNode () <_ASDisplayLayerDelegate>

View File

@@ -15,6 +15,7 @@
#import "ASDisplayNode.h" #import "ASDisplayNode.h"
#import "ASThread.h" #import "ASThread.h"
#import "ASObjectDescriptionHelpers.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@@ -95,7 +96,7 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyState(ASHierarchyStat
return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]]; return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]];
} }
@interface ASDisplayNode () @interface ASDisplayNode () <ASDescriptionProvider, ASDebugDescriptionProvider>
{ {
@protected @protected
ASInterfaceState _interfaceState; ASInterfaceState _interfaceState;
@@ -105,6 +106,9 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyState(ASHierarchyStat
// The view class to use when creating a new display node instance. Defaults to _ASDisplayView. // The view class to use when creating a new display node instance. Defaults to _ASDisplayView.
+ (Class)viewClass; + (Class)viewClass;
// Thread safe way to access the bounds of the node
@property (nonatomic, assign) CGRect threadSafeBounds;
// These methods are recursive, and either union or remove the provided interfaceState to all sub-elements. // These methods are recursive, and either union or remove the provided interfaceState to all sub-elements.
- (void)enterInterfaceState:(ASInterfaceState)interfaceState; - (void)enterInterfaceState:(ASInterfaceState)interfaceState;
- (void)exitInterfaceState:(ASInterfaceState)interfaceState; - (void)exitInterfaceState:(ASInterfaceState)interfaceState;

View File

@@ -0,0 +1,33 @@
//
// ASDisplayNode+FrameworkPrivate.h
// AsyncDisplayKit
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
//
// The following methods are ONLY for use by _ASDisplayLayer, _ASDisplayView, and ASDisplayNode.
// These methods must never be called or overridden by other classes.
//
#import "ASDisplayNode.h"
#import "ASThread.h"
// These are included because most internal subclasses need it.
#import "ASDisplayNode+Subclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
NS_ASSUME_NONNULL_BEGIN
@interface ASDisplayNode ()
{
// Protects access to _view, _layer, _pendingViewState, _subnodes, _supernode, and other properties which are accessed from multiple threads.
@package
ASDN::RecursiveMutex __instanceLock__;
}
@end
NS_ASSUME_NONNULL_END

View File

@@ -14,6 +14,7 @@
#import "ASDisplayNodeInternal.h" #import "ASDisplayNodeInternal.h"
#import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+Subclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h" #import "ASDisplayNode+FrameworkPrivate.h"
#import "ASDisplayNode+FrameworkSubclasses.h"
#import "ASPendingStateController.h" #import "ASPendingStateController.h"
/** /**

View File

@@ -20,7 +20,6 @@
#import "ASLayoutElement.h" #import "ASLayoutElement.h"
#import "ASLayoutTransition.h" #import "ASLayoutTransition.h"
#import "ASEnvironment.h" #import "ASEnvironment.h"
#import "ASObjectDescriptionHelpers.h"
#import "ASWeakSet.h" #import "ASWeakSet.h"
#import "ASDisplayNode+Beta.h" #import "ASDisplayNode+Beta.h"
@@ -57,13 +56,11 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
#define TIME_DISPLAYNODE_OPS 0 // If you're using this information frequently, try: (DEBUG || PROFILE) #define TIME_DISPLAYNODE_OPS 0 // If you're using this information frequently, try: (DEBUG || PROFILE)
@interface ASDisplayNode () <ASDescriptionProvider, ASDebugDescriptionProvider> @interface ASDisplayNode ()
{ {
@package @package
_ASPendingState *_pendingViewState; _ASPendingState *_pendingViewState;
// Protects access to _view, _layer, _pendingViewState, _subnodes, _supernode, and other properties which are accessed from multiple threads.
ASDN::RecursiveMutex __instanceLock__;
UIView *_view; UIView *_view;
CALayer *_layer; CALayer *_layer;
@@ -197,10 +194,6 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
/// Bitmask to check which methods an object overrides. /// Bitmask to check which methods an object overrides.
@property (nonatomic, assign, readonly) ASDisplayNodeMethodOverrides methodOverrides; @property (nonatomic, assign, readonly) ASDisplayNodeMethodOverrides methodOverrides;
/// Thread safe way to access the bounds of the node
@property (nonatomic, assign) CGRect threadSafeBounds;
// Swizzle to extend the builtin functionality with custom logic // Swizzle to extend the builtin functionality with custom logic
- (BOOL)__shouldLoadViewOrLayer; - (BOOL)__shouldLoadViewOrLayer;

View File

@@ -11,9 +11,11 @@
// //
#import "ASLayoutTransition.h" #import "ASLayoutTransition.h"
#import "ASDisplayNodeInternal.h"
#import "ASLayout.h" #import "ASLayout.h"
#import "ASThread.h"
#import "ASDisplayNode+Beta.h"
#import "ASDisplayNodeInternal.h" // Required for _insertSubnode... / _removeFromSupernode.
#import <queue> #import <queue>
#import <memory> #import <memory>

View File

@@ -13,7 +13,7 @@
#import "ASPendingStateController.h" #import "ASPendingStateController.h"
#import "ASThread.h" #import "ASThread.h"
#import "ASWeakSet.h" #import "ASWeakSet.h"
#import "ASDisplayNodeInternal.h" #import "ASDisplayNodeInternal.h" // Required for -applyPendingViewState; consider moving this to +FrameworkPrivate
@interface ASPendingStateController() @interface ASPendingStateController()
{ {