Skip to content

Commit

Permalink
Experiment with disabling ASViewController background dealloc (Textur…
Browse files Browse the repository at this point in the history
  • Loading branch information
mikezucc authored and hebertialmeida committed May 10, 2019
1 parent d34a182 commit b6a6b0f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Schemas/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"exp_dispatch_apply",
"exp_image_downloader_priority",
"exp_text_drawing",
"exp_fix_range_controller"
"exp_fix_range_controller",
"exp_oom_bg_dealloc_disable"
]
}
}
Expand Down
1 change: 1 addition & 0 deletions Source/ASExperimentalFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) {
ASExperimentalImageDownloaderPriority = 1 << 11, // exp_image_downloader_priority
ASExperimentalTextDrawing = 1 << 12, // exp_text_drawing
ASExperimentalFixRangeController = 1 << 13, // exp_fix_range_controller
ASExperimentalOOMBackgroundDeallocDisable = 1 << 14, // exp_oom_bg_dealloc_disable
ASExperimentalFeatureAll = 0xFFFFFFFF
};

Expand Down
3 changes: 2 additions & 1 deletion Source/ASExperimentalFeatures.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
@"exp_dispatch_apply",
@"exp_image_downloader_priority",
@"exp_text_drawing",
@"exp_fix_range_controller"]));
@"exp_fix_range_controller",
@"exp_oom_bg_dealloc_disable"]));
if (flags == ASExperimentalFeatureAll) {
return allNames;
}
Expand Down
5 changes: 5 additions & 0 deletions Source/ASViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#import <AsyncDisplayKit/ASTraitCollection.h>
#import <AsyncDisplayKit/ASRangeControllerUpdateRangeProtocol+Beta.h>
#import <AsyncDisplayKit/ASInternalHelpers.h>
#import <AsyncDisplayKit/ASConfigurationInternal.h>
#import <AsyncDisplayKit/ASExperimentalFeatures.h>

@implementation ASViewController
{
Expand Down Expand Up @@ -98,6 +100,9 @@ - (void)_initializeInstance

- (void)dealloc
{
if (ASActivateExperimentalFeature(ASExperimentalOOMBackgroundDeallocDisable)) {
return;
}
ASPerformBackgroundDeallocation(&_node);
}

Expand Down
6 changes: 4 additions & 2 deletions Tests/ASConfigurationTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
ASExperimentalDispatchApply,
ASExperimentalImageDownloaderPriority,
ASExperimentalTextDrawing,
ASExperimentalFixRangeController
ASExperimentalFixRangeController,
ASExperimentalOOMBackgroundDeallocDisable
};

@interface ASConfigurationTests : ASTestCase <ASConfigurationDelegate>
Expand All @@ -57,7 +58,8 @@ + (NSArray *)names {
@"exp_dispatch_apply",
@"exp_image_downloader_priority",
@"exp_text_drawing",
@"exp_fix_range_controller"
@"exp_fix_range_controller",
@"exp_oom_bg_dealloc_disable"
];
}

Expand Down

0 comments on commit b6a6b0f

Please sign in to comment.