OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "core/inspector/BindingVisitors.h" | 39 #include "core/inspector/BindingVisitors.h" |
40 #include "core/inspector/HeapGraphSerializer.h" | 40 #include "core/inspector/HeapGraphSerializer.h" |
41 #include "core/inspector/InspectorClient.h" | 41 #include "core/inspector/InspectorClient.h" |
42 #include "core/inspector/InspectorDOMStorageAgent.h" | 42 #include "core/inspector/InspectorDOMStorageAgent.h" |
43 #include "core/inspector/InspectorValues.h" | 43 #include "core/inspector/InspectorValues.h" |
44 #include "core/inspector/MemoryInstrumentationImpl.h" | 44 #include "core/inspector/MemoryInstrumentationImpl.h" |
45 #include "core/loader/cache/MemoryCache.h" | 45 #include "core/loader/cache/MemoryCache.h" |
46 #include "core/page/Frame.h" | 46 #include "core/page/Frame.h" |
47 #include "core/page/Page.h" | 47 #include "core/page/Page.h" |
48 #include "core/platform/MemoryUsageSupport.h" | 48 #include "core/platform/MemoryUsageSupport.h" |
| 49 #include "core/platform/Partitions.h" |
49 #include <wtf/ArrayBufferView.h> | 50 #include <wtf/ArrayBufferView.h> |
50 #include <wtf/HashSet.h> | 51 #include <wtf/HashSet.h> |
51 #include <wtf/MemoryInstrumentationArrayBufferView.h> | 52 #include <wtf/MemoryInstrumentationArrayBufferView.h> |
52 #include <wtf/NonCopyingSort.h> | 53 #include <wtf/NonCopyingSort.h> |
53 #include <wtf/OwnPtr.h> | 54 #include <wtf/OwnPtr.h> |
54 #include <wtf/PassOwnPtr.h> | 55 #include <wtf/PassOwnPtr.h> |
55 #include <wtf/text/StringBuilder.h> | 56 #include <wtf/text/StringBuilder.h> |
56 #include <wtf/text/StringImpl.h> | 57 #include <wtf/text/StringImpl.h> |
57 #include <wtf/text/WTFString.h> | 58 #include <wtf/text/WTFString.h> |
58 #include <wtf/Vector.h> | 59 #include <wtf/Vector.h> |
59 | 60 |
60 // Use a type alias instead of 'using' here which would cause a conflict on Mac. | 61 // Use a type alias instead of 'using' here which would cause a conflict on Mac. |
61 typedef WebCore::TypeBuilder::Memory::MemoryBlock InspectorMemoryBlock; | 62 typedef WebCore::TypeBuilder::Memory::MemoryBlock InspectorMemoryBlock; |
62 typedef WebCore::TypeBuilder::Array<InspectorMemoryBlock> InspectorMemoryBlocks; | 63 typedef WebCore::TypeBuilder::Array<InspectorMemoryBlock> InspectorMemoryBlocks; |
63 | 64 |
64 namespace WebCore { | 65 namespace WebCore { |
65 | 66 |
66 namespace { | 67 namespace { |
67 | 68 |
68 class MemoryUsageStatsGenerator { | 69 class MemoryUsageStatsGenerator { |
69 public: | 70 public: |
70 MemoryUsageStatsGenerator() { } | 71 MemoryUsageStatsGenerator() { } |
71 | 72 |
72 void dump(const TypeNameToSizeMap& sizesMap, InspectorMemoryBlocks* children
) | 73 void dump(const TypeNameToSizeMap& sizesMap, InspectorMemoryBlocks* children
) |
73 { | 74 { |
74 m_sizesMap = sizesMap; | 75 m_sizesMap = sizesMap; |
75 | 76 |
76 // FIXME: We filter out Rendering type because the coverage is not good
enough at the moment | 77 // FIXME: We filter out Rendering type because the coverage is not good
enough at the moment |
77 // and report RenderArena size instead. | 78 // and report rendering partition size instead. |
78 for (TypeNameToSizeMap::iterator i = m_sizesMap.begin(); i != m_sizesMap
.end(); ++i) { | 79 for (TypeNameToSizeMap::iterator i = m_sizesMap.begin(); i != m_sizesMap
.end(); ++i) { |
79 if (i->key == PlatformMemoryTypes::Rendering) { | 80 if (i->key == PlatformMemoryTypes::Rendering) { |
80 m_sizesMap.remove(i); | 81 m_sizesMap.remove(i); |
81 break; | 82 break; |
82 } | 83 } |
83 } | 84 } |
84 Vector<String> objectTypes; | 85 Vector<String> objectTypes; |
85 objectTypes.appendRange(m_sizesMap.keys().begin(), m_sizesMap.keys().end
()); | 86 objectTypes.appendRange(m_sizesMap.keys().begin(), m_sizesMap.keys().end
()); |
86 | 87 |
87 for (Vector<String>::const_iterator i = objectTypes.begin(); i != object
Types.end(); ++i) | 88 for (Vector<String>::const_iterator i = objectTypes.begin(); i != object
Types.end(); ++i) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 195 |
195 static void reportJSHeapInfo(WTF::MemoryInstrumentationClient& memoryInstrumenta
tionClient) | 196 static void reportJSHeapInfo(WTF::MemoryInstrumentationClient& memoryInstrumenta
tionClient) |
196 { | 197 { |
197 HeapInfo info; | 198 HeapInfo info; |
198 ScriptGCEvent::getHeapSize(info); | 199 ScriptGCEvent::getHeapSize(info); |
199 | 200 |
200 memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::JSHeapUse
d, info.usedJSHeapSize); | 201 memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::JSHeapUse
d, info.usedJSHeapSize); |
201 memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::JSHeapUnu
sed, info.totalJSHeapSize - info.usedJSHeapSize); | 202 memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::JSHeapUnu
sed, info.totalJSHeapSize - info.usedJSHeapSize); |
202 } | 203 } |
203 | 204 |
204 static void reportRenderTreeInfo(WTF::MemoryInstrumentationClient& memoryInstrum
entationClient, Page* page) | 205 static void reportRenderTreeInfo(WTF::MemoryInstrumentationClient& memoryInstrum
entationClient, Page*) |
205 { | 206 { |
206 ArenaSize arenaSize = page->renderTreeSize(); | 207 size_t renderTreeSize = 0; |
| 208 #if ENABLE(PARTITION_ALLOC) |
| 209 renderTreeSize = partitionAllocGetUsedPagesSize(*Partitions::getRenderingPar
tition()); |
| 210 #endif |
207 | 211 |
208 memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::RenderTre
eUsed, arenaSize.treeSize); | 212 memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::RenderTre
eUsed, renderTreeSize); |
209 memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::RenderTre
eUnused, arenaSize.allocated - arenaSize.treeSize); | |
210 } | 213 } |
211 | 214 |
212 namespace { | 215 namespace { |
213 | 216 |
214 class DOMTreesIterator : public WrappedNodeVisitor { | 217 class DOMTreesIterator : public WrappedNodeVisitor { |
215 public: | 218 public: |
216 DOMTreesIterator(MemoryInstrumentationImpl& memoryInstrumentation, Page* pag
e) | 219 DOMTreesIterator(MemoryInstrumentationImpl& memoryInstrumentation, Page* pag
e) |
217 : m_page(page) | 220 : m_page(page) |
218 , m_memoryInstrumentation(memoryInstrumentation) | 221 , m_memoryInstrumentation(memoryInstrumentation) |
219 { | 222 { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 m_frontend = frontend->memory(); | 395 m_frontend = frontend->memory(); |
393 } | 396 } |
394 | 397 |
395 void InspectorMemoryAgent::clearFrontend() | 398 void InspectorMemoryAgent::clearFrontend() |
396 { | 399 { |
397 m_frontend = 0; | 400 m_frontend = 0; |
398 } | 401 } |
399 | 402 |
400 } // namespace WebCore | 403 } // namespace WebCore |
401 | 404 |
OLD | NEW |