OLD | NEW |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 void MemoryCacheEntry::trace(Visitor* visitor) | 80 void MemoryCacheEntry::trace(Visitor* visitor) |
81 { | 81 { |
82 visitor->trace(m_previousInLiveResourcesList); | 82 visitor->trace(m_previousInLiveResourcesList); |
83 visitor->trace(m_nextInLiveResourcesList); | 83 visitor->trace(m_nextInLiveResourcesList); |
84 visitor->trace(m_previousInAllResourcesList); | 84 visitor->trace(m_previousInAllResourcesList); |
85 visitor->trace(m_nextInAllResourcesList); | 85 visitor->trace(m_nextInAllResourcesList); |
86 } | 86 } |
87 | 87 |
| 88 #if ENABLE(OILPAN) |
| 89 void MemoryCacheEntry::dispose() |
| 90 { |
| 91 m_resource.clear(); |
| 92 } |
| 93 #endif |
| 94 |
88 void MemoryCacheLRUList::trace(Visitor* visitor) | 95 void MemoryCacheLRUList::trace(Visitor* visitor) |
89 { | 96 { |
90 visitor->trace(m_head); | 97 visitor->trace(m_head); |
91 visitor->trace(m_tail); | 98 visitor->trace(m_tail); |
92 } | 99 } |
93 | 100 |
94 inline MemoryCache::MemoryCache() | 101 inline MemoryCache::MemoryCache() |
95 : m_inPruneResources(false) | 102 : m_inPruneResources(false) |
96 , m_prunePending(false) | 103 , m_prunePending(false) |
97 , m_maxPruneDeferralDelay(cMaxPruneDeferralDelay) | 104 , m_maxPruneDeferralDelay(cMaxPruneDeferralDelay) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 Resource* resource = entry->m_resource.get(); | 372 Resource* resource = entry->m_resource.get(); |
366 bool canDelete = resource->canDelete(); | 373 bool canDelete = resource->canDelete(); |
367 WTF_LOG(ResourceLoading, "Evicting resource %p for '%s' from cache", resourc
e, resource->url().string().latin1().data()); | 374 WTF_LOG(ResourceLoading, "Evicting resource %p for '%s' from cache", resourc
e, resource->url().string().latin1().data()); |
368 // The resource may have already been removed by someone other than our call
er, | 375 // The resource may have already been removed by someone other than our call
er, |
369 // who needed a fresh copy for a reload. See <http://bugs.webkit.org/show_bu
g.cgi?id=12479#c6>. | 376 // who needed a fresh copy for a reload. See <http://bugs.webkit.org/show_bu
g.cgi?id=12479#c6>. |
370 update(resource, resource->size(), 0, false); | 377 update(resource, resource->size(), 0, false); |
371 removeFromLiveDecodedResourcesList(entry); | 378 removeFromLiveDecodedResourcesList(entry); |
372 | 379 |
373 ResourceMap::iterator it = m_resources.find(resource->url()); | 380 ResourceMap::iterator it = m_resources.find(resource->url()); |
374 ASSERT(it != m_resources.end()); | 381 ASSERT(it != m_resources.end()); |
375 #if !ENABLE(OILPAN) | 382 #if ENABLE(OILPAN) |
| 383 MemoryCacheEntry* entryPtr = it->value; |
| 384 #else |
376 OwnPtr<MemoryCacheEntry> entryPtr; | 385 OwnPtr<MemoryCacheEntry> entryPtr; |
377 entryPtr.swap(it->value); | 386 entryPtr.swap(it->value); |
378 #endif | 387 #endif |
379 m_resources.remove(it); | 388 m_resources.remove(it); |
| 389 #if ENABLE(OILPAN) |
| 390 if (entryPtr) |
| 391 entryPtr->dispose(); |
| 392 #endif |
380 return canDelete; | 393 return canDelete; |
381 } | 394 } |
382 | 395 |
383 MemoryCacheLRUList* MemoryCache::lruListFor(unsigned accessCount, size_t size) | 396 MemoryCacheLRUList* MemoryCache::lruListFor(unsigned accessCount, size_t size) |
384 { | 397 { |
385 ASSERT(accessCount > 0); | 398 ASSERT(accessCount > 0); |
386 unsigned queueIndex = WTF::fastLog2(size / accessCount); | 399 unsigned queueIndex = WTF::fastLog2(size / accessCount); |
387 if (m_allResources.size() <= queueIndex) | 400 if (m_allResources.size() <= queueIndex) |
388 m_allResources.grow(queueIndex + 1); | 401 m_allResources.grow(queueIndex + 1); |
389 return &m_allResources[queueIndex]; | 402 return &m_allResources[queueIndex]; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 printf("(%.1fK, %.1fK, %uA, %dR, %d, %d); ", current->decodedSiz
e() / 1024.0f, (current->encodedSize() + current->overheadSize()) / 1024.0f, cur
rent->accessCount(), current->hasClients(), current->isPurgeable(), current->was
Purged()); | 802 printf("(%.1fK, %.1fK, %uA, %dR, %d, %d); ", current->decodedSiz
e() / 1024.0f, (current->encodedSize() + current->overheadSize()) / 1024.0f, cur
rent->accessCount(), current->hasClients(), current->isPurgeable(), current->was
Purged()); |
790 | 803 |
791 current = prev; | 804 current = prev; |
792 } | 805 } |
793 } | 806 } |
794 } | 807 } |
795 | 808 |
796 #endif // MEMORY_CACHE_STATS | 809 #endif // MEMORY_CACHE_STATS |
797 | 810 |
798 } // namespace blink | 811 } // namespace blink |
OLD | NEW |