From 2813f6c77bcfec291dfd1f813c53a016f1354e49 Mon Sep 17 00:00:00 2001 From: ErnestMa Date: Thu, 7 Mar 2019 10:55:41 -0800 Subject: [PATCH 1/4] Remove experimental features --- Schemas/configuration.json | 2 -- Source/ASCollectionView.mm | 15 ++------------- Source/ASExperimentalFeatures.h | 2 -- Source/ASExperimentalFeatures.mm | 2 -- Source/ASTableView.mm | 26 +++++++++----------------- Tests/ASConfigurationTests.mm | 4 ---- 6 files changed, 11 insertions(+), 40 deletions(-) diff --git a/Schemas/configuration.json b/Schemas/configuration.json index 2b95d767f..59570feab 100644 --- a/Schemas/configuration.json +++ b/Schemas/configuration.json @@ -23,8 +23,6 @@ "exp_skip_clear_data", "exp_did_enter_preload_skip_asm_layout", "exp_disable_a11y_cache", - "exp_skip_a11y_wait", - "exp_new_default_cell_layout_mode", "exp_dispatch_apply" ] } diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index 21ff2a4a9..7391c92ed 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -317,12 +317,7 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV [self _configureCollectionViewLayout:layout]; - if (ASActivateExperimentalFeature(ASExperimentalNewDefaultCellLayoutMode)) { - _cellLayoutMode = ASCellLayoutModeSyncForSmallContent; - } else { - _cellLayoutMode = ASCellLayoutModeNone; - } - + _cellLayoutMode = ASCellLayoutModeSyncForSmallContent; return self; } @@ -1886,10 +1881,6 @@ - (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyPro return NO; } if (ASCellLayoutModeIncludes(ASCellLayoutModeSyncForSmallContent)) { - // Reload data is expensive, don't block main while doing so. - if (changeSet.includesReloadData) { - return NO; - } // If we have very few ASCellNodes (besides UIKit passthrough ones), match UIKit by blocking. if (changeSet.countForAsyncLayout < 2) { return YES; @@ -2487,9 +2478,7 @@ - (void)setPrefetchingEnabled:(BOOL)prefetchingEnabled - (NSArray *)accessibilityElements { - if (!ASActivateExperimentalFeature(ASExperimentalSkipAccessibilityWait)) { - [self waitUntilAllUpdatesAreCommitted]; - } + [self waitUntilAllUpdatesAreCommitted]; return [super accessibilityElements]; } diff --git a/Source/ASExperimentalFeatures.h b/Source/ASExperimentalFeatures.h index f78b4332c..f23827cca 100644 --- a/Source/ASExperimentalFeatures.h +++ b/Source/ASExperimentalFeatures.h @@ -28,8 +28,6 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { ASExperimentalSkipClearData = 1 << 7, // exp_skip_clear_data ASExperimentalDidEnterPreloadSkipASMLayout = 1 << 8, // exp_did_enter_preload_skip_asm_layout ASExperimentalDisableAccessibilityCache = 1 << 9, // exp_disable_a11y_cache - ASExperimentalSkipAccessibilityWait = 1 << 10, // exp_skip_a11y_wait - ASExperimentalNewDefaultCellLayoutMode = 1 << 11, // exp_new_default_cell_layout_mode ASExperimentalDispatchApply = 1 << 12, // exp_dispatch_apply ASExperimentalFeatureAll = 0xFFFFFFFF }; diff --git a/Source/ASExperimentalFeatures.mm b/Source/ASExperimentalFeatures.mm index 0a8972fe3..d626c2c20 100644 --- a/Source/ASExperimentalFeatures.mm +++ b/Source/ASExperimentalFeatures.mm @@ -22,8 +22,6 @@ @"exp_skip_clear_data", @"exp_did_enter_preload_skip_asm_layout", @"exp_disable_a11y_cache", - @"exp_skip_a11y_wait", - @"exp_new_default_cell_layout_mode", @"exp_dispatch_apply"])); if (flags == ASExperimentalFeatureAll) { diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 3807c5761..d9d98c13a 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -1678,20 +1678,14 @@ - (BOOL)dataControllerShouldSerializeNodeCreation:(ASDataController *)dataContro - (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyProcessChangeSet:(_ASHierarchyChangeSet *)changeSet { - if (ASActivateExperimentalFeature(ASExperimentalNewDefaultCellLayoutMode)) { - // Reload data is expensive, don't block main while doing so. - if (changeSet.includesReloadData) { - return NO; - } - // For more details on this method, see the comment in the ASCollectionView implementation. - if (changeSet.countForAsyncLayout < 2) { - return YES; - } - CGSize contentSize = self.contentSize; - CGSize boundsSize = self.bounds.size; - if (contentSize.height <= boundsSize.height && contentSize.width <= boundsSize.width) { - return YES; - } + // For more details on this method, see the comment in the ASCollectionView implementation. + if (changeSet.countForAsyncLayout < 2) { + return YES; + } + CGSize contentSize = self.contentSize; + CGSize boundsSize = self.bounds.size; + if (contentSize.height <= boundsSize.height && contentSize.width <= boundsSize.width) { + return YES; } return NO; } @@ -2011,9 +2005,7 @@ - (void)didMoveToSuperview - (NSArray *)accessibilityElements { - if (!ASActivateExperimentalFeature(ASExperimentalSkipAccessibilityWait)) { - [self waitUntilAllUpdatesAreCommitted]; - } + [self waitUntilAllUpdatesAreCommitted]; return [super accessibilityElements]; } diff --git a/Tests/ASConfigurationTests.mm b/Tests/ASConfigurationTests.mm index aff309176..34e2f6353 100644 --- a/Tests/ASConfigurationTests.mm +++ b/Tests/ASConfigurationTests.mm @@ -28,8 +28,6 @@ ASExperimentalSkipClearData, ASExperimentalDidEnterPreloadSkipASMLayout, ASExperimentalDisableAccessibilityCache, - ASExperimentalSkipAccessibilityWait, - ASExperimentalNewDefaultCellLayoutMode, ASExperimentalDispatchApply }; @@ -53,8 +51,6 @@ + (NSArray *)names { @"exp_skip_clear_data", @"exp_did_enter_preload_skip_asm_layout", @"exp_disable_a11y_cache", - @"exp_skip_a11y_wait", - @"exp_new_default_cell_layout_mode", @"exp_dispatch_apply" ]; } From 42ef59ff4733bff19481976796812fd5477e1a8d Mon Sep 17 00:00:00 2001 From: ErnestMa Date: Thu, 7 Mar 2019 12:08:33 -0800 Subject: [PATCH 2/4] prevent blocking main thread --- Source/ASCollectionView.mm | 4 ++++ Source/ASTableView.mm | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index 7391c92ed..f76b96343 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -1881,6 +1881,10 @@ - (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyPro return NO; } if (ASCellLayoutModeIncludes(ASCellLayoutModeSyncForSmallContent)) { + // Reload data is expensive, don't block main while doing so. + if (changeSet.includesReloadData) { + return NO; + } // If we have very few ASCellNodes (besides UIKit passthrough ones), match UIKit by blocking. if (changeSet.countForAsyncLayout < 2) { return YES; diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index d9d98c13a..e483eb9e9 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -1678,6 +1678,10 @@ - (BOOL)dataControllerShouldSerializeNodeCreation:(ASDataController *)dataContro - (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyProcessChangeSet:(_ASHierarchyChangeSet *)changeSet { + // Reload data is expensive, don't block main while doing so. + if (changeSet.includesReloadData) { + return NO; + } // For more details on this method, see the comment in the ASCollectionView implementation. if (changeSet.countForAsyncLayout < 2) { return YES; From d4afe2278cc9a2263624c4f2e110af0746003b78 Mon Sep 17 00:00:00 2001 From: ErnestMa Date: Thu, 7 Mar 2019 13:26:42 -0800 Subject: [PATCH 3/4] remove small content all together as none is the default --- Source/ASCollectionView.mm | 27 ++++++++++++--------------- Source/ASCollectionViewProtocols.h | 6 ------ Tests/ASCollectionViewTests.mm | 6 ------ 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index f76b96343..c54b6da29 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -317,7 +317,6 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV [self _configureCollectionViewLayout:layout]; - _cellLayoutMode = ASCellLayoutModeSyncForSmallContent; return self; } @@ -1880,20 +1879,18 @@ - (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyPro if (ASCellLayoutModeIncludes(ASCellLayoutModeAlwaysAsync)) { return NO; } - if (ASCellLayoutModeIncludes(ASCellLayoutModeSyncForSmallContent)) { - // Reload data is expensive, don't block main while doing so. - if (changeSet.includesReloadData) { - return NO; - } - // If we have very few ASCellNodes (besides UIKit passthrough ones), match UIKit by blocking. - if (changeSet.countForAsyncLayout < 2) { - return YES; - } - CGSize contentSize = self.contentSize; - CGSize boundsSize = self.bounds.size; - if (contentSize.height <= boundsSize.height && contentSize.width <= boundsSize.width) { - return YES; - } + // Reload data is expensive, don't block main while doing so. + if (changeSet.includesReloadData) { + return NO; + } + // If we have very few ASCellNodes (besides UIKit passthrough ones), match UIKit by blocking. + if (changeSet.countForAsyncLayout < 2) { + return YES; + } + CGSize contentSize = self.contentSize; + CGSize boundsSize = self.bounds.size; + if (contentSize.height <= boundsSize.height && contentSize.width <= boundsSize.width) { + return YES; } return NO; // ASCellLayoutModeNone } diff --git a/Source/ASCollectionViewProtocols.h b/Source/ASCollectionViewProtocols.h index 9d5a27faa..4cf6fe1e7 100644 --- a/Source/ASCollectionViewProtocols.h +++ b/Source/ASCollectionViewProtocols.h @@ -46,12 +46,6 @@ typedef NS_OPTIONS(NSUInteger, ASCellLayoutMode) { * cell height animations are desired. */ ASCellLayoutModeAlwaysBatchUpdateSectionReload = 1 << 9, // Default OFF - - /** - * If ASCellLayoutModeSyncForSmallContent is enabled it will cause ASDataController to wait on the - * background queue if the amount of new content is small. - */ - ASCellLayoutModeSyncForSmallContent = 1 << 10, }; NS_ASSUME_NONNULL_BEGIN diff --git a/Tests/ASCollectionViewTests.mm b/Tests/ASCollectionViewTests.mm index b1476f3aa..3ff5af440 100644 --- a/Tests/ASCollectionViewTests.mm +++ b/Tests/ASCollectionViewTests.mm @@ -1050,12 +1050,6 @@ - (void)testInitialRangeBounds shouldWaitUntilAllUpdatesAreProcessed:YES]; } -- (void)testInitialRangeBoundsCellLayoutModeSyncForSmallContent -{ - [self testInitialRangeBoundsWithCellLayoutMode:ASCellLayoutModeSyncForSmallContent - shouldWaitUntilAllUpdatesAreProcessed:YES]; // Need to wait because the first initial data load is always async -} - - (void)testInitialRangeBoundsCellLayoutModeAlwaysAsync { [self testInitialRangeBoundsWithCellLayoutMode:ASCellLayoutModeAlwaysAsync From 0e84fc09cd45acacdf59b6bafeac45430168a29a Mon Sep 17 00:00:00 2001 From: Garrett Moon Date: Mon, 11 Mar 2019 09:17:56 -0700 Subject: [PATCH 4/4] Update ASExperimentalFeatures.h --- Source/ASExperimentalFeatures.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/ASExperimentalFeatures.h b/Source/ASExperimentalFeatures.h index 4eaae573a..c3d56eb7d 100644 --- a/Source/ASExperimentalFeatures.h +++ b/Source/ASExperimentalFeatures.h @@ -27,10 +27,10 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { ASExperimentalFramesetterCache = 1 << 6, // exp_framesetter_cache ASExperimentalSkipClearData = 1 << 7, // exp_skip_clear_data ASExperimentalDidEnterPreloadSkipASMLayout = 1 << 8, // exp_did_enter_preload_skip_asm_layout - ASExperimentalDisableAccessibilityCache = 1 << 9, // exp_disable_a11y_cache - ASExperimentalDispatchApply = 1 << 12, // exp_dispatch_apply - ASExperimentalImageDownloaderPriority = 1 << 13, // exp_image_downloader_priority - ASExperimentalTextDrawing = 1 << 14, // exp_text_drawing + ASExperimentalDisableAccessibilityCache = 1 << 9, // exp_disable_a11y_cache + ASExperimentalDispatchApply = 1 << 10, // exp_dispatch_apply + ASExperimentalImageDownloaderPriority = 1 << 11, // exp_image_downloader_priority + ASExperimentalTextDrawing = 1 << 12, // exp_text_drawing ASExperimentalFeatureAll = 0xFFFFFFFF };