/// <summary>
 /// Instantiates the <see cref="ImagePipelineCore"/>.
 /// </summary>
 /// <param name="producerSequenceFactory">
 /// The factory that creates all producer sequences.
 /// </param>
 /// <param name="requestListeners">
 /// The listeners for the image requests.
 /// </param>
 /// <param name="isPrefetchEnabledSupplier">
 /// The supplier for enabling prefetch.
 /// </param>
 /// <param name="bitmapMemoryCache">
 /// The memory cache for CloseableImage.
 /// </param>
 /// <param name="encodedMemoryCache">
 /// The memory cache for IPooledByteBuffer.
 /// </param>
 /// <param name="mainBufferedDiskCache">
 /// The default buffered disk cache.
 /// </param>
 /// <param name="smallImageBufferedDiskCache">
 /// The buffered disk cache used for small images.
 /// </param>
 /// <param name="cacheKeyFactory">
 /// The factory that creates cache keys for the pipeline.
 /// </param>
 /// <param name="threadHandoffProducerQueue">
 /// Move further computation to different thread.
 /// </param>
 /// <param name="flexByteArrayPool">
 /// The memory pool use for BitmapImage conversion.
 /// </param>
 public ImagePipelineCore(
     ProducerSequenceFactory producerSequenceFactory,
     HashSet <IRequestListener> requestListeners,
     ISupplier <bool> isPrefetchEnabledSupplier,
     IMemoryCache <ICacheKey, CloseableImage> bitmapMemoryCache,
     IMemoryCache <ICacheKey, IPooledByteBuffer> encodedMemoryCache,
     BufferedDiskCache mainBufferedDiskCache,
     BufferedDiskCache smallImageBufferedDiskCache,
     ICacheKeyFactory cacheKeyFactory,
     ThreadHandoffProducerQueue threadHandoffProducerQueue,
     FlexByteArrayPool flexByteArrayPool)
 {
     _idCounter = 0;
     _producerSequenceFactory     = producerSequenceFactory;
     _requestListener             = new ForwardingRequestListener(requestListeners);
     _isPrefetchEnabledSupplier   = isPrefetchEnabledSupplier;
     _bitmapMemoryCache           = bitmapMemoryCache;
     _encodedMemoryCache          = encodedMemoryCache;
     _mainBufferedDiskCache       = mainBufferedDiskCache;
     _smallImageBufferedDiskCache = smallImageBufferedDiskCache;
     _cacheKeyFactory             = cacheKeyFactory;
     _threadHandoffProducerQueue  = threadHandoffProducerQueue;
     _flexByteArrayPool           = flexByteArrayPool;
     _handleResultExecutor        = Executors.NewFixedThreadPool(MAX_DATA_SOURCE_SUBSCRIBERS);
 }
Beispiel #2
0
        /// <summary>
        /// Instantiates the <see cref="ProducerSequenceFactory"/>.
        /// </summary>
        public ProducerSequenceFactory(
            ProducerFactory producerFactory,
            INetworkFetcher <FetchState> networkFetcher,
            bool resizeAndRotateEnabledForNetwork,
            bool downsampleEnabled,
            bool webpSupportEnabled,
            ThreadHandoffProducerQueue threadHandoffProducerQueue,
            int throttlingMaxSimultaneousRequests,
            FlexByteArrayPool flexByteArrayPool)
        {
            _producerFactory = producerFactory;
            _networkFetcher  = networkFetcher;
            _resizeAndRotateEnabledForNetwork = resizeAndRotateEnabledForNetwork;
            _downsampleEnabled      = downsampleEnabled;
            _webpSupportEnabled     = webpSupportEnabled;
            _postprocessorSequences = new Dictionary <
                IProducer <CloseableReference <CloseableImage> >,
                IProducer <CloseableReference <CloseableImage> > >();

            _closeableImagePrefetchSequences = new Dictionary <
                IProducer <CloseableReference <CloseableImage> >,
                IProducer <object> >();

            _threadHandoffProducerQueue        = threadHandoffProducerQueue;
            _throttlingMaxSimultaneousRequests = throttlingMaxSimultaneousRequests;
            _flexByteArrayPool = flexByteArrayPool;
        }
Beispiel #3
0
 /// <summary>
 /// Instantiates the <see cref="ThreadHandoffProducer{T}"/>.
 /// </summary>
 /// <param name="inputProducer">
 /// The input producer.
 /// </param>
 /// <param name="inputThreadHandoffProducerQueue">
 /// The thread handoff producer queue.
 /// </param>
 public ThreadHandoffProducer <T> NewBackgroundThreadHandoffProducer <T>(
     IProducer <T> inputProducer,
     ThreadHandoffProducerQueue inputThreadHandoffProducerQueue)
 {
     return(new ThreadHandoffProducer <T>(
                inputProducer,
                inputThreadHandoffProducerQueue));
 }
Beispiel #4
0
 /// <summary>
 /// Instantiates the <see cref="ImagePipelineFactory"/>.
 /// </summary>
 public ImagePipelineFactory(ImagePipelineConfig config)
 {
     _config = Preconditions.CheckNotNull(config);
     _threadHandoffProducerQueue = new ThreadHandoffProducerQueue(
         config.ExecutorSupplier.ForLightweightBackgroundTasks);
 }