Java 类com.facebook.imagepipeline.cache.CountingMemoryCache 实例源码

项目:GitHub    文件:ExperimentalBitmapAnimationDrawableFactory.java   
public ExperimentalBitmapAnimationDrawableFactory(
    AnimatedDrawableBackendProvider animatedDrawableBackendProvider,
    ScheduledExecutorService scheduledExecutorServiceForUiThread,
    ExecutorService executorServiceForFramePreparing,
    MonotonicClock monotonicClock,
    PlatformBitmapFactory platformBitmapFactory,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache,
    Supplier<Integer> cachingStrategySupplier,
    Supplier<Integer> numberOfFramesToPrepareSupplier) {
  mAnimatedDrawableBackendProvider = animatedDrawableBackendProvider;
  mScheduledExecutorServiceForUiThread = scheduledExecutorServiceForUiThread;
  mExecutorServiceForFramePreparing = executorServiceForFramePreparing;
  mMonotonicClock = monotonicClock;
  mPlatformBitmapFactory = platformBitmapFactory;
  mBackingCache = backingCache;
  mCachingStrategySupplier = cachingStrategySupplier;
  mNumberOfFramesToPrepareSupplier = numberOfFramesToPrepareSupplier;
}
项目:GitHub    文件:AnimatedFrameCacheTest.java   
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  MemoryCacheParams params = new MemoryCacheParams(
      4 * ByteConstants.MB,
      256,
      Integer.MAX_VALUE,
      Integer.MAX_VALUE,
      Integer.MAX_VALUE);
  when(mMemoryCacheParamsSupplier.get()).thenReturn(params);
  CountingMemoryCache<CacheKey, CloseableImage> countingMemoryCache =
      BitmapCountingMemoryCacheFactory.get(
          mMemoryCacheParamsSupplier,
          mMemoryTrimmableRegistry,
          mPlatformBitmapFactory,
          true);
  mCacheKey = new SimpleCacheKey("key");
  mAnimatedFrameCache = new AnimatedFrameCache(mCacheKey, countingMemoryCache);
  mFrame1 = CloseableReference.of(mock(CloseableImage.class));
  mFrame2 = CloseableReference.of(mock(CloseableImage.class));
}
项目:GitHub    文件:AnimatedFactoryProvider.java   
public static AnimatedFactory getAnimatedFactory(
    PlatformBitmapFactory platformBitmapFactory,
    ExecutorSupplier executorSupplier,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache) {
  if (!sImplLoaded) {
    try {
      final Class<?> clazz =
          Class.forName("com.facebook.fresco.animation.factory.AnimatedFactoryV2Impl");
      final Constructor<?> constructor = clazz.getConstructor(
          PlatformBitmapFactory.class,
          ExecutorSupplier.class,
          CountingMemoryCache.class);
      sImpl = (AnimatedFactory) constructor.newInstance(
          platformBitmapFactory,
          executorSupplier,
          backingCache);
    } catch (Throwable e) {
      // Head in the sand
    }
    if (sImpl != null) {
      sImplLoaded = true;
    }
  }
  return sImpl;
}
项目:fresco    文件:ExperimentalBitmapAnimationDrawableFactory.java   
public ExperimentalBitmapAnimationDrawableFactory(
    AnimatedDrawableBackendProvider animatedDrawableBackendProvider,
    ScheduledExecutorService scheduledExecutorServiceForUiThread,
    ExecutorService executorServiceForFramePreparing,
    MonotonicClock monotonicClock,
    PlatformBitmapFactory platformBitmapFactory,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache,
    Supplier<Integer> cachingStrategySupplier,
    Supplier<Integer> numberOfFramesToPrepareSupplier) {
  mAnimatedDrawableBackendProvider = animatedDrawableBackendProvider;
  mScheduledExecutorServiceForUiThread = scheduledExecutorServiceForUiThread;
  mExecutorServiceForFramePreparing = executorServiceForFramePreparing;
  mMonotonicClock = monotonicClock;
  mPlatformBitmapFactory = platformBitmapFactory;
  mBackingCache = backingCache;
  mCachingStrategySupplier = cachingStrategySupplier;
  mNumberOfFramesToPrepareSupplier = numberOfFramesToPrepareSupplier;
}
项目:fresco    文件:AnimatedFrameCacheTest.java   
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  MemoryCacheParams params = new MemoryCacheParams(
      4 * ByteConstants.MB,
      256,
      Integer.MAX_VALUE,
      Integer.MAX_VALUE,
      Integer.MAX_VALUE);
  when(mMemoryCacheParamsSupplier.get()).thenReturn(params);
  CountingMemoryCache<CacheKey, CloseableImage> countingMemoryCache =
      BitmapCountingMemoryCacheFactory.get(
          mMemoryCacheParamsSupplier,
          mMemoryTrimmableRegistry,
          mPlatformBitmapFactory,
          true);
  mCacheKey = new SimpleCacheKey("key");
  mAnimatedFrameCache = new AnimatedFrameCache(mCacheKey, countingMemoryCache);
  mFrame1 = CloseableReference.of(mock(CloseableImage.class));
  mFrame2 = CloseableReference.of(mock(CloseableImage.class));
}
项目:fresco    文件:AnimatedFactoryProvider.java   
public static AnimatedFactory getAnimatedFactory(
    PlatformBitmapFactory platformBitmapFactory,
    ExecutorSupplier executorSupplier,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache) {
  if (!sImplLoaded) {
    try {
      final Class<?> clazz =
          Class.forName("com.facebook.fresco.animation.factory.AnimatedFactoryV2Impl");
      final Constructor<?> constructor = clazz.getConstructor(
          PlatformBitmapFactory.class,
          ExecutorSupplier.class,
          CountingMemoryCache.class);
      sImpl = (AnimatedFactory) constructor.newInstance(
          platformBitmapFactory,
          executorSupplier,
          backingCache);
    } catch (Throwable e) {
      // Head in the sand
    }
    if (sImpl != null) {
      sImplLoaded = true;
    }
  }
  return sImpl;
}
项目:GitHub    文件:AnimatedFactoryV2Impl.java   
@DoNotStrip
public AnimatedFactoryV2Impl(
    PlatformBitmapFactory platformBitmapFactory,
    ExecutorSupplier executorSupplier,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache) {
  mPlatformBitmapFactory = platformBitmapFactory;
  mExecutorSupplier = executorSupplier;
  mBackingCache = backingCache;
}
项目:GitHub    文件:AnimatedFrameCache.java   
public AnimatedFrameCache(
    CacheKey imageCacheKey,
    final CountingMemoryCache<CacheKey, CloseableImage> backingCache) {
  mImageCacheKey = imageCacheKey;
  mBackingCache = backingCache;
  mFreeItemsPool = new LinkedHashSet<>();
  mEntryStateObserver = new CountingMemoryCache.EntryStateObserver<CacheKey>() {
    @Override
    public void onExclusivityChanged(CacheKey key, boolean isExclusive) {
      AnimatedFrameCache.this.onReusabilityChange(key, isExclusive);
    }
  };
}
项目:GitHub    文件:ImagePipelineFactory.java   
public CountingMemoryCache<CacheKey, CloseableImage>
getBitmapCountingMemoryCache() {
  if (mBitmapCountingMemoryCache == null) {
    mBitmapCountingMemoryCache =
        BitmapCountingMemoryCacheFactory.get(
            mConfig.getBitmapMemoryCacheParamsSupplier(),
            mConfig.getMemoryTrimmableRegistry(),
            getPlatformBitmapFactory(),
            mConfig.getExperiments().isExternalCreatedBitmapLogEnabled(),
            mConfig.getBitmapMemoryCacheTrimStrategy());
  }
  return mBitmapCountingMemoryCache;
}
项目:GitHub    文件:ImagePipelineFactory.java   
public CountingMemoryCache<CacheKey, PooledByteBuffer> getEncodedCountingMemoryCache() {
  if (mEncodedCountingMemoryCache == null) {
    mEncodedCountingMemoryCache =
        EncodedCountingMemoryCacheFactory.get(
            mConfig.getEncodedMemoryCacheParamsSupplier(),
            mConfig.getMemoryTrimmableRegistry(),
            getPlatformBitmapFactory());
  }
  return mEncodedCountingMemoryCache;
}
项目:fresco    文件:AnimatedFactoryV2Impl.java   
@DoNotStrip
public AnimatedFactoryV2Impl(
    PlatformBitmapFactory platformBitmapFactory,
    ExecutorSupplier executorSupplier,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache) {
  mPlatformBitmapFactory = platformBitmapFactory;
  mExecutorSupplier = executorSupplier;
  mBackingCache = backingCache;
}
项目:fresco    文件:AnimatedFrameCache.java   
public AnimatedFrameCache(
    CacheKey imageCacheKey,
    final CountingMemoryCache<CacheKey, CloseableImage> backingCache) {
  mImageCacheKey = imageCacheKey;
  mBackingCache = backingCache;
  mFreeItemsPool = new LinkedHashSet<>();
  mEntryStateObserver = new CountingMemoryCache.EntryStateObserver<CacheKey>() {
    @Override
    public void onExclusivityChanged(CacheKey key, boolean isExclusive) {
      AnimatedFrameCache.this.onReusabilityChange(key, isExclusive);
    }
  };
}
项目:fresco    文件:ImagePipelineFactory.java   
public CountingMemoryCache<CacheKey, CloseableImage>
getBitmapCountingMemoryCache() {
  if (mBitmapCountingMemoryCache == null) {
    mBitmapCountingMemoryCache =
        BitmapCountingMemoryCacheFactory.get(
            mConfig.getBitmapMemoryCacheParamsSupplier(),
            mConfig.getMemoryTrimmableRegistry(),
            getPlatformBitmapFactory(),
            mConfig.getExperiments().isExternalCreatedBitmapLogEnabled(),
            mConfig.getBitmapMemoryCacheTrimStrategy());
  }
  return mBitmapCountingMemoryCache;
}
项目:fresco    文件:ImagePipelineFactory.java   
public CountingMemoryCache<CacheKey, PooledByteBuffer> getEncodedCountingMemoryCache() {
  if (mEncodedCountingMemoryCache == null) {
    mEncodedCountingMemoryCache =
        EncodedCountingMemoryCacheFactory.get(
            mConfig.getEncodedMemoryCacheParamsSupplier(),
            mConfig.getMemoryTrimmableRegistry(),
            getPlatformBitmapFactory());
  }
  return mEncodedCountingMemoryCache;
}
项目:GitHub    文件:ImagePipelineConfig.java   
public CountingMemoryCache.CacheTrimStrategy getBitmapMemoryCacheTrimStrategy() {
  return mBitmapMemoryCacheTrimStrategy;
}
项目:GitHub    文件:ImagePipelineConfig.java   
public Builder setBitmapMemoryCacheTrimStrategy(
    CountingMemoryCache.CacheTrimStrategy trimStrategy) {
  mBitmapMemoryCacheTrimStrategy = trimStrategy;
  return this;
}
项目:fresco    文件:ImagePipelineConfig.java   
public CountingMemoryCache.CacheTrimStrategy getBitmapMemoryCacheTrimStrategy() {
  return mBitmapMemoryCacheTrimStrategy;
}
项目:fresco    文件:ImagePipelineConfig.java   
public Builder setBitmapMemoryCacheTrimStrategy(
    CountingMemoryCache.CacheTrimStrategy trimStrategy) {
  mBitmapMemoryCacheTrimStrategy = trimStrategy;
  return this;
}
项目:fastDev    文件:FrescoUtils.java   
@Override
public void registerBitmapMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}
项目:fastDev    文件:FrescoUtils.java   
@Override
public void registerEncodedMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}
项目:MyImageUtil    文件:FrescoUtil.java   
@Override
public void registerBitmapMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}
项目:MyImageUtil    文件:FrescoUtil.java   
@Override
public void registerEncodedMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}
项目:FrescoPlus    文件:FrescoCacheStatsTracker.java   
@Override
public void registerBitmapMemoryCache(CountingMemoryCache<?, ?> bitmapMemoryCache) {

}
项目:FrescoPlus    文件:FrescoCacheStatsTracker.java   
@Override
public void registerEncodedMemoryCache(CountingMemoryCache<?, ?> encodedMemoryCache) {

}
项目:FrescoUtlis    文件:FrescoUtils.java   
@Override
public void registerBitmapMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}
项目:FrescoUtlis    文件:FrescoUtils.java   
@Override
public void registerEncodedMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}
项目:ImageSliderByFresco    文件:FrescoUtil.java   
@Override
public void registerBitmapMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}
项目:ImageSliderByFresco    文件:FrescoUtil.java   
@Override
public void registerEncodedMemoryCache(CountingMemoryCache<?, ?> countingMemoryCache) {

}