Disable interface coalescing (#862)

* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* disable interface coalescing and fix tests

* Revert to before coalescing for ease of reading

* refactor, make min change

* refactor

* add comments

* Add change log
This commit is contained in:
Max Wang
2018-03-28 18:29:05 -07:00
committed by Adlai Holler
parent 4bbbd725de
commit df7d2a5737
4 changed files with 20 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
## master ## master
* Add your own contributions to the next release on the line below this with your name. * Add your own contributions to the next release on the line below this with your name.
- Disable interface colescing and match to pre-colescing interface update behavior [Max Wang](https://github.com/wsdwsd0829) [#862](https://github.com/TextureGroup/Texture/pull/862)
- [ASDisplayNode] Add safeAreaInsets, layoutMargins and related properties to ASDisplayNode, with full support for older OS versions [Yevgen Pogribnyi](https://github.com/ypogribnyi) [#685](https://github.com/TextureGroup/Texture/pull/685) - [ASDisplayNode] Add safeAreaInsets, layoutMargins and related properties to ASDisplayNode, with full support for older OS versions [Yevgen Pogribnyi](https://github.com/ypogribnyi) [#685](https://github.com/TextureGroup/Texture/pull/685)
- [ASPINRemoteImageDownloader] Allow cache to provide animated image. [Max Wang](https://github.com/wsdwsd0829) [#850](https://github.com/TextureGroup/Texture/pull/850) - [ASPINRemoteImageDownloader] Allow cache to provide animated image. [Max Wang](https://github.com/wsdwsd0829) [#850](https://github.com/TextureGroup/Texture/pull/850)
- [tvOS] Fixes errors when building against tvOS SDK [Alex Hill](https://github.com/alexhillc) [#728](https://github.com/TextureGroup/Texture/pull/728) - [tvOS] Fixes errors when building against tvOS SDK [Alex Hill](https://github.com/alexhillc) [#728](https://github.com/TextureGroup/Texture/pull/728)

View File

@@ -37,8 +37,8 @@
+ (ASConfiguration *)defaultConfiguration NS_RETURNS_RETAINED + (ASConfiguration *)defaultConfiguration NS_RETURNS_RETAINED
{ {
ASConfiguration *config = [[ASConfiguration alloc] init]; ASConfiguration *config = [[ASConfiguration alloc] init];
// On by default for now, pending fix for https://github.com/TextureGroup/Texture/issues/853 // TODO(wsdwsd0829): Fix #788 before enabling it.
config.experimentalFeatures = ASExperimentalInterfaceStateCoalescing; // config.experimentalFeatures = ASExperimentalInterfaceStateCoalescing;
return config; return config;
} }

View File

@@ -57,6 +57,10 @@
#else #else
#define TIME_SCOPED(outVar) #define TIME_SCOPED(outVar)
#endif #endif
// This is trying to merge non-rangeManaged with rangeManaged, so both range-managed and standalone nodes wait before firing their exit-visibility handlers, as UIViewController transitions now do rehosting at both start & end of animation.
// Enable this will mitigate interface updating state when coalescing disabled.
// TODO(wsdwsd0829): Rework enabling code to ensure that interface state behavior is not altered when ASCATransactionQueue is disabled.
#define ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR 0
static ASDisplayNodeNonFatalErrorBlock _nonFatalErrorBlock = nil; static ASDisplayNodeNonFatalErrorBlock _nonFatalErrorBlock = nil;
NSInteger const ASDefaultDrawingPriority = ASDefaultTransactionPriority; NSInteger const ASDefaultDrawingPriority = ASDefaultTransactionPriority;
@@ -3005,6 +3009,13 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
// same runloop. Strategy: strong reference (might be the last!), wait one runloop, and confirm we are still outside the hierarchy (both layer-backed and view-backed). // same runloop. Strategy: strong reference (might be the last!), wait one runloop, and confirm we are still outside the hierarchy (both layer-backed and view-backed).
// TODO: This approach could be optimized by only performing the dispatch for root elements + recursively apply the interface state change. This would require a closer // TODO: This approach could be optimized by only performing the dispatch for root elements + recursively apply the interface state change. This would require a closer
// integration with _ASDisplayLayer to ensure that the superlayer pointer has been cleared by this stage (to check if we are root or not), or a different delegate call. // integration with _ASDisplayLayer to ensure that the superlayer pointer has been cleared by this stage (to check if we are root or not), or a different delegate call.
#if !ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR
if (![self supportsRangeManagedInterfaceState]) {
self.interfaceState = ASInterfaceStateNone;
return;
}
#endif
if (ASInterfaceStateIncludesVisible(_pendingInterfaceState)) { if (ASInterfaceStateIncludesVisible(_pendingInterfaceState)) {
void(^exitVisibleInterfaceState)(void) = ^{ void(^exitVisibleInterfaceState)(void) = ^{
// This block intentionally retains self. // This block intentionally retains self.
@@ -3013,11 +3024,12 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
BOOL isVisible = ASInterfaceStateIncludesVisible(_pendingInterfaceState); BOOL isVisible = ASInterfaceStateIncludesVisible(_pendingInterfaceState);
ASInterfaceState newState = (_pendingInterfaceState & ~ASInterfaceStateVisible); ASInterfaceState newState = (_pendingInterfaceState & ~ASInterfaceStateVisible);
__instanceLock__.unlock(); __instanceLock__.unlock();
if (!isStillInHierarchy && isVisible) { if (!isStillInHierarchy && isVisible) {
#if ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR
if (![self supportsRangeManagedInterfaceState]) { if (![self supportsRangeManagedInterfaceState]) {
newState = ASInterfaceStateNone; newState = ASInterfaceStateNone;
} }
#endif
self.interfaceState = newState; self.interfaceState = newState;
} }
}; };

View File

@@ -188,6 +188,10 @@ static NSTimeInterval const kRunLoopRunTime = 0.001; // Allow the RunLoop to run
- (void)testASCATransactionQueueProcess - (void)testASCATransactionQueueProcess
{ {
ASConfiguration *config = [[ASConfiguration alloc] initWithDictionary:nil];
config.experimentalFeatures = ASExperimentalInterfaceStateCoalescing;
[ASConfigurationManager test_resetWithConfiguration:config];
ASCATransactionQueue *queue = [[ASCATransactionQueue alloc] init]; ASCATransactionQueue *queue = [[ASCATransactionQueue alloc] init];
QueueObject *object = [[QueueObject alloc] init]; QueueObject *object = [[QueueObject alloc] init];
[queue enqueue:object]; [queue enqueue:object];