(
&self,
key: AccessibilitySnapshotCacheKey,
snapshot: &Value,
generation: u64,
)
| 145 | } |
| 146 | |
| 147 | fn insert_if_generation( |
| 148 | &self, |
| 149 | key: AccessibilitySnapshotCacheKey, |
| 150 | snapshot: &Value, |
| 151 | generation: u64, |
| 152 | ) { |
| 153 | if !cacheable_accessibility_snapshot(snapshot) { |
| 154 | return; |
| 155 | } |
| 156 | let generations = self |
| 157 | .generations |
| 158 | .lock() |
| 159 | .unwrap_or_else(|poisoned| poisoned.into_inner()); |
| 160 | if generations.get(&key.udid).copied().unwrap_or(0) != generation { |
| 161 | return; |
| 162 | } |
| 163 | let mut cache = self |
| 164 | .inner |
| 165 | .lock() |
| 166 | .unwrap_or_else(|poisoned| poisoned.into_inner()); |
| 167 | cache.insert( |
| 168 | key, |
| 169 | CachedAccessibilitySnapshot { |
| 170 | cached_at: Instant::now(), |
| 171 | snapshot: snapshot.clone(), |
| 172 | }, |
| 173 | ); |
| 174 | } |
| 175 | |
| 176 | fn latest_interactive(&self, udid: &str) -> Option<Value> { |
| 177 | let mut cache = self |
no test coverage detected