(waveTabId: string)
| 251 | } |
| 252 | |
| 253 | function tryEvictEntry(waveTabId: string): boolean { |
| 254 | const tabView = wcvCache.get(waveTabId); |
| 255 | if (!tabView) { |
| 256 | return false; |
| 257 | } |
| 258 | if (tabView.isActiveTab) { |
| 259 | return false; |
| 260 | } |
| 261 | const lastUsedDiff = Date.now() - tabView.lastUsedTs; |
| 262 | if (lastUsedDiff < 1000) { |
| 263 | return false; |
| 264 | } |
| 265 | const ww = getWaveWindowById(tabView.waveWindowId); |
| 266 | if (!ww) { |
| 267 | // this shouldn't happen, but if it does, just destroy the tabview |
| 268 | console.log("[error] WaveWindow not found for WaveTabView", tabView.waveTabId); |
| 269 | tabView.destroy(); |
| 270 | return true; |
| 271 | } else { |
| 272 | // will trigger a destroy on the tabview |
| 273 | ww.removeTabView(tabView.waveTabId, false); |
| 274 | return true; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | function checkAndEvictCache(): void { |
| 279 | if (wcvCache.size <= MaxCacheSize) { |
no test coverage detected