ui: delete TimelineCache

This is now unused and with the mipmap trace processor accelerators,
should not be needed again.

Change-Id: I75689b2160584806ac14f1ace498088c0f593986
diff --git a/ui/src/core/timeline_cache.ts b/ui/src/core/timeline_cache.ts
index 30d1cd3..fe84876 100644
--- a/ui/src/core/timeline_cache.ts
+++ b/ui/src/core/timeline_cache.ts
@@ -13,7 +13,6 @@
 // limitations under the License.
 
 import {BigintMath} from '../base/bigint_math';
-import {assertTrue} from '../base/logging';
 import {duration, time, Time} from '../base/time';
 
 export const BUCKETS_PER_PIXEL = 2;
@@ -123,63 +122,3 @@
     return `CacheKey<${start}, ${end}, ${bucket}, ${size}>`;
   }
 }
-
-interface CacheItem<T> {
-  t: T;
-  lastAccessId: number;
-}
-
-// LRU cache for the timeline.
-// T is all the data needed for a displaying the track in a given
-// CacheKey area - generally an array of slices.
-export class TimelineCache<T> {
-  private cacheSize: number;
-  private cache: Map<string, CacheItem<T>>;
-  private lastAccessId: number;
-
-  constructor(cacheSize: number) {
-    assertTrue(cacheSize >= 2);
-    this.cacheSize = cacheSize;
-    this.cache = new Map();
-    this.lastAccessId = 0;
-  }
-
-  invalidate() {
-    this.cache.clear();
-  }
-
-  insert(cacheKey: CacheKey, t: T): void {
-    assertTrue(cacheKey.isNormalized());
-    const key = cacheKey.toString();
-    this.cache.set(key, {
-      t,
-      lastAccessId: this.lastAccessId++,
-    });
-    this.updateLru();
-  }
-
-  lookup(cacheKey: CacheKey): undefined | T {
-    assertTrue(cacheKey.isNormalized());
-    const key = cacheKey.toString();
-    const item = this.cache.get(key);
-    if (item) {
-      item.lastAccessId = this.lastAccessId++;
-      this.updateLru();
-    }
-    return item === undefined ? undefined : item.t;
-  }
-
-  private updateLru(): void {
-    while (this.cache.size > this.cacheSize) {
-      let oldestKey = '';
-      let oldestAccessId = Number.MAX_SAFE_INTEGER;
-      for (const [k, v] of this.cache.entries()) {
-        if (v.lastAccessId < oldestAccessId) {
-          oldestAccessId = v.lastAccessId;
-          oldestKey = k;
-        }
-      }
-      this.cache.delete(oldestKey);
-    }
-  }
-}
diff --git a/ui/src/core/timeline_cache_unittest.ts b/ui/src/core/timeline_cache_unittest.ts
index 227c19d..c41fb64 100644
--- a/ui/src/core/timeline_cache_unittest.ts
+++ b/ui/src/core/timeline_cache_unittest.ts
@@ -14,7 +14,7 @@
 
 import {Time} from '../base/time';
 
-import {CacheKey, TimelineCache} from './timeline_cache';
+import {CacheKey} from './timeline_cache';
 
 test('cacheKeys', () => {
   const k = CacheKey.create(Time.fromRaw(201n), Time.fromRaw(302n), 123);
@@ -29,62 +29,3 @@
   expect(n.bucketSize).toBeGreaterThanOrEqual(k.bucketSize);
   expect(Math.abs(n.windowSizePx - k.windowSizePx)).toBeLessThanOrEqual(200);
 });
-
-test('cache', () => {
-  const key1 = CacheKey.create(
-    Time.fromRaw(1000n),
-    Time.fromRaw(1100n),
-    100,
-  ).normalize();
-  const key2 = CacheKey.create(
-    Time.fromRaw(2000n),
-    Time.fromRaw(2100n),
-    100,
-  ).normalize();
-  const key3 = CacheKey.create(
-    Time.fromRaw(3000n),
-    Time.fromRaw(3100n),
-    100,
-  ).normalize();
-  const key4 = CacheKey.create(
-    Time.fromRaw(4000n),
-    Time.fromRaw(4100n),
-    100,
-  ).normalize();
-  const key5 = CacheKey.create(
-    Time.fromRaw(5000n),
-    Time.fromRaw(5100n),
-    100,
-  ).normalize();
-  const key6 = CacheKey.create(
-    Time.fromRaw(6000n),
-    Time.fromRaw(6100n),
-    100,
-  ).normalize();
-  const key7 = CacheKey.create(
-    Time.fromRaw(7000n),
-    Time.fromRaw(7100n),
-    100,
-  ).normalize();
-  const cache = new TimelineCache<string>(5);
-
-  cache.insert(key1, 'v1');
-  expect(cache.lookup(key1)).toEqual('v1');
-
-  cache.insert(key2, 'v2');
-  cache.insert(key3, 'v3');
-  cache.insert(key4, 'v4');
-  cache.insert(key5, 'v5');
-
-  // Should push key1/v1 out of the cache:
-  cache.insert(key6, 'v6');
-  expect(cache.lookup(key1)).toEqual(undefined);
-
-  // Access key2 then add one more entry:
-  expect(cache.lookup(key2)).toEqual('v2');
-  cache.insert(key7, 'v7');
-
-  // key2/v2 should still be present but key3/v3 should be discarded:
-  expect(cache.lookup(key2)).toEqual('v2');
-  expect(cache.lookup(key3)).toEqual(undefined);
-});