mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Implement -reclaimMemory API and switch to manually controlled content clearing.
ASDisplayNode and several subclasses had previously cleared memory-heavy objects like the backing store and text layout manager when the node's view or layer is removed from a visible heirarchy. This works great in any system that uses a "working range", where exiting the range removes the node from the hierarchy and reclaiming memory at that time is important. However, for standard UIViewController patterns (unused in Paper), this behavior causes highly undesirable thrashing (leading to visible flashes & wasteful re-rendering of content). After this change, node subclasses should implement -reclaimMemory if they need to perform any other cleanup besides backing store destruction when they leave a working range or other scenario where memory reduction is valuable. To trigger this behavior, calling code should use -recursivelyReclaimMemory. r=nadi
This commit is contained in:
@@ -61,8 +61,8 @@ BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector);
|
||||
unsigned displaysAsynchronously:1;
|
||||
unsigned shouldRasterizeDescendants:1;
|
||||
unsigned visibilityNotificationsDisabled:visibilityNotificationsDisabledBits;
|
||||
unsigned isInAppear:1;
|
||||
unsigned isInDisappear:1;
|
||||
unsigned isInEnterHierarchy:1;
|
||||
unsigned isInExitHierarchy:1;
|
||||
unsigned inWindow:1;
|
||||
unsigned hasWillDisplayAsyncLayer:1;
|
||||
unsigned hasDrawParametersForAsyncLayer:1;
|
||||
@@ -102,10 +102,10 @@ BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector);
|
||||
- (void)__incrementVisibilityNotificationsDisabled;
|
||||
- (void)__decrementVisibilityNotificationsDisabled;
|
||||
|
||||
// Call willAppear if necessary and set inWindow = YES if visibility notifications are enabled on all of its parents
|
||||
- (void)__appear;
|
||||
// Call willDisappear / didDisappear if necessary and set inWindow = NO if visibility notifications are enabled on all of its parents
|
||||
- (void)__disappear;
|
||||
// Call willEnterHierarchy if necessary and set inWindow = YES if visibility notifications are enabled on all of its parents
|
||||
- (void)__enterHierarchy;
|
||||
// Call didExitHierarchy if necessary and set inWindow = NO if visibility notifications are enabled on all of its parents
|
||||
- (void)__exitHierarchy;
|
||||
|
||||
// Returns the ancestor node that rasterizes descendants, or nil if none.
|
||||
- (ASDisplayNode *)__rasterizedContainerNode;
|
||||
|
||||
Reference in New Issue
Block a user