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

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

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have NodeRareData clear out NodeListsNodeData instead. Created 6 years, 7 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
« no previous file with comments | « Source/core/dom/StaticNodeList.h ('k') | Source/core/dom/TagCollection.h » ('j') | 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 15 matching lines...) Expand all
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
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 PassRefPtr<StaticNodeList> StaticNodeList::adopt(Vector<RefPtr<Node> >& nodes) 36 PassRefPtrWillBeRawPtr<StaticNodeList> StaticNodeList::adopt(Vector<RefPtr<Node> >& nodes)
37 { 37 {
38 RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList); 38 RefPtrWillBeRawPtr<StaticNodeList> nodeList = adoptRefWillBeNoop(new StaticN odeList);
39 #if ENABLE(OILPAN)
40 // FIXME: Oilpan: switch to a WillBeHeapVector<RefPtrWillBeMember<>> argumen t.
41 for (size_t i = 0; i < nodes.size(); ++i)
42 nodeList->m_nodes.append(nodes[i]);
43 nodes.clear();
44 #else
39 nodeList->m_nodes.swap(nodes); 45 nodeList->m_nodes.swap(nodes);
46 #endif
40 if (nodeList->AllocationSize() > externalMemoryReportSizeLimit) 47 if (nodeList->AllocationSize() > externalMemoryReportSizeLimit)
41 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeLis t->AllocationSize()); 48 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeLis t->AllocationSize());
42 return nodeList.release(); 49 return nodeList.release();
43 } 50 }
44 51
45 StaticNodeList::~StaticNodeList() 52 StaticNodeList::~StaticNodeList()
46 { 53 {
47 if (AllocationSize() > externalMemoryReportSizeLimit) 54 if (AllocationSize() > externalMemoryReportSizeLimit)
48 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-Alloca tionSize()); 55 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-Alloca tionSize());
49 } 56 }
50 57
51 unsigned StaticNodeList::length() const 58 unsigned StaticNodeList::length() const
52 { 59 {
53 return m_nodes.size(); 60 return m_nodes.size();
54 } 61 }
55 62
56 Node* StaticNodeList::item(unsigned index) const 63 Node* StaticNodeList::item(unsigned index) const
57 { 64 {
58 if (index < m_nodes.size()) 65 if (index < m_nodes.size())
59 return m_nodes[index].get(); 66 return m_nodes[index].get();
60 return 0; 67 return 0;
61 } 68 }
62 69
70 void StaticNodeList::trace(Visitor* visitor)
71 {
72 visitor->trace(m_nodes);
73 NodeList::trace(visitor);
74 }
75
63 } // namespace WebCore 76 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/StaticNodeList.h ('k') | Source/core/dom/TagCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698