mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-09 21:23:43 +00:00
Added memory limit to rows scroll cache.
This commit is contained in:
@@ -17,7 +17,7 @@ constexpr auto kStopTimeout = crl::time(120);
|
||||
RowsScrollCache::RowsScrollCache(Fn<void()> stopped) {
|
||||
_stopTimer.setCallback([=] {
|
||||
_scrolling = false;
|
||||
_images.clear();
|
||||
clear();
|
||||
stopped();
|
||||
});
|
||||
}
|
||||
@@ -29,12 +29,14 @@ void RowsScrollCache::markScrolling() {
|
||||
|
||||
void RowsScrollCache::invalidate(uint64 rowId) {
|
||||
if (const auto i = _images.find(rowId); i != end(_images)) {
|
||||
_memory -= i->second.sizeInBytes();
|
||||
_images.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
void RowsScrollCache::clear() {
|
||||
_images.clear();
|
||||
_memory = 0;
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
Reference in New Issue
Block a user