Add cache initializtion signal to CacheEvictor
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=124374161
This commit is contained in:
parent
4b3c72c057
commit
b4746eddb3
@ -21,6 +21,9 @@ package com.google.android.exoplayer.upstream.cache;
|
||||
*/
|
||||
public interface CacheEvictor extends Cache.Listener {
|
||||
|
||||
/** Invoked when cache has beeen initialized. */
|
||||
void onCacheInitialized();
|
||||
|
||||
/**
|
||||
* Invoked when a writer starts writing to the cache.
|
||||
*
|
||||
|
@ -33,6 +33,11 @@ public final class LeastRecentlyUsedCacheEvictor implements CacheEvictor, Compar
|
||||
this.leastRecentlyUsed = new TreeSet<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCacheInitialized() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartFile(Cache cache, String key, long position, long length) {
|
||||
evictCache(cache, length);
|
||||
|
@ -24,6 +24,11 @@ package com.google.android.exoplayer.upstream.cache;
|
||||
*/
|
||||
public final class NoOpCacheEvictor implements CacheEvictor {
|
||||
|
||||
@Override
|
||||
public void onCacheInitialized() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartFile(Cache cache, String key, long position, long length) {
|
||||
// Do nothing.
|
||||
|
@ -253,6 +253,7 @@ public final class SimpleCache implements Cache {
|
||||
}
|
||||
}
|
||||
}
|
||||
evictor.onCacheInitialized();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user