mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Cache Webview::Availability() result for startup checks
Iv::ShowButton() and LocationPicker::Available() each called Webview::Availability() separately (~200ms each on Linux). Replace the per-caller static caches with a single shared cache in Core::CachedWebviewAvailability(), reducing startup from two ~200ms calls to one.
This commit is contained in:
@@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "iv/iv_data.h"
|
||||
|
||||
#include "iv/iv_prepare.h"
|
||||
#include "webview/webview_interface.h"
|
||||
#include "core/cached_webview_availability.h"
|
||||
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtCore/QUrl>
|
||||
@@ -102,12 +102,9 @@ QString SiteNameFromUrl(const QString &url) {
|
||||
}
|
||||
|
||||
bool ShowButton() {
|
||||
static const auto Supported = [&] {
|
||||
const auto availability = Webview::Availability();
|
||||
return availability.customSchemeRequests
|
||||
&& availability.customRangeRequests;
|
||||
}();
|
||||
return Supported;
|
||||
const auto &availability = Core::CachedWebviewAvailability();
|
||||
return availability.customSchemeRequests
|
||||
&& availability.customRangeRequests;
|
||||
}
|
||||
|
||||
void RecordShowFailure() {
|
||||
|
||||
Reference in New Issue
Block a user