| 194 | } |
| 195 | |
| 196 | Result update() |
| 197 | { |
| 198 | if (not pendingReload.pending) |
| 199 | { |
| 200 | return Result(true); |
| 201 | } |
| 202 | const Time::Relative elapsed = |
| 203 | Time::HighResolutionCounter().snap().subtractApproximate(pendingReload.lastEvent); |
| 204 | if (elapsed < Time::Milliseconds(250)) |
| 205 | { |
| 206 | return Result(true); |
| 207 | } |
| 208 | |
| 209 | auto reload = [this](const PluginIdentifier& plugin) { (void)load(plugin.view()); }; |
| 210 | if (pendingReload.reloadAll) |
| 211 | { |
| 212 | registry.getPluginsToReloadBecauseOf(StringSpan(), Time::Milliseconds(-1), reload); |
| 213 | } |
| 214 | else |
| 215 | { |
| 216 | registry.getPluginsToReloadBecauseOf(pendingReload.relativePath.view(), Time::Milliseconds(-1), reload); |
| 217 | } |
| 218 | pendingReload = {}; |
| 219 | return Result(true); |
| 220 | } |
| 221 | |
| 222 | private: |
| 223 | AsyncEventLoop* eventLoop = nullptr; |
no test coverage detected