| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 m_resources.set(resource->url(), adoptPtr(originMap)); | 105 m_resources.set(resource->url(), adoptPtr(originMap)); |
| 106 } | 106 } |
| 107 originMap->set(resource->cachePartition(), resource); | 107 originMap->set(resource->cachePartition(), resource); |
| 108 #else | 108 #else |
| 109 m_resources.set(resource->url(), resource); | 109 m_resources.set(resource->url(), resource); |
| 110 #endif | 110 #endif |
| 111 resource->setInCache(true); | 111 resource->setInCache(true); |
| 112 | 112 |
| 113 resourceAccessed(resource); | 113 resourceAccessed(resource); |
| 114 | 114 |
| 115 LOG(ResourceLoading, "MemoryCache::add Added '%s', resource %p\n", resource-
>url().string().latin1().data(), resource); | 115 LOG_INFO(ResourceLoading, "MemoryCache::add Added '%s', resource %p\n", reso
urce->url().string().latin1().data(), resource); |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void MemoryCache::revalidationSucceeded(CachedResource* revalidatingResource, co
nst ResourceResponse& response) | 119 void MemoryCache::revalidationSucceeded(CachedResource* revalidatingResource, co
nst ResourceResponse& response) |
| 120 { | 120 { |
| 121 CachedResource* resource = revalidatingResource->resourceToRevalidate(); | 121 CachedResource* resource = revalidatingResource->resourceToRevalidate(); |
| 122 ASSERT(resource); | 122 ASSERT(resource); |
| 123 ASSERT(!resource->inCache()); | 123 ASSERT(!resource->inCache()); |
| 124 ASSERT(resource->isLoaded()); | 124 ASSERT(resource->isLoaded()); |
| 125 ASSERT(revalidatingResource->inCache()); | 125 ASSERT(revalidatingResource->inCache()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 154 | 154 |
| 155 revalidatingResource->switchClientsToRevalidatedResource(); | 155 revalidatingResource->switchClientsToRevalidatedResource(); |
| 156 ASSERT(!revalidatingResource->m_deleted); | 156 ASSERT(!revalidatingResource->m_deleted); |
| 157 // this deletes the revalidating resource | 157 // this deletes the revalidating resource |
| 158 revalidatingResource->clearResourceToRevalidate(); | 158 revalidatingResource->clearResourceToRevalidate(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void MemoryCache::revalidationFailed(CachedResource* revalidatingResource) | 161 void MemoryCache::revalidationFailed(CachedResource* revalidatingResource) |
| 162 { | 162 { |
| 163 ASSERT(WTF::isMainThread()); | 163 ASSERT(WTF::isMainThread()); |
| 164 LOG(ResourceLoading, "Revalidation failed for %p", revalidatingResource); | 164 LOG_INFO(ResourceLoading, "Revalidation failed for %p", revalidatingResource
); |
| 165 ASSERT(revalidatingResource->resourceToRevalidate()); | 165 ASSERT(revalidatingResource->resourceToRevalidate()); |
| 166 revalidatingResource->clearResourceToRevalidate(); | 166 revalidatingResource->clearResourceToRevalidate(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 CachedResource* MemoryCache::resourceForURL(const KURL& resourceURL) | 169 CachedResource* MemoryCache::resourceForURL(const KURL& resourceURL) |
| 170 { | 170 { |
| 171 return resourceForRequest(ResourceRequest(resourceURL)); | 171 return resourceForRequest(ResourceRequest(resourceURL)); |
| 172 } | 172 } |
| 173 | 173 |
| 174 CachedResource* MemoryCache::resourceForRequest(const ResourceRequest& request) | 174 CachedResource* MemoryCache::resourceForRequest(const ResourceRequest& request) |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 return false; | 409 return false; |
| 410 | 410 |
| 411 adjustSize(resource->hasClients(), -static_cast<int>(resource->size())); | 411 adjustSize(resource->hasClients(), -static_cast<int>(resource->size())); |
| 412 | 412 |
| 413 return true; | 413 return true; |
| 414 } | 414 } |
| 415 | 415 |
| 416 void MemoryCache::evict(CachedResource* resource) | 416 void MemoryCache::evict(CachedResource* resource) |
| 417 { | 417 { |
| 418 ASSERT(WTF::isMainThread()); | 418 ASSERT(WTF::isMainThread()); |
| 419 LOG(ResourceLoading, "Evicting resource %p for '%s' from cache", resource, r
esource->url().string().latin1().data()); | 419 LOG_INFO(ResourceLoading, "Evicting resource %p for '%s' from cache", resour
ce, resource->url().string().latin1().data()); |
| 420 // The resource may have already been removed by someone other than our call
er, | 420 // The resource may have already been removed by someone other than our call
er, |
| 421 // who needed a fresh copy for a reload. See <http://bugs.webkit.org/show_bu
g.cgi?id=12479#c6>. | 421 // who needed a fresh copy for a reload. See <http://bugs.webkit.org/show_bu
g.cgi?id=12479#c6>. |
| 422 if (resource->inCache()) { | 422 if (resource->inCache()) { |
| 423 // Remove from the resource map. | 423 // Remove from the resource map. |
| 424 #if ENABLE(CACHE_PARTITIONING) | 424 #if ENABLE(CACHE_PARTITIONING) |
| 425 CachedResourceItem* item = m_resources.get(resource->url()); | 425 CachedResourceItem* item = m_resources.get(resource->url()); |
| 426 if (item) { | 426 if (item) { |
| 427 item->remove(resource->cachePartition()); | 427 item->remove(resource->cachePartition()); |
| 428 if (!item->size()) | 428 if (!item->size()) |
| 429 m_resources.remove(resource->url()); | 429 m_resources.remove(resource->url()); |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 if (includeLive || !current->hasClients()) | 873 if (includeLive || !current->hasClients()) |
| 874 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()); | 874 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()); |
| 875 | 875 |
| 876 current = prev; | 876 current = prev; |
| 877 } | 877 } |
| 878 } | 878 } |
| 879 } | 879 } |
| 880 #endif | 880 #endif |
| 881 | 881 |
| 882 } // namespace WebCore | 882 } // namespace WebCore |
| OLD | NEW |