| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 PassOwnPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtr<MemoryCache> cac
he) | 57 PassOwnPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtr<MemoryCache> cac
he) |
| 58 { | 58 { |
| 59 // Make sure we have non-empty gMemoryCache. | 59 // Make sure we have non-empty gMemoryCache. |
| 60 memoryCache(); | 60 memoryCache(); |
| 61 OwnPtr<MemoryCache> oldCache = gMemoryCache->release(); | 61 OwnPtr<MemoryCache> oldCache = gMemoryCache->release(); |
| 62 *gMemoryCache = cache; | 62 *gMemoryCache = cache; |
| 63 return oldCache.release(); | 63 return oldCache.release(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void MemoryCacheEntry::trace(Visitor* visitor) | |
| 67 { | |
| 68 visitor->trace(m_previousInLiveResourcesList); | |
| 69 visitor->trace(m_nextInLiveResourcesList); | |
| 70 visitor->trace(m_previousInAllResourcesList); | |
| 71 visitor->trace(m_nextInAllResourcesList); | |
| 72 } | |
| 73 | |
| 74 void MemoryCacheLRUList::trace(Visitor* visitor) | |
| 75 { | |
| 76 visitor->trace(m_head); | |
| 77 visitor->trace(m_tail); | |
| 78 } | |
| 79 | |
| 80 inline MemoryCache::MemoryCache() | 66 inline MemoryCache::MemoryCache() |
| 81 : m_inPruneResources(false) | 67 : m_inPruneResources(false) |
| 82 , m_maxPruneDeferralDelay(cMaxPruneDeferralDelay) | 68 , m_maxPruneDeferralDelay(cMaxPruneDeferralDelay) |
| 83 , m_capacity(cDefaultCacheCapacity) | 69 , m_capacity(cDefaultCacheCapacity) |
| 84 , m_minDeadCapacity(0) | 70 , m_minDeadCapacity(0) |
| 85 , m_maxDeadCapacity(cDefaultCacheCapacity) | 71 , m_maxDeadCapacity(cDefaultCacheCapacity) |
| 86 , m_maxDeferredPruneDeadCapacity(cDeferredPruneDeadCapacityFactor * cDefault
CacheCapacity) | 72 , m_maxDeferredPruneDeadCapacity(cDeferredPruneDeadCapacityFactor * cDefault
CacheCapacity) |
| 87 , m_delayBeforeLiveDecodedPrune(cMinDelayBeforeLiveDecodedPrune) | 73 , m_delayBeforeLiveDecodedPrune(cMinDelayBeforeLiveDecodedPrune) |
| 88 , m_liveSize(0) | 74 , m_liveSize(0) |
| 89 , m_deadSize(0) | 75 , m_deadSize(0) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 100 | 86 |
| 101 PassOwnPtr<MemoryCache> MemoryCache::create() | 87 PassOwnPtr<MemoryCache> MemoryCache::create() |
| 102 { | 88 { |
| 103 return adoptPtr(new MemoryCache()); | 89 return adoptPtr(new MemoryCache()); |
| 104 } | 90 } |
| 105 | 91 |
| 106 MemoryCache::~MemoryCache() | 92 MemoryCache::~MemoryCache() |
| 107 { | 93 { |
| 108 } | 94 } |
| 109 | 95 |
| 110 void MemoryCache::trace(Visitor* visitor) | |
| 111 { | |
| 112 #if ENABLE(OILPAN) | |
| 113 visitor->trace(m_allResources); | |
| 114 for (size_t i = 0; i < WTF_ARRAY_LENGTH(m_liveDecodedResources); ++i) | |
| 115 visitor->trace(m_liveDecodedResources[i]); | |
| 116 visitor->trace(m_resources); | |
| 117 visitor->trace(m_liveResources); | |
| 118 #endif | |
| 119 } | |
| 120 | |
| 121 KURL MemoryCache::removeFragmentIdentifierIfNeeded(const KURL& originalURL) | 96 KURL MemoryCache::removeFragmentIdentifierIfNeeded(const KURL& originalURL) |
| 122 { | 97 { |
| 123 if (!originalURL.hasFragmentIdentifier()) | 98 if (!originalURL.hasFragmentIdentifier()) |
| 124 return originalURL; | 99 return originalURL; |
| 125 // Strip away fragment identifier from HTTP URLs. | 100 // Strip away fragment identifier from HTTP URLs. |
| 126 // Data URLs must be unmodified. For file and custom URLs clients may expect
resources | 101 // Data URLs must be unmodified. For file and custom URLs clients may expect
resources |
| 127 // to be unique even when they differ by the fragment identifier only. | 102 // to be unique even when they differ by the fragment identifier only. |
| 128 if (!originalURL.protocolIsInHTTPFamily()) | 103 if (!originalURL.protocolIsInHTTPFamily()) |
| 129 return originalURL; | 104 return originalURL; |
| 130 KURL url = originalURL; | 105 KURL url = originalURL; |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 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()); | 720 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()); |
| 746 | 721 |
| 747 current = prev; | 722 current = prev; |
| 748 } | 723 } |
| 749 } | 724 } |
| 750 } | 725 } |
| 751 | 726 |
| 752 #endif // MEMORY_CACHE_STATS | 727 #endif // MEMORY_CACHE_STATS |
| 753 | 728 |
| 754 } // namespace blink | 729 } // namespace blink |
| OLD | NEW |