Example #1
0
        public Page GetPage(PageNumberInfo number)
        {
            if (ModifiedPages.TryGetValue(number, out var dirtyPage))
            {
                return(dirtyPage);
            }

            if (AllocatedPages.Contains(number))
            {
                return(CreatePage(number));
            }

            var poolPage = Pool.GetEntry(number);

            if (poolPage != null)
            {
                return(poolPage);
            }

            var page = PageManager.GetPage(number);

            if (page == null)
            {
                throw null;
            }

            Pool.AddEntry(page, PageEntryState.None);

            return(page);
        }
Example #2
0
        public IEnumerable <PageNumberInfo> AllocateNewPages(int token, int count)
        {
            var newPages = PageManager.Allocate(token, (uint)count);

            if (newPages != null)
            {
                AllocatedPages.AddRange(newPages);
            }

            return(newPages);
        }