Add cache initializtion signal to CacheEvictor

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124374161
This commit is contained in:
tasnimsunny 2016-06-08 11:29:37 -07:00 committed by Oliver Woodman
parent 4b3c72c057
commit b4746eddb3
4 changed files with 14 additions and 0 deletions

View File

@ -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.
*

View File

@ -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);

View File

@ -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.

View File

@ -253,6 +253,7 @@ public final class SimpleCache implements Cache {
}
}
}
evictor.onCacheInitialized();
}
/**