| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 MemoryCache* memoryCache() | 49 MemoryCache* memoryCache() |
| 50 { | 50 { |
| 51 ASSERT(WTF::isMainThread()); | 51 ASSERT(WTF::isMainThread()); |
| 52 if (!gMemoryCache) | 52 if (!gMemoryCache) |
| 53 gMemoryCache = new OwnPtr<MemoryCache>(MemoryCache::create()); | 53 gMemoryCache = new OwnPtr<MemoryCache>(MemoryCache::create()); |
| 54 return gMemoryCache->get(); | 54 return gMemoryCache->get(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 PassOwnPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtr<MemoryCache> cac
he) | 57 PassOwnPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtr<MemoryCache> cac
he) |
| 58 { | 58 { |
| 59 #if ENABLE(OILPAN) | |
| 60 // Move m_liveResources content to keep Resource objects alive. | |
| 61 for (HeapHashSet<Member<Resource> >::iterator i = memoryCache()->m_liveResou
rces.begin(); | |
| 62 i != memoryCache()->m_liveResources.end(); | |
| 63 ++i) { | |
| 64 cache->m_liveResources.add(*i); | |
| 65 } | |
| 66 memoryCache()->m_liveResources.clear(); | |
| 67 #else | |
| 68 // Make sure we have non-empty gMemoryCache. | 59 // Make sure we have non-empty gMemoryCache. |
| 69 memoryCache(); | 60 memoryCache(); |
| 70 #endif | |
| 71 OwnPtr<MemoryCache> oldCache = gMemoryCache->release(); | 61 OwnPtr<MemoryCache> oldCache = gMemoryCache->release(); |
| 72 *gMemoryCache = cache; | 62 *gMemoryCache = cache; |
| 73 return oldCache.release(); | 63 return oldCache.release(); |
| 74 } | 64 } |
| 75 | 65 |
| 76 void MemoryCacheEntry::trace(Visitor* visitor) | 66 void MemoryCacheEntry::trace(Visitor* visitor) |
| 77 { | 67 { |
| 78 visitor->trace(m_previousInLiveResourcesList); | 68 visitor->trace(m_previousInLiveResourcesList); |
| 79 visitor->trace(m_nextInLiveResourcesList); | 69 visitor->trace(m_nextInLiveResourcesList); |
| 80 visitor->trace(m_previousInAllResourcesList); | 70 visitor->trace(m_previousInAllResourcesList); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 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 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()); |
| 757 | 747 |
| 758 current = prev; | 748 current = prev; |
| 759 } | 749 } |
| 760 } | 750 } |
| 761 } | 751 } |
| 762 | 752 |
| 763 #endif // MEMORY_CACHE_STATS | 753 #endif // MEMORY_CACHE_STATS |
| 764 | 754 |
| 765 } // namespace blink | 755 } // namespace blink |
| OLD | NEW |