Exemplo n.º 1
0
 /// <summary>
 /// Instantiates the <see cref="NetworkFetchProducer"/>.
 /// </summary>
 public NetworkFetchProducer NewNetworkFetchProducer(INetworkFetcher <FetchState> networkFetcher)
 {
     return(new NetworkFetchProducer(
                _pooledByteBufferFactory,
                _byteArrayPool,
                networkFetcher));
 }
Exemplo n.º 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;
        }
 /// <summary>
 /// Instantiates the <see cref="NetworkFetchProducer"/>.
 /// </summary>
 public NetworkFetchProducer(
     IPooledByteBufferFactory pooledByteBufferFactory,
     IByteArrayPool byteArrayPool,
     INetworkFetcher <FetchState> networkFetcher)
 {
     _pooledByteBufferFactory = pooledByteBufferFactory;
     _byteArrayPool           = byteArrayPool;
     _networkFetcher          = networkFetcher;
 }
        private ImagePipelineConfig(Builder builder)
        {
            _animatedImageFactory            = builder.AnimatedImageFactory;
            _bitmapMemoryCacheParamsSupplier = builder.BitmapMemoryCacheParamsSupplier ??
                                               new DefaultBitmapMemoryCacheParamsSupplier();

            _bitmapConfig = builder.BitmapConfig == default(BitmapPixelFormat) ?
                            BitmapPixelFormat.Bgra8 : builder.BitmapConfig;

            _cacheKeyFactory = builder.CacheKeyFactory ?? DefaultCacheKeyFactory.Instance;

            _decodeMemoryFileEnabled = builder.IsDecodeMemoryFileEnabled;
            _fileCacheFactory        = builder.FileCacheFactory ??
                                       new DiskStorageCacheFactory(new DynamicDefaultDiskStorageFactory());

            _downsampleEnabled = builder.IsDownsampleEnabled;
            _encodedMemoryCacheParamsSupplier = builder.EncodedMemoryCacheParamsSupplier ??
                                                new DefaultEncodedMemoryCacheParamsSupplier();

            _imageCacheStatsTracker = builder.ImageCacheStatsTracker ??
                                      NoOpImageCacheStatsTracker.Instance;

            _imageDecoder = builder.ImageDecoder;
            _isPrefetchEnabledSupplier = builder.IsPrefetchEnabledSupplier ??
                                         new SupplierImpl <bool>(
                () =>
            {
                return(true);
            });

            _mainDiskCacheConfig = builder.MainDiskCacheConfig ??
                                   GetDefaultMainDiskCacheConfig();

            _memoryTrimmableRegistry = builder.MemoryTrimmableRegistry ??
                                       NoOpMemoryTrimmableRegistry.Instance;

            _networkFetcher        = builder.NetworkFetcher ?? new HttpUrlConnectionNetworkFetcher();
            _platformBitmapFactory = builder.PlatformBitmapFactory;
            _poolFactory           = builder.PoolFactory ?? new PoolFactory(PoolConfig.NewBuilder().Build());
            _progressiveJpegConfig = builder.ProgressiveJpegConfig == default(IProgressiveJpegConfig) ?
                                     new SimpleProgressiveJpegConfig() : builder.ProgressiveJpegConfig;

            _requestListeners = builder.RequestListeners ?? new HashSet <IRequestListener>();
            _resizeAndRotateEnabledForNetwork = builder.ResizeAndRotateEnabledForNetwork;
            _smallImageDiskCacheConfig        = builder.SmallImageDiskCacheConfig ?? _mainDiskCacheConfig;

            // Below this comment can't be built in alphabetical order, because of dependencies
            int numCpuBoundThreads = _poolFactory.FlexByteArrayPoolMaxNumThreads;

            _executorSupplier = builder.ExecutorSupplier ??
                                new DefaultExecutorSupplier(numCpuBoundThreads);

            _imagePipelineExperiments = builder.Experiment.Build();
        }
Exemplo n.º 5
0
 public static void GlobalInitialize(TestContext testContext)
 {
     _networkFetcher = new HttpUrlConnectionNetworkFetcher();
 }
 /// <summary>
 /// Sets the network fletcher.
 /// </summary>
 public Builder SetNetworkFetcher(INetworkFetcher <FetchState> networkFetcher)
 {
     NetworkFetcher = networkFetcher;
     return(this);
 }