| 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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "core/fetch/ResourceClientWalker.h" | 32 #include "core/fetch/ResourceClientWalker.h" |
| 33 #include "core/fetch/ResourceFetcher.h" | 33 #include "core/fetch/ResourceFetcher.h" |
| 34 #include "core/fetch/ResourceLoader.h" | 34 #include "core/fetch/ResourceLoader.h" |
| 35 #include "core/fetch/ResourcePtr.h" | 35 #include "core/fetch/ResourcePtr.h" |
| 36 #include "core/inspector/InspectorInstrumentation.h" | 36 #include "core/inspector/InspectorInstrumentation.h" |
| 37 #include "platform/Logging.h" | 37 #include "platform/Logging.h" |
| 38 #include "platform/SharedBuffer.h" | 38 #include "platform/SharedBuffer.h" |
| 39 #include "platform/TraceEvent.h" | 39 #include "platform/TraceEvent.h" |
| 40 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 41 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebProcessMemoryDump.h" |
| 42 #include "wtf/CurrentTime.h" | 43 #include "wtf/CurrentTime.h" |
| 43 #include "wtf/MathExtras.h" | 44 #include "wtf/MathExtras.h" |
| 44 #include "wtf/StdLibExtras.h" | 45 #include "wtf/StdLibExtras.h" |
| 45 #include "wtf/Vector.h" | 46 #include "wtf/Vector.h" |
| 46 #include "wtf/text/CString.h" | 47 #include "wtf/text/CString.h" |
| 47 | 48 |
| 48 using namespace WTF; | 49 using namespace WTF; |
| 49 | 50 |
| 50 namespace blink { | 51 namespace blink { |
| 51 | 52 |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 // Prevent the case when there are clients waiting but no callback scheduled
. | 711 // Prevent the case when there are clients waiting but no callback scheduled
. |
| 711 ASSERT(m_clientsAwaitingCallback.isEmpty() || scheduled); | 712 ASSERT(m_clientsAwaitingCallback.isEmpty() || scheduled); |
| 712 } | 713 } |
| 713 | 714 |
| 714 void Resource::prune() | 715 void Resource::prune() |
| 715 { | 716 { |
| 716 destroyDecodedDataIfPossible(); | 717 destroyDecodedDataIfPossible(); |
| 717 unlock(); | 718 unlock(); |
| 718 } | 719 } |
| 719 | 720 |
| 721 void Resource::onMemoryDump(WebProcessMemoryDump* memoryDump) const |
| 722 { |
| 723 const String dumpName = getMemoryDumpName(); |
| 724 WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(dumpNam
e); |
| 725 dump->AddScalar("encoded_size", "bytes", m_encodedSize); |
| 726 if (canDelete()) { |
| 727 dump->AddScalar("dead_size", "bytes", m_encodedSize); |
| 728 } else { |
| 729 dump->AddScalar("live_size", "bytes", m_encodedSize); |
| 730 } |
| 731 |
| 732 if (m_data) { |
| 733 dump->AddScalar("purgeable_size", "bytes", isPurgeable() && !wasPurged()
? encodedSize() + overheadSize() : 0); |
| 734 m_data->onMemoryDump(dumpName, memoryDump); |
| 735 } |
| 736 |
| 737 const String overheadName = dumpName + "/metadata"; |
| 738 WebMemoryAllocatorDump* overheadDump = memoryDump->createMemoryAllocatorDump
(overheadName); |
| 739 overheadDump->AddScalar("size", "bytes", overheadSize()); |
| 740 memoryDump->AddSuballocation(overheadDump->guid(), String(WTF::Partitions::k
AllocatedObjectPoolName)); |
| 741 } |
| 742 |
| 743 String Resource::getMemoryDumpName() const |
| 744 { |
| 745 return String::format("web_cache/%s_resources/%ld", resourceTypeToString(typ
e(), options().initiatorInfo), m_identifier); |
| 746 } |
| 747 |
| 720 void Resource::setResourceToRevalidate(Resource* resource) | 748 void Resource::setResourceToRevalidate(Resource* resource) |
| 721 { | 749 { |
| 722 ASSERT(resource); | 750 ASSERT(resource); |
| 723 ASSERT(!m_resourceToRevalidate); | 751 ASSERT(!m_resourceToRevalidate); |
| 724 ASSERT(resource != this); | 752 ASSERT(resource != this); |
| 725 ASSERT(m_handlesToRevalidate.isEmpty()); | 753 ASSERT(m_handlesToRevalidate.isEmpty()); |
| 726 ASSERT(resource->type() == type()); | 754 ASSERT(resource->type() == type()); |
| 727 | 755 |
| 728 WTF_LOG(ResourceLoading, "Resource %p setResourceToRevalidate %p", this, res
ource); | 756 WTF_LOG(ResourceLoading, "Resource %p setResourceToRevalidate %p", this, res
ource); |
| 729 | 757 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 return "ImportResource"; | 1136 return "ImportResource"; |
| 1109 case Resource::Media: | 1137 case Resource::Media: |
| 1110 return "Media"; | 1138 return "Media"; |
| 1111 } | 1139 } |
| 1112 ASSERT_NOT_REACHED(); | 1140 ASSERT_NOT_REACHED(); |
| 1113 return "Unknown"; | 1141 return "Unknown"; |
| 1114 } | 1142 } |
| 1115 #endif // !LOG_DISABLED | 1143 #endif // !LOG_DISABLED |
| 1116 | 1144 |
| 1117 } // namespace blink | 1145 } // namespace blink |
| OLD | NEW |