Commit b4746edd by tasnimsunny Committed by Oliver Woodman

Add cache initializtion signal to CacheEvictor

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124374161
parent 4b3c72c0
...@@ -21,6 +21,9 @@ package com.google.android.exoplayer.upstream.cache; ...@@ -21,6 +21,9 @@ package com.google.android.exoplayer.upstream.cache;
*/ */
public interface CacheEvictor extends Cache.Listener { public interface CacheEvictor extends Cache.Listener {
/** Invoked when cache has beeen initialized. */
void onCacheInitialized();
/** /**
* Invoked when a writer starts writing to the cache. * Invoked when a writer starts writing to the cache.
* *
......
...@@ -34,6 +34,11 @@ public final class LeastRecentlyUsedCacheEvictor implements CacheEvictor, Compar ...@@ -34,6 +34,11 @@ public final class LeastRecentlyUsedCacheEvictor implements CacheEvictor, Compar
} }
@Override @Override
public void onCacheInitialized() {
// Do nothing.
}
@Override
public void onStartFile(Cache cache, String key, long position, long length) { public void onStartFile(Cache cache, String key, long position, long length) {
evictCache(cache, length); evictCache(cache, length);
} }
......
...@@ -25,6 +25,11 @@ package com.google.android.exoplayer.upstream.cache; ...@@ -25,6 +25,11 @@ package com.google.android.exoplayer.upstream.cache;
public final class NoOpCacheEvictor implements CacheEvictor { public final class NoOpCacheEvictor implements CacheEvictor {
@Override @Override
public void onCacheInitialized() {
// Do nothing.
}
@Override
public void onStartFile(Cache cache, String key, long position, long length) { public void onStartFile(Cache cache, String key, long position, long length) {
// Do nothing. // Do nothing.
} }
......
...@@ -253,6 +253,7 @@ public final class SimpleCache implements Cache { ...@@ -253,6 +253,7 @@ public final class SimpleCache implements Cache {
} }
} }
} }
evictor.onCacheInitialized();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment