示例#1
0
        static Optional <int> GetSurfaceId(SurfaceCacheItem item)
        {
            if (item == null)
            {
                return(Optional.None());
            }

            return(item.Surface.GetSurfaceId());
        }
示例#2
0
        void Swap(SurfaceCacheItem newFrontSurface)
        {
            if (GetSurfaceId(newFrontSurface) != GetSurfaceId(_backSurface))
            {
                // If new surface hasn't been cached, then pin the old one for deletion
                if (_backSurface != null)
                {
                    PinSurfaceItemForWipe(_backSurface);
                }
            }

            _backSurface  = _frontSurface;
            _frontSurface = newFrontSurface;
            _surfaceSwapped.OnNext(Unit.Default);
        }
示例#3
0
 void PinSurfaceItemForWipe(SurfaceCacheItem item)
 {
     item.ThrowIfNull("item");
     _surfacesToBeWiped.Enqueue(item);
 }