-
-
Notifications
You must be signed in to change notification settings - Fork 67
feat(clapper): prepare for 0.10 #1435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -121,6 +129,47 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable { | |||
} | |||
} | |||
|
|||
#if CLAPPER_0_10 | |||
private bool enhancer_check (string scheme, string? t_host = null) { | |||
if (!Clapper.WITH_ENHANCERS_LOADER) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for information, this is fine cause it might save you from calling .substring (4)
below in a (I guess rare) situation where Clapper is compiled without this option, so you can leave it as-is. But other than that (including compiled with but none installed) it is perfectly safe for applications to call Clapper.get_global_enhancer_proxies()
- in this case returned GListModel
will simply have zero elements and for
loop would not execute.
Ohhh, I didn't read the description, I just assumed it would only check the whole value and not treat them as a list, so I dismissed it instantly 😔... Much better than splitting and all! It doesn't look like it matters and it's too early to do optimizations since the API is not done, but I do wonder if it's worth keeping some sort of 'cache'. E.g. "https", "youtube.com": passed Keep that in memory and next time those combinations of scheme and host are checked, instantly return whether it's supported from memory instead of checking all plugins again |
I thought about this too, but unsure how much of a boost you would get here to be worth it. These strings are read during init, then stored in enhancer proxy object, so there is no string dup/free going on. Just saving the amount of time it takes to iterate (currently) up to 3 elements array. |
Co-authored-by: Rafał Dzięgiel <[email protected]>
Co-authored-by: Rafał Dzięgiel <[email protected]>
fix: #1431