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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 blink::Platform::current()->currentThread()->removeTaskObserver(this); | 114 blink::Platform::current()->currentThread()->removeTaskObserver(this); |
115 } | 115 } |
116 | 116 |
117 void MemoryCache::trace(Visitor* visitor) | 117 void MemoryCache::trace(Visitor* visitor) |
118 { | 118 { |
119 #if ENABLE(OILPAN) | 119 #if ENABLE(OILPAN) |
120 visitor->trace(m_allResources); | 120 visitor->trace(m_allResources); |
121 for (size_t i = 0; i < WTF_ARRAY_LENGTH(m_liveDecodedResources); ++i) | 121 for (size_t i = 0; i < WTF_ARRAY_LENGTH(m_liveDecodedResources); ++i) |
122 visitor->trace(m_liveDecodedResources[i]); | 122 visitor->trace(m_liveDecodedResources[i]); |
123 visitor->trace(m_resources); | 123 visitor->trace(m_resources); |
| 124 visitor->trace(m_liveResources); |
124 #endif | 125 #endif |
125 } | 126 } |
126 | 127 |
127 KURL MemoryCache::removeFragmentIdentifierIfNeeded(const KURL& originalURL) | 128 KURL MemoryCache::removeFragmentIdentifierIfNeeded(const KURL& originalURL) |
128 { | 129 { |
129 if (!originalURL.hasFragmentIdentifier()) | 130 if (!originalURL.hasFragmentIdentifier()) |
130 return originalURL; | 131 return originalURL; |
131 // Strip away fragment identifier from HTTP URLs. | 132 // Strip away fragment identifier from HTTP URLs. |
132 // Data URLs must be unmodified. For file and custom URLs clients may expect
resources | 133 // Data URLs must be unmodified. For file and custom URLs clients may expect
resources |
133 // to be unique even when they differ by the fragment identifier only. | 134 // to be unique even when they differ by the fragment identifier only. |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 blink::Platform::current()->currentThread()->removeTaskObserver(this); | 710 blink::Platform::current()->currentThread()->removeTaskObserver(this); |
710 } | 711 } |
711 | 712 |
712 TemporaryChange<bool> reentrancyProtector(m_inPruneResources, true); | 713 TemporaryChange<bool> reentrancyProtector(m_inPruneResources, true); |
713 pruneDeadResources(); // Prune dead first, in case it was "borrowing" capaci
ty from live. | 714 pruneDeadResources(); // Prune dead first, in case it was "borrowing" capaci
ty from live. |
714 pruneLiveResources(); | 715 pruneLiveResources(); |
715 m_pruneFrameTimeStamp = FrameView::currentFrameTimeStamp(); | 716 m_pruneFrameTimeStamp = FrameView::currentFrameTimeStamp(); |
716 m_pruneTimeStamp = currentTime; | 717 m_pruneTimeStamp = currentTime; |
717 } | 718 } |
718 | 719 |
| 720 #if ENABLE(OILPAN) |
| 721 void MemoryCache::registerLiveResource(Resource& resource) |
| 722 { |
| 723 ASSERT(!m_liveResources.contains(&resource)); |
| 724 m_liveResources.add(&resource); |
| 725 } |
| 726 |
| 727 void MemoryCache::unregisterLiveResource(Resource& resource) |
| 728 { |
| 729 ASSERT(m_liveResources.contains(&resource)); |
| 730 m_liveResources.remove(&resource); |
| 731 } |
| 732 |
| 733 #else |
| 734 |
| 735 void MemoryCache::registerLiveResource(Resource&) |
| 736 { |
| 737 } |
| 738 |
| 739 void MemoryCache::unregisterLiveResource(Resource&) |
| 740 { |
| 741 } |
| 742 #endif |
| 743 |
719 #ifdef MEMORY_CACHE_STATS | 744 #ifdef MEMORY_CACHE_STATS |
720 | 745 |
721 void MemoryCache::dumpStats(Timer<MemoryCache>*) | 746 void MemoryCache::dumpStats(Timer<MemoryCache>*) |
722 { | 747 { |
723 Statistics s = getStatistics(); | 748 Statistics s = getStatistics(); |
724 printf("%-13s %-13s %-13s %-13s %-13s %-13s %-13s\n", "", "Count", "Size", "
LiveSize", "DecodedSize", "PurgeableSize", "PurgedSize"); | 749 printf("%-13s %-13s %-13s %-13s %-13s %-13s %-13s\n", "", "Count", "Size", "
LiveSize", "DecodedSize", "PurgeableSize", "PurgedSize"); |
725 printf("%-13s %-13s %-13s %-13s %-13s %-13s %-13s\n", "-------------", "----
---------", "-------------", "-------------", "-------------", "-------------",
"-------------"); | 750 printf("%-13s %-13s %-13s %-13s %-13s %-13s %-13s\n", "-------------", "----
---------", "-------------", "-------------", "-------------", "-------------",
"-------------"); |
726 printf("%-13s %13d %13d %13d %13d %13d %13d\n", "Images", s.images.count, s.
images.size, s.images.liveSize, s.images.decodedSize, s.images.purgeableSize, s.
images.purgedSize); | 751 printf("%-13s %13d %13d %13d %13d %13d %13d\n", "Images", s.images.count, s.
images.size, s.images.liveSize, s.images.decodedSize, s.images.purgeableSize, s.
images.purgedSize); |
727 printf("%-13s %13d %13d %13d %13d %13d %13d\n", "CSS", s.cssStyleSheets.coun
t, s.cssStyleSheets.size, s.cssStyleSheets.liveSize, s.cssStyleSheets.decodedSiz
e, s.cssStyleSheets.purgeableSize, s.cssStyleSheets.purgedSize); | 752 printf("%-13s %13d %13d %13d %13d %13d %13d\n", "CSS", s.cssStyleSheets.coun
t, s.cssStyleSheets.size, s.cssStyleSheets.liveSize, s.cssStyleSheets.decodedSiz
e, s.cssStyleSheets.purgeableSize, s.cssStyleSheets.purgedSize); |
728 printf("%-13s %13d %13d %13d %13d %13d %13d\n", "XSL", s.xslStyleSheets.coun
t, s.xslStyleSheets.size, s.xslStyleSheets.liveSize, s.xslStyleSheets.decodedSiz
e, s.xslStyleSheets.purgeableSize, s.xslStyleSheets.purgedSize); | 753 printf("%-13s %13d %13d %13d %13d %13d %13d\n", "XSL", s.xslStyleSheets.coun
t, s.xslStyleSheets.size, s.xslStyleSheets.liveSize, s.xslStyleSheets.decodedSiz
e, s.xslStyleSheets.purgeableSize, s.xslStyleSheets.purgedSize); |
(...skipping 25 matching lines...) Expand all Loading... |
754 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()); | 779 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()); |
755 | 780 |
756 current = prev; | 781 current = prev; |
757 } | 782 } |
758 } | 783 } |
759 } | 784 } |
760 | 785 |
761 #endif // MEMORY_CACHE_STATS | 786 #endif // MEMORY_CACHE_STATS |
762 | 787 |
763 } // namespace blink | 788 } // namespace blink |
OLD | NEW |