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 17 matching lines...) Expand all Loading... |
28 #include "CrossThreadTask.h" | 28 #include "CrossThreadTask.h" |
29 #include "Document.h" | 29 #include "Document.h" |
30 #include "FrameLoader.h" | 30 #include "FrameLoader.h" |
31 #include "FrameLoaderTypes.h" | 31 #include "FrameLoaderTypes.h" |
32 #include "FrameView.h" | 32 #include "FrameView.h" |
33 #include "Image.h" | 33 #include "Image.h" |
34 #include "Logging.h" | 34 #include "Logging.h" |
35 #include "ResourceHandle.h" | 35 #include "ResourceHandle.h" |
36 #include "SecurityOrigin.h" | 36 #include "SecurityOrigin.h" |
37 #include "SecurityOriginHash.h" | 37 #include "SecurityOriginHash.h" |
38 #include "WebCoreMemoryInstrumentation.h" | |
39 #include "WorkerContext.h" | 38 #include "WorkerContext.h" |
40 #include "WorkerLoaderProxy.h" | 39 #include "WorkerLoaderProxy.h" |
41 #include "WorkerThread.h" | 40 #include "WorkerThread.h" |
42 #include <stdio.h> | 41 #include <stdio.h> |
43 #include <wtf/CurrentTime.h> | 42 #include <wtf/CurrentTime.h> |
44 #include <wtf/MathExtras.h> | 43 #include <wtf/MathExtras.h> |
45 #include <wtf/MemoryInstrumentationHashMap.h> | |
46 #include <wtf/MemoryInstrumentationVector.h> | |
47 #include <wtf/MemoryObjectInfo.h> | |
48 #include <wtf/TemporaryChange.h> | 44 #include <wtf/TemporaryChange.h> |
49 #include <wtf/text/CString.h> | 45 #include <wtf/text/CString.h> |
50 | 46 |
51 using namespace std; | 47 using namespace std; |
52 | 48 |
53 namespace WebCore { | 49 namespace WebCore { |
54 | 50 |
55 static const int cDefaultCacheCapacity = 8192 * 1024; | 51 static const int cDefaultCacheCapacity = 8192 * 1024; |
56 static const double cMinDelayBeforeLiveDecodedPrune = 1; // Seconds. | 52 static const double cMinDelayBeforeLiveDecodedPrune = 1; // Seconds. |
57 static const float cTargetPrunePercentage = .95f; // Percentage of capacity towa
rd which we prune, to avoid immediately pruning again. | 53 static const float cTargetPrunePercentage = .95f; // Percentage of capacity towa
rd which we prune, to avoid immediately pruning again. |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 case CachedResource::FontResource: | 685 case CachedResource::FontResource: |
690 stats.fonts.addResource(resource); | 686 stats.fonts.addResource(resource); |
691 break; | 687 break; |
692 default: | 688 default: |
693 break; | 689 break; |
694 } | 690 } |
695 } | 691 } |
696 return stats; | 692 return stats; |
697 } | 693 } |
698 | 694 |
699 void MemoryCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | |
700 { | |
701 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::MemoryCache
Structures); | |
702 memoryObjectInfo->setClassName("MemoryCache"); | |
703 info.addMember(m_resources, "resources"); | |
704 info.addMember(m_allResources, "allResources"); | |
705 info.addMember(m_liveDecodedResources, "liveDecodedResources"); | |
706 #if !ENABLE(CACHE_PARTITIONING) | |
707 for (CachedResourceMap::const_iterator i = m_resources.begin(); i != m_resou
rces.end(); ++i) | |
708 info.addMember(i->value, "cachedResourceItem", WTF::RetainingPointer); | |
709 #endif | |
710 } | |
711 | |
712 void MemoryCache::setDisabled(bool disabled) | 695 void MemoryCache::setDisabled(bool disabled) |
713 { | 696 { |
714 m_disabled = disabled; | 697 m_disabled = disabled; |
715 if (!m_disabled) | 698 if (!m_disabled) |
716 return; | 699 return; |
717 | 700 |
718 for (;;) { | 701 for (;;) { |
719 CachedResourceMap::iterator i = m_resources.begin(); | 702 CachedResourceMap::iterator i = m_resources.begin(); |
720 if (i == m_resources.end()) | 703 if (i == m_resources.end()) |
721 break; | 704 break; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 if (includeLive || !current->hasClients()) | 758 if (includeLive || !current->hasClients()) |
776 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()); | 759 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()); |
777 | 760 |
778 current = prev; | 761 current = prev; |
779 } | 762 } |
780 } | 763 } |
781 } | 764 } |
782 #endif | 765 #endif |
783 | 766 |
784 } // namespace WebCore | 767 } // namespace WebCore |
OLD | NEW |