Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: Source/core/dom/StaticNodeList.cpp

Issue 311053004: Report precise memory usage from StaticNodeList to v8 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/StaticNodeList.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 19 matching lines...) Expand all
30 #include "core/dom/StaticNodeList.h" 30 #include "core/dom/StaticNodeList.h"
31 31
32 #include "core/dom/Element.h" 32 #include "core/dom/Element.h"
33 33
34 namespace WebCore { 34 namespace WebCore {
35 35
36 PassRefPtrWillBeRawPtr<StaticNodeList> StaticNodeList::adopt(WillBeHeapVector<Re fPtrWillBeMember<Node> >& nodes) 36 PassRefPtrWillBeRawPtr<StaticNodeList> StaticNodeList::adopt(WillBeHeapVector<Re fPtrWillBeMember<Node> >& nodes)
37 { 37 {
38 RefPtrWillBeRawPtr<StaticNodeList> nodeList = adoptRefWillBeNoop(new StaticN odeList); 38 RefPtrWillBeRawPtr<StaticNodeList> nodeList = adoptRefWillBeNoop(new StaticN odeList);
39 nodeList->m_nodes.swap(nodes); 39 nodeList->m_nodes.swap(nodes);
40 if (nodeList->AllocationSize() > externalMemoryReportSizeLimit) 40 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeList->A llocationSize());
41 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeLis t->AllocationSize());
42 return nodeList.release(); 41 return nodeList.release();
43 } 42 }
44 43
45 StaticNodeList::~StaticNodeList() 44 StaticNodeList::~StaticNodeList()
46 { 45 {
47 if (AllocationSize() > externalMemoryReportSizeLimit) 46 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-Allocation Size());
48 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-Alloca tionSize());
49 } 47 }
50 48
51 unsigned StaticNodeList::length() const 49 unsigned StaticNodeList::length() const
52 { 50 {
53 return m_nodes.size(); 51 return m_nodes.size();
54 } 52 }
55 53
56 Node* StaticNodeList::item(unsigned index) const 54 Node* StaticNodeList::item(unsigned index) const
57 { 55 {
58 if (index < m_nodes.size()) 56 if (index < m_nodes.size())
59 return m_nodes[index].get(); 57 return m_nodes[index].get();
60 return 0; 58 return 0;
61 } 59 }
62 60
63 void StaticNodeList::trace(Visitor* visitor) 61 void StaticNodeList::trace(Visitor* visitor)
64 { 62 {
65 visitor->trace(m_nodes); 63 visitor->trace(m_nodes);
66 NodeList::trace(visitor); 64 NodeList::trace(visitor);
67 } 65 }
68 66
69 } // namespace WebCore 67 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/StaticNodeList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698