Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 578d0f4

Browse files
author
Scott Goodson
committed
Final cleanup for initial version of removing the UIWindow-based render range.
The UIWindow mode remains enabled by default, but rendering and the test suite works correctly both enabled and disabled.
1 parent c675967 commit 578d0f4

5 files changed

Lines changed: 10 additions & 34 deletions

File tree

AsyncDisplayKit/ASCellNode.m

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#pragma mark -
1919
#pragma mark ASCellNode
2020

21-
//#define LOG(...) NSLog(__VA_ARGS__)
22-
#define LOG(...)
23-
2421
@implementation ASCellNode
2522

2623
- (instancetype)init
@@ -67,29 +64,6 @@ - (void)setNeedsLayout
6764
}
6865
}
6966

70-
- (void)clearFetchedData
71-
{
72-
[super clearFetchedData];
73-
LOG(@"%p - clearFetchedData", self);
74-
}
75-
76-
- (void)fetchData
77-
{
78-
[super fetchData];
79-
LOG(@"%p - fetchData", self);
80-
}
81-
82-
- (void)clearContents
83-
{
84-
[super clearContents];
85-
LOG(@"%p - clearContents", self);
86-
}
87-
88-
- (void)dealloc
89-
{
90-
LOG(@"%p - dealloc", self);
91-
}
92-
9367
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
9468
{
9569
ASDisplayNodeAssertMainThread();

AsyncDisplayKit/ASDisplayNode.mm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ - (CGSize)measure:(CGSize)constrainedSize
567567

568568
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize
569569
{
570-
//NSLog(@"About to measure lock for %@", self);
571570
ASDN::MutexLocker l(_propertyLock);
572571
return [self __measureWithSizeRange:constrainedSize];
573572
}
@@ -648,7 +647,6 @@ - (void)setDisplaysAsynchronously:(BOOL)displaysAsynchronously
648647
- (BOOL)shouldRasterizeDescendants
649648
{
650649
ASDisplayNodeAssertThreadAffinity(self);
651-
//NSLog(@"About to descendants lock for %p, %@", self, [self class]);
652650
ASDN::MutexLocker l(_propertyLock);
653651
ASDisplayNodeAssert(!((_hierarchyState & ASHierarchyStateRasterized) && _flags.shouldRasterizeDescendants),
654652
@"Subnode of a rasterized node should not have redundant shouldRasterizeDescendants enabled");
@@ -1518,8 +1516,6 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
15181516
- (void)__recursivelyTriggerDisplayAndBlock:(BOOL)shouldBlock
15191517
{
15201518
ASDisplayNodeAssertMainThread();
1521-
// ASDisplayNodeAssert(self.isNodeLoaded, @"Node must have layer or view loaded to use -recursivelyEnsureDisplay");
1522-
// ASDisplayNodeAssert(self.inHierarchy && (self.isLayerBacked || self.view.window != nil), @"Node must be in a hierarchy to use -recursivelyEnsureDisplay");
15231519

15241520
CALayer *layer = self.layer;
15251521
// -layoutIfNeeded is recursive, and even walks up to superlayers to check if they need layout,
@@ -2160,7 +2156,9 @@ - (BOOL)_isMarkedForReplacement
21602156
return _replaceAsyncSentinel != nil;
21612157
}
21622158

2163-
// FIXME: This method doesn't appear to be called, and should be removed.
2159+
// FIXME: This method doesn't appear to be called, and could be removed.
2160+
// However, it may be useful for an API similar to what Paper used to create a new node hierarchy,
2161+
// trigger asynchronous measurement and display on it, and have it swap out and replace an old hierarchy.
21642162
- (ASSentinel *)_asyncReplaceSentinel
21652163
{
21662164
ASDN::MutexLocker l(_propertyLock);

AsyncDisplayKit/Details/ASRangeHandlerRender.mm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#import "ASDisplayNode+Subclasses.h"
1313
#import "ASDisplayNode+FrameworkPrivate.h"
1414

15-
#define USE_WORKING_WINDOW 1
16-
1715
@interface ASRangeHandlerRender ()
1816
@property (nonatomic,readonly) UIWindow *workingWindow;
1917
@end

AsyncDisplayKit/Private/ASDisplayNode+FrameworkPrivate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#import "ASThread.h"
2020
#import "ASLayoutOptions.h"
2121

22+
// Project-wide control for whether the offscreen UIWindow is used for display, or if
23+
// ASDK's internal system for coalescing and triggering display events is used.
24+
#define USE_WORKING_WINDOW 1
25+
2226
/**
2327
Hierarchy state is propogated from nodes to all of their children when certain behaviors are required from the subtree.
2428
Examples include rasterization and external driving of the .interfaceState property.

AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,12 @@ - (void)setNeedsDisplay
247247
// -setNeedsDisplay to the CALayer will result in a synchronous display in the next frame.
248248

249249
_messageToViewOrLayer(setNeedsDisplay);
250+
251+
#if !USE_WORKING_WINDOW
250252
if (_layer && !self.isSynchronous) {
251253
[ASDisplayNode scheduleNodeForDisplay:self];
252254
}
253-
255+
#endif
254256
}
255257
}
256258

0 commit comments

Comments
 (0)