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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 void MemoryCache::replace(Resource* newResource, Resource* oldResource) | 119 void MemoryCache::replace(Resource* newResource, Resource* oldResource) |
120 { | 120 { |
121 evict(oldResource); | 121 evict(oldResource); |
122 add(newResource); | 122 add(newResource); |
123 if (newResource->decodedSize() && newResource->hasClients()) | 123 if (newResource->decodedSize() && newResource->hasClients()) |
124 insertInLiveDecodedResourcesList(newResource); | 124 insertInLiveDecodedResourcesList(newResource); |
125 } | 125 } |
126 | 126 |
127 bool MemoryCache::contains(Resource* resource) | 127 bool MemoryCache::contains(const Resource* resource) const |
128 { | 128 { |
129 if (resource->url().isNull()) | 129 if (resource->url().isNull()) |
130 return false; | 130 return false; |
131 MemoryCacheEntry* entry = m_resources.get(resource->url()); | 131 const MemoryCacheEntry* entry = m_resources.get(resource->url()); |
132 return entry && entry->m_resource == resource; | 132 return entry && entry->m_resource == resource; |
133 } | 133 } |
134 | 134 |
135 Resource* MemoryCache::resourceForURL(const KURL& resourceURL) | 135 Resource* MemoryCache::resourceForURL(const KURL& resourceURL) |
136 { | 136 { |
137 ASSERT(WTF::isMainThread()); | 137 ASSERT(WTF::isMainThread()); |
138 KURL url = removeFragmentIdentifierIfNeeded(resourceURL); | 138 KURL url = removeFragmentIdentifierIfNeeded(resourceURL); |
139 MemoryCacheEntry* entry = m_resources.get(url); | 139 MemoryCacheEntry* entry = m_resources.get(url); |
140 if (!entry) | 140 if (!entry) |
141 return 0; | 141 return 0; |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 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()); | 673 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()); |
674 | 674 |
675 current = prev; | 675 current = prev; |
676 } | 676 } |
677 } | 677 } |
678 } | 678 } |
679 | 679 |
680 #endif // MEMORY_CACHE_STATS | 680 #endif // MEMORY_CACHE_STATS |
681 | 681 |
682 } // namespace WebCore | 682 } // namespace WebCore |
OLD | NEW |