[ASDisplayNode] Notify rasterized subnodes that render pass has completed (#532)

* Notify rasterized subsides that render pass has completed

* Traverse entire subnode tree notifying all subnodes

* Add entry in changelog

* Retrieve rasterizesSubtree flag while holding instance lock

* Balance display delegate calls for rasterized subnodes
This commit is contained in:
Eric Scheers
2017-09-07 22:05:30 +02:00
committed by Huy Nguyen
parent 4ba6f451f6
commit 0bd18c8522
3 changed files with 65 additions and 0 deletions

View File

@@ -23,6 +23,8 @@
#import <AsyncDisplayKit/ASDisplayNode+FrameworkSubclasses.h>
#import <AsyncDisplayKit/ASInternalHelpers.h>
#import <AsyncDisplayKit/ASSignpost.h>
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
@interface ASDisplayNode () <_ASDisplayLayerDelegate>
@end
@@ -302,6 +304,7 @@
}
CALayer *layer = _layer;
BOOL rasterizesSubtree = _flags.rasterizesSubtree;
__instanceLock__.unlock();
@@ -347,11 +350,23 @@
layer.contents = (id)image.CGImage;
}
[self didDisplayAsyncLayer:self.asyncLayer];
if (rasterizesSubtree) {
ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) {
[node didDisplayAsyncLayer:node.asyncLayer];
});
}
}
};
// Call willDisplay immediately in either case
[self willDisplayAsyncLayer:self.asyncLayer asynchronously:asynchronously];
if (rasterizesSubtree) {
ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) {
[node willDisplayAsyncLayer:node.asyncLayer asynchronously:asynchronously];
});
}
if (asynchronously) {
// Async rendering operations are contained by a transaction, which allows them to proceed and concurrently