diff --git a/Telegram/SourceFiles/base/last_used_cache.h b/Telegram/SourceFiles/base/last_used_cache.h new file mode 100644 index 000000000..65d5fb4a3 --- /dev/null +++ b/Telegram/SourceFiles/base/last_used_cache.h @@ -0,0 +1,69 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#include +#include + +namespace base { + +template +class last_used_cache { +public: + void up(Entry entry); + void remove(Entry entry); + void clear(); + + Entry take_lowest(); + +private: + std::list _queue; + std::unordered_map::iterator> _map; + +}; + +template +void last_used_cache::up(Entry entry) { + if (!_queue.empty() && _queue.back() == entry) { + return; + } + const auto i = _map.find(entry); + if (i != end(_map)) { + _queue.splice(end(_queue), _queue, i->second); + } else { + _map.emplace(entry, _queue.insert(end(_queue), entry)); + } +} + +template +void last_used_cache::remove(Entry entry) { + const auto i = _map.find(entry); + if (i != end(_map)) { + _queue.erase(i->second); + _map.erase(i); + } +} + +template +void last_used_cache::clear() { + _queue.clear(); + _map.clear(); +} + +template +Entry last_used_cache::take_lowest() { + if (_queue.empty()) { + return Entry(); + } + auto result = std::move(_queue.front()); + _queue.erase(begin(_queue)); + _map.erase(result); + return result; +} + +} // namespace base diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 3378c750c..c287dbcae 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -691,9 +691,11 @@ StickersListWidget::StickersListWidget(QWidget *parent, not_null +class MediaActiveCache { +public: + template + MediaActiveCache(int64 limit, Unload &&unload); + + void up(Type *entry); + void remove(Type *entry); + void clear(); + + void increment(int64 amount); + void decrement(int64 amount); + +private: + template + void check(Unload &&unload); + + base::last_used_cache _cache; + SingleQueuedInvokation _delayed; + int64 _usage = 0; + int64 _limit = 0; + Fn _unload; + +}; + +template +template +MediaActiveCache::MediaActiveCache(int64 limit, Unload &&unload) +: _delayed([=] { check(unload); }) +, _limit(limit) { +} + +template +void MediaActiveCache::up(Type *entry) { + _cache.up(entry); + _delayed.call(); +} + +template +void MediaActiveCache::remove(Type *entry) { + _cache.remove(entry); +} + +template +void MediaActiveCache::clear() { + _cache.clear(); +} + +template +void MediaActiveCache::increment(int64 amount) { + _usage += amount; +} + +template +void MediaActiveCache::decrement(int64 amount) { + _usage -= amount; +} + +template +template +void MediaActiveCache::check(Unload &&unload) { + while (_usage > _limit) { + if (const auto entry = _cache.take_lowest()) { + unload(entry); + } else { + break; + } + } +} + +} // namespace Images diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 37610424a..55b53c433 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1262,7 +1262,6 @@ void History::mainViewRemoved( } void History::newItemAdded(not_null item) { - Images::CheckCacheSize(); item->indexAsNewItem(); if (const auto from = item->from() ? item->from()->asUser() : nullptr) { if (from == item->author()) { diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 95df326ce..16ca44166 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2856,7 +2856,6 @@ void HistoryWidget::delayedShowAt(MsgId showAtMsgId) { } void HistoryWidget::onScroll() { - Images::CheckCacheSize(); preloadHistoryIfNeeded(); visibleAreaUpdated(); if (!_synteticScrollEvent) { diff --git a/Telegram/SourceFiles/ui/image/image.cpp b/Telegram/SourceFiles/ui/image/image.cpp index bc17b4109..8124f4e30 100644 --- a/Telegram/SourceFiles/ui/image/image.cpp +++ b/Telegram/SourceFiles/ui/image/image.cpp @@ -8,27 +8,51 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/image/image.h" #include "ui/image/image_source.h" +#include "core/media_active_cache.h" #include "storage/cache/storage_cache_database.h" #include "data/data_session.h" #include "auth_session.h" +using namespace Images; + namespace Images { namespace { +// After 64MB of unpacked images we try to clear some memory. +constexpr auto kMemoryForCache = 64 * 1024 * 1024; + QMap LocalFileImages; QMap WebUrlImages; QMap StorageImages; QMap WebCachedImages; QMap GeoPointImages; -int64 GlobalAcquiredSize = 0; -int64 LocalAcquiredSize = 0; - -uint64 PixKey(int width, int height, Images::Options options) { - return static_cast(width) | (static_cast(height) << 24) | (static_cast(options) << 48); +int64 ComputeUsage(QSize size) { + return int64(size.width()) * size.height() * 4; } -uint64 SinglePixKey(Images::Options options) { +int64 ComputeUsage(const QPixmap &image) { + return ComputeUsage(image.size()); +} + +int64 ComputeUsage(const QImage &image) { + return ComputeUsage(image.size()); +} + +Core::MediaActiveCache &ActiveCache() { + static auto Instance = Core::MediaActiveCache( + kMemoryForCache, + [](const Image *image) { image->forget(); }); + return Instance; +} + +uint64 PixKey(int width, int height, Options options) { + return static_cast(width) + | (static_cast(height) << 24) + | (static_cast(options) << 48); +} + +uint64 SinglePixKey(Options options) { return PixKey(0, 0, options); } @@ -47,24 +71,16 @@ void ClearRemote() { for (auto image : base::take(GeoPointImages)) { delete image; } - LocalAcquiredSize = GlobalAcquiredSize; } void ClearAll() { + ActiveCache().clear(); for (auto image : base::take(LocalFileImages)) { delete image; } ClearRemote(); } -void CheckCacheSize() { - const auto now = GlobalAcquiredSize; - if (GlobalAcquiredSize > LocalAcquiredSize + MemoryForImageCache) { - Auth().data().forgetMedia(); - LocalAcquiredSize = GlobalAcquiredSize; - } -} - ImagePtr Create(const QString &file, QByteArray format) { if (file.startsWith(qstr("http://"), Qt::CaseInsensitive) || file.startsWith(qstr("https://"), Qt::CaseInsensitive)) { @@ -312,11 +328,11 @@ ImagePtr Create(const GeoPointLocation &location) { } // namespace Images -Image::Image(std::unique_ptr &&source) +Image::Image(std::unique_ptr &&source) : _source(std::move(source)) { } -void Image::replaceSource(std::unique_ptr &&source) { +void Image::replaceSource(std::unique_ptr &&source) { _source = std::move(source); } @@ -329,7 +345,7 @@ ImagePtr Image::Blank() { QImage::Format_ARGB32_Premultiplied); data.fill(Qt::transparent); data.setDevicePixelRatio(cRetinaFactor()); - return Images::Create( + return Create( std::move(data), "GIF"); }(); @@ -352,16 +368,14 @@ const QPixmap &Image::pix( w *= cIntRetinaFactor(); h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::None; - auto k = Images::PixKey(w, h, options); + auto options = Option::Smooth | Option::None; + auto k = PixKey(w, h, options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { auto p = pixNoCache(origin, w, h, options); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -380,29 +394,27 @@ const QPixmap &Image::pixRounded( w *= cIntRetinaFactor(); h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::None; + auto options = Option::Smooth | Option::None; auto cornerOptions = [](RectParts corners) { - return (corners & RectPart::TopLeft ? Images::Option::RoundedTopLeft : Images::Option::None) - | (corners & RectPart::TopRight ? Images::Option::RoundedTopRight : Images::Option::None) - | (corners & RectPart::BottomLeft ? Images::Option::RoundedBottomLeft : Images::Option::None) - | (corners & RectPart::BottomRight ? Images::Option::RoundedBottomRight : Images::Option::None); + return (corners & RectPart::TopLeft ? Option::RoundedTopLeft : Option::None) + | (corners & RectPart::TopRight ? Option::RoundedTopRight : Option::None) + | (corners & RectPart::BottomLeft ? Option::RoundedBottomLeft : Option::None) + | (corners & RectPart::BottomRight ? Option::RoundedBottomRight : Option::None); }; if (radius == ImageRoundRadius::Large) { - options |= Images::Option::RoundedLarge | cornerOptions(corners); + options |= Option::RoundedLarge | cornerOptions(corners); } else if (radius == ImageRoundRadius::Small) { - options |= Images::Option::RoundedSmall | cornerOptions(corners); + options |= Option::RoundedSmall | cornerOptions(corners); } else if (radius == ImageRoundRadius::Ellipse) { - options |= Images::Option::Circled | cornerOptions(corners); + options |= Option::Circled | cornerOptions(corners); } - auto k = Images::PixKey(w, h, options); + auto k = PixKey(w, h, options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { auto p = pixNoCache(origin, w, h, options); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -419,16 +431,14 @@ const QPixmap &Image::pixCircled( w *= cIntRetinaFactor(); h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::Circled; - auto k = Images::PixKey(w, h, options); + auto options = Option::Smooth | Option::Circled; + auto k = PixKey(w, h, options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { auto p = pixNoCache(origin, w, h, options); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -445,16 +455,14 @@ const QPixmap &Image::pixBlurredCircled( w *= cIntRetinaFactor(); h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::Circled | Images::Option::Blurred; - auto k = Images::PixKey(w, h, options); + auto options = Option::Smooth | Option::Circled | Option::Blurred; + auto k = PixKey(w, h, options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { auto p = pixNoCache(origin, w, h, options); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -471,16 +479,14 @@ const QPixmap &Image::pixBlurred( w *= cIntRetinaFactor(); h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::Blurred; - auto k = Images::PixKey(w, h, options); + auto options = Option::Smooth | Option::Blurred; + auto k = PixKey(w, h, options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { auto p = pixNoCache(origin, w, h, options); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -498,16 +504,14 @@ const QPixmap &Image::pixColored( w *= cIntRetinaFactor(); h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::Colored; - auto k = Images::PixKey(w, h, options); + auto options = Option::Smooth | Option::Colored; + auto k = PixKey(w, h, options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { auto p = pixColoredNoCache(origin, add, w, h, true); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -525,16 +529,14 @@ const QPixmap &Image::pixBlurredColored( w *= cIntRetinaFactor(); h *= cIntRetinaFactor(); } - auto options = Images::Option::Blurred | Images::Option::Smooth | Images::Option::Colored; - auto k = Images::PixKey(w, h, options); + auto options = Option::Blurred | Option::Smooth | Option::Colored; + auto k = PixKey(w, h, options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { auto p = pixBlurredColoredNoCache(origin, add, w, h); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -557,36 +559,34 @@ const QPixmap &Image::pixSingle( h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::None; + auto options = Option::Smooth | Option::None; auto cornerOptions = [](RectParts corners) { - return (corners & RectPart::TopLeft ? Images::Option::RoundedTopLeft : Images::Option::None) - | (corners & RectPart::TopRight ? Images::Option::RoundedTopRight : Images::Option::None) - | (corners & RectPart::BottomLeft ? Images::Option::RoundedBottomLeft : Images::Option::None) - | (corners & RectPart::BottomRight ? Images::Option::RoundedBottomRight : Images::Option::None); + return (corners & RectPart::TopLeft ? Option::RoundedTopLeft : Option::None) + | (corners & RectPart::TopRight ? Option::RoundedTopRight : Option::None) + | (corners & RectPart::BottomLeft ? Option::RoundedBottomLeft : Option::None) + | (corners & RectPart::BottomRight ? Option::RoundedBottomRight : Option::None); }; if (radius == ImageRoundRadius::Large) { - options |= Images::Option::RoundedLarge | cornerOptions(corners); + options |= Option::RoundedLarge | cornerOptions(corners); } else if (radius == ImageRoundRadius::Small) { - options |= Images::Option::RoundedSmall | cornerOptions(corners); + options |= Option::RoundedSmall | cornerOptions(corners); } else if (radius == ImageRoundRadius::Ellipse) { - options |= Images::Option::Circled | cornerOptions(corners); + options |= Option::Circled | cornerOptions(corners); } if (colored) { - options |= Images::Option::Colored; + options |= Option::Colored; } - auto k = Images::SinglePixKey(options); + auto k = SinglePixKey(options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend() || i->width() != (outerw * cIntRetinaFactor()) || i->height() != (outerh * cIntRetinaFactor())) { if (i != _sizesCache.cend()) { - Images::GlobalAcquiredSize -= int64(i->width()) * i->height() * 4; + ActiveCache().decrement(ComputeUsage(*i)); } auto p = pixNoCache(origin, w, h, options, outerw, outerh, colored); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -608,33 +608,31 @@ const QPixmap &Image::pixBlurredSingle( h *= cIntRetinaFactor(); } - auto options = Images::Option::Smooth | Images::Option::Blurred; + auto options = Option::Smooth | Option::Blurred; auto cornerOptions = [](RectParts corners) { - return (corners & RectPart::TopLeft ? Images::Option::RoundedTopLeft : Images::Option::None) - | (corners & RectPart::TopRight ? Images::Option::RoundedTopRight : Images::Option::None) - | (corners & RectPart::BottomLeft ? Images::Option::RoundedBottomLeft : Images::Option::None) - | (corners & RectPart::BottomRight ? Images::Option::RoundedBottomRight : Images::Option::None); + return (corners & RectPart::TopLeft ? Option::RoundedTopLeft : Option::None) + | (corners & RectPart::TopRight ? Option::RoundedTopRight : Option::None) + | (corners & RectPart::BottomLeft ? Option::RoundedBottomLeft : Option::None) + | (corners & RectPart::BottomRight ? Option::RoundedBottomRight : Option::None); }; if (radius == ImageRoundRadius::Large) { - options |= Images::Option::RoundedLarge | cornerOptions(corners); + options |= Option::RoundedLarge | cornerOptions(corners); } else if (radius == ImageRoundRadius::Small) { - options |= Images::Option::RoundedSmall | cornerOptions(corners); + options |= Option::RoundedSmall | cornerOptions(corners); } else if (radius == ImageRoundRadius::Ellipse) { - options |= Images::Option::Circled | cornerOptions(corners); + options |= Option::Circled | cornerOptions(corners); } - auto k = Images::SinglePixKey(options); + auto k = SinglePixKey(options); auto i = _sizesCache.constFind(k); if (i == _sizesCache.cend() || i->width() != (outerw * cIntRetinaFactor()) || i->height() != (outerh * cIntRetinaFactor())) { if (i != _sizesCache.cend()) { - Images::GlobalAcquiredSize -= int64(i->width()) * i->height() * 4; + ActiveCache().decrement(ComputeUsage(*i)); } auto p = pixNoCache(origin, w, h, options, outerw, outerh); p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); - if (!p.isNull()) { - Images::GlobalAcquiredSize += int64(p.width()) * p.height() * 4; - } + ActiveCache().increment(ComputeUsage(*i)); } return i.value(); } @@ -643,7 +641,7 @@ QPixmap Image::pixNoCache( Data::FileOrigin origin, int w, int h, - Images::Options options, + Options options, int outerw, int outerh, const style::color *colored) const { @@ -679,27 +677,27 @@ QPixmap Image::pixNoCache( p.fillRect(qMax(0, (outerw - w) / 2), qMax(0, (outerh - h) / 2), qMin(result.width(), w), qMin(result.height(), h), st::imageBgTransparent); } - auto corners = [](Images::Options options) { - return ((options & Images::Option::RoundedTopLeft) ? RectPart::TopLeft : RectPart::None) - | ((options & Images::Option::RoundedTopRight) ? RectPart::TopRight : RectPart::None) - | ((options & Images::Option::RoundedBottomLeft) ? RectPart::BottomLeft : RectPart::None) - | ((options & Images::Option::RoundedBottomRight) ? RectPart::BottomRight : RectPart::None); + auto corners = [](Options options) { + return ((options & Option::RoundedTopLeft) ? RectPart::TopLeft : RectPart::None) + | ((options & Option::RoundedTopRight) ? RectPart::TopRight : RectPart::None) + | ((options & Option::RoundedBottomLeft) ? RectPart::BottomLeft : RectPart::None) + | ((options & Option::RoundedBottomRight) ? RectPart::BottomRight : RectPart::None); }; - if (options & Images::Option::Circled) { - Images::prepareCircle(result); - } else if (options & Images::Option::RoundedLarge) { - Images::prepareRound(result, ImageRoundRadius::Large, corners(options)); - } else if (options & Images::Option::RoundedSmall) { - Images::prepareRound(result, ImageRoundRadius::Small, corners(options)); + if (options & Option::Circled) { + prepareCircle(result); + } else if (options & Option::RoundedLarge) { + prepareRound(result, ImageRoundRadius::Large, corners(options)); + } else if (options & Option::RoundedSmall) { + prepareRound(result, ImageRoundRadius::Small, corners(options)); } - if (options & Images::Option::Colored) { + if (options & Option::Colored) { Assert(colored != nullptr); - result = Images::prepareColored(*colored, std::move(result)); + result = prepareColored(*colored, std::move(result)); } return App::pixmapFromImageInPlace(std::move(result)); } - return App::pixmapFromImageInPlace(Images::prepare(_data, w, h, options, outerw, outerh, colored)); + return App::pixmapFromImageInPlace(prepare(_data, w, h, options, outerw, outerh, colored)); } QPixmap Image::pixColoredNoCache( @@ -719,12 +717,12 @@ QPixmap Image::pixColoredNoCache( auto img = _data; if (w <= 0 || !width() || !height() || (w == width() && (h <= 0 || h == height()))) { - return App::pixmapFromImageInPlace(Images::prepareColored(add, std::move(img))); + return App::pixmapFromImageInPlace(prepareColored(add, std::move(img))); } if (h <= 0) { - return App::pixmapFromImageInPlace(Images::prepareColored(add, img.scaledToWidth(w, smooth ? Qt::SmoothTransformation : Qt::FastTransformation))); + return App::pixmapFromImageInPlace(prepareColored(add, img.scaledToWidth(w, smooth ? Qt::SmoothTransformation : Qt::FastTransformation))); } - return App::pixmapFromImageInPlace(Images::prepareColored(add, img.scaled(w, h, Qt::IgnoreAspectRatio, smooth ? Qt::SmoothTransformation : Qt::FastTransformation))); + return App::pixmapFromImageInPlace(prepareColored(add, img.scaled(w, h, Qt::IgnoreAspectRatio, smooth ? Qt::SmoothTransformation : Qt::FastTransformation))); } QPixmap Image::pixBlurredColoredNoCache( @@ -741,14 +739,14 @@ QPixmap Image::pixBlurredColoredNoCache( return Blank()->pix(origin); } - auto img = Images::prepareBlur(_data); + auto img = prepareBlur(_data); if (h <= 0) { img = img.scaledToWidth(w, Qt::SmoothTransformation); } else { img = img.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } - return App::pixmapFromImageInPlace(Images::prepareColored(add, img)); + return App::pixmapFromImageInPlace(prepareColored(add, img)); } std::optional Image::cacheKey() const { @@ -765,20 +763,18 @@ void Image::checkSource() const { if (_data.isNull() && !data.isNull()) { invalidateSizeCache(); _data = std::move(data); - if (!_data.isNull()) { - Images::GlobalAcquiredSize += int64(_data.width()) * _data.height() * 4; - } + ActiveCache().increment(ComputeUsage(_data)); } + + ActiveCache().up(this); } void Image::forget() const { _source->takeLoaded(); _source->forget(); invalidateSizeCache(); - if (!_data.isNull()) { - Images::GlobalAcquiredSize -= int64(_data.width()) * _data.height() * 4; - _data = QImage(); - } + ActiveCache().decrement(ComputeUsage(_data)); + _data = QImage(); } void Image::setDelayedStorageLocation( @@ -796,14 +792,14 @@ void Image::setImageBytes(const QByteArray &bytes) { } void Image::invalidateSizeCache() const { + auto &cache = ActiveCache(); for (const auto &image : std::as_const(_sizesCache)) { - if (!image.isNull()) { - Images::GlobalAcquiredSize -= int64(image.width()) * image.height() * 4; - } + cache.decrement(ComputeUsage(image)); } _sizesCache.clear(); } Image::~Image() { forget(); + ActiveCache().remove(this); } diff --git a/Telegram/SourceFiles/ui/image/image.h b/Telegram/SourceFiles/ui/image/image.h index 5a5342417..f86082691 100644 --- a/Telegram/SourceFiles/ui/image/image.h +++ b/Telegram/SourceFiles/ui/image/image.h @@ -15,7 +15,6 @@ namespace Images { void ClearRemote(); void ClearAll(); -void CheckCacheSize(); ImagePtr Create(const QString &file, QByteArray format); ImagePtr Create(const QString &url, QSize box); diff --git a/Telegram/gyp/lib_base.gyp b/Telegram/gyp/lib_base.gyp index 1f3e9c34e..d70fe8fad 100644 --- a/Telegram/gyp/lib_base.gyp +++ b/Telegram/gyp/lib_base.gyp @@ -59,6 +59,7 @@ '<(src_loc)/base/flat_set.h', '<(src_loc)/base/functors.h', '<(src_loc)/base/index_based_iterator.h', + '<(src_loc)/base/last_used_cache.h', '<(src_loc)/base/match_method.h', '<(src_loc)/base/observer.cpp', '<(src_loc)/base/observer.h', diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt index 411eaca13..323be2a32 100644 --- a/Telegram/gyp/telegram_sources.txt +++ b/Telegram/gyp/telegram_sources.txt @@ -119,6 +119,7 @@ <(src_loc)/core/launcher.h <(src_loc)/core/main_queue_processor.cpp <(src_loc)/core/main_queue_processor.h +<(src_loc)/core/media_active_cache.h <(src_loc)/core/mime_type.cpp <(src_loc)/core/mime_type.h <(src_loc)/core/single_timer.cpp