Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/WebKit/Source/core/fetch/MemoryCache.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 KURL url = removeFragmentIdentifierIfNeeded(resourceURL); 197 KURL url = removeFragmentIdentifierIfNeeded(resourceURL);
198 MemoryCacheEntry* entry = resources->get(url); 198 MemoryCacheEntry* entry = resources->get(url);
199 if (!entry) 199 if (!entry)
200 return nullptr; 200 return nullptr;
201 Resource* resource = entry->m_resource.get(); 201 Resource* resource = entry->m_resource.get();
202 if (resource && !resource->lock()) 202 if (resource && !resource->lock())
203 return nullptr; 203 return nullptr;
204 return resource; 204 return resource;
205 } 205 }
206 206
207 WillBeHeapVector<RawPtrWillBeMember<Resource>> MemoryCache::resourcesForURL(cons t KURL& resourceURL) 207 HeapVector<Member<Resource>> MemoryCache::resourcesForURL(const KURL& resourceUR L)
208 { 208 {
209 ASSERT(WTF::isMainThread()); 209 ASSERT(WTF::isMainThread());
210 KURL url = removeFragmentIdentifierIfNeeded(resourceURL); 210 KURL url = removeFragmentIdentifierIfNeeded(resourceURL);
211 WillBeHeapVector<RawPtrWillBeMember<Resource>> results; 211 HeapVector<Member<Resource>> results;
212 for (const auto& resourceMapIter : m_resourceMaps) { 212 for (const auto& resourceMapIter : m_resourceMaps) {
213 if (MemoryCacheEntry* entry = resourceMapIter.value->get(url)) 213 if (MemoryCacheEntry* entry = resourceMapIter.value->get(url))
214 results.append(entry->m_resource.get()); 214 results.append(entry->m_resource.get());
215 } 215 }
216 return results; 216 return results;
217 } 217 }
218 218
219 size_t MemoryCache::deadCapacity() const 219 size_t MemoryCache::deadCapacity() const
220 { 220 {
221 // Dead resource capacity is whatever space is not occupied by live resource s, bounded by an independent minimum and maximum. 221 // Dead resource capacity is whatever space is not occupied by live resource s, bounded by an independent minimum and maximum.
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 MemoryCacheLiveResourcePriority MemoryCache::priority(Resource* resource) const 576 MemoryCacheLiveResourcePriority MemoryCache::priority(Resource* resource) const
577 { 577 {
578 MemoryCacheEntry* entry = getEntryForResource(resource); 578 MemoryCacheEntry* entry = getEntryForResource(resource);
579 if (!entry) 579 if (!entry)
580 return MemoryCacheLiveResourcePriorityUnknown; 580 return MemoryCacheLiveResourcePriorityUnknown;
581 return entry->m_liveResourcePriority; 581 return entry->m_liveResourcePriority;
582 } 582 }
583 583
584 void MemoryCache::removeURLFromCache(const KURL& url) 584 void MemoryCache::removeURLFromCache(const KURL& url)
585 { 585 {
586 WillBeHeapVector<RawPtrWillBeMember<Resource>> resources = resourcesForURL(u rl); 586 HeapVector<Member<Resource>> resources = resourcesForURL(url);
587 for (Resource* resource : resources) 587 for (Resource* resource : resources)
588 memoryCache()->remove(resource); 588 memoryCache()->remove(resource);
589 } 589 }
590 590
591 void MemoryCache::TypeStatistic::addResource(Resource* o) 591 void MemoryCache::TypeStatistic::addResource(Resource* o)
592 { 592 {
593 bool purgeable = o->isPurgeable(); 593 bool purgeable = o->isPurgeable();
594 size_t pageSize = (o->encodedSize() + o->overheadSize() + 4095) & ~4095; 594 size_t pageSize = (o->encodedSize() + o->overheadSize() + 4095) & ~4095;
595 count++; 595 count++;
596 size += o->size(); 596 size += o->size();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 781
782 void MemoryCache::dumpLRULists(bool includeLive) const 782 void MemoryCache::dumpLRULists(bool includeLive) const
783 { 783 {
784 printf("LRU-SP lists in eviction order (Kilobytes decoded, Kilobytes encoded , Access count, Referenced, isPurgeable):\n"); 784 printf("LRU-SP lists in eviction order (Kilobytes decoded, Kilobytes encoded , Access count, Referenced, isPurgeable):\n");
785 785
786 int size = m_allResources.size(); 786 int size = m_allResources.size();
787 for (int i = size - 1; i >= 0; i--) { 787 for (int i = size - 1; i >= 0; i--) {
788 printf("\n\nList %d: ", i); 788 printf("\n\nList %d: ", i);
789 MemoryCacheEntry* current = m_allResources[i].m_tail; 789 MemoryCacheEntry* current = m_allResources[i].m_tail;
790 while (current) { 790 while (current) {
791 RefPtrWillBeRawPtr<Resource> currentResource = current->m_resource; 791 RawPtr<Resource> currentResource = current->m_resource;
792 if (includeLive || !currentResource->hasClients()) 792 if (includeLive || !currentResource->hasClients())
793 printf("(%.1fK, %.1fK, %uA, %dR, %d); ", currentResource->decode dSize() / 1024.0f, (currentResource->encodedSize() + currentResource->overheadSi ze()) / 1024.0f, current->m_accessCount, currentResource->hasClients(), currentR esource->isPurgeable()); 793 printf("(%.1fK, %.1fK, %uA, %dR, %d); ", currentResource->decode dSize() / 1024.0f, (currentResource->encodedSize() + currentResource->overheadSi ze()) / 1024.0f, current->m_accessCount, currentResource->hasClients(), currentR esource->isPurgeable());
794 794
795 current = current->m_previousInAllResourcesList; 795 current = current->m_previousInAllResourcesList;
796 } 796 }
797 } 797 }
798 } 798 }
799 799
800 #endif // MEMORY_CACHE_STATS 800 #endif // MEMORY_CACHE_STATS
801 801
802 } // namespace blink 802 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698