| 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 | 664 |
| 665 if (m_prunePending && m_deadSize > m_maxDeferredPruneDeadCapacity && justRel
easedResource) { | 665 if (m_prunePending && m_deadSize > m_maxDeferredPruneDeadCapacity && justRel
easedResource) { |
| 666 // The following eviction does not respect LRU order, but it can be done | 666 // The following eviction does not respect LRU order, but it can be done |
| 667 // immediately in constant time, as opposed to pruneDeadResources, which | 667 // immediately in constant time, as opposed to pruneDeadResources, which |
| 668 // we would rather defer because it is O(N), which would make tear-down
of N | 668 // we would rather defer because it is O(N), which would make tear-down
of N |
| 669 // objects O(N^2) if we pruned immediately. This immediate eviction is a | 669 // objects O(N^2) if we pruned immediately. This immediate eviction is a |
| 670 // safeguard against runaway memory consumption by dead resources | 670 // safeguard against runaway memory consumption by dead resources |
| 671 // while a prune is pending. | 671 // while a prune is pending. |
| 672 // Main Resources in the cache are only substitue data that was | 672 if (MemoryCacheEntry* entry = getEntryForResource(justReleasedResource)) |
| 673 // precached and should not be evicted. | 673 evict(entry); |
| 674 if (justReleasedResource->getType() != Resource::MainResource) { | |
| 675 if (MemoryCacheEntry* entry = getEntryForResource(justReleasedResour
ce)) | |
| 676 evict(entry); | |
| 677 } | |
| 678 | 674 |
| 679 // As a last resort, prune immediately | 675 // As a last resort, prune immediately |
| 680 if (m_deadSize > m_maxDeferredPruneDeadCapacity) | 676 if (m_deadSize > m_maxDeferredPruneDeadCapacity) |
| 681 pruneNow(currentTime, AutomaticPrune); | 677 pruneNow(currentTime, AutomaticPrune); |
| 682 } | 678 } |
| 683 } | 679 } |
| 684 | 680 |
| 685 void MemoryCache::willProcessTask() | 681 void MemoryCache::willProcessTask() |
| 686 { | 682 { |
| 687 } | 683 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 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()); | 771 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()); |
| 776 | 772 |
| 777 current = current->m_previousInAllResourcesList; | 773 current = current->m_previousInAllResourcesList; |
| 778 } | 774 } |
| 779 } | 775 } |
| 780 } | 776 } |
| 781 | 777 |
| 782 #endif // MEMORY_CACHE_STATS | 778 #endif // MEMORY_CACHE_STATS |
| 783 | 779 |
| 784 } // namespace blink | 780 } // namespace blink |
| OLD | NEW |