| OLD | NEW |
| 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 Loading... |
| 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) |
| 37 { |
| 38 RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList); |
| 39 nodeList->m_nodes.swap(nodes); |
| 40 if (nodeList->AllocationSize() > externalMemoryReportSizeLimit) |
| 41 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeLis
t->AllocationSize()); |
| 42 return nodeList.release(); |
| 43 } |
| 44 |
| 45 StaticNodeList::~StaticNodeList() |
| 46 { |
| 47 if (AllocationSize() > externalMemoryReportSizeLimit) |
| 48 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-Alloca
tionSize()); |
| 49 } |
| 50 |
| 36 unsigned StaticNodeList::length() const | 51 unsigned StaticNodeList::length() const |
| 37 { | 52 { |
| 38 return m_nodes.size(); | 53 return m_nodes.size(); |
| 39 } | 54 } |
| 40 | 55 |
| 41 Node* StaticNodeList::item(unsigned index) const | 56 Node* StaticNodeList::item(unsigned index) const |
| 42 { | 57 { |
| 43 if (index < m_nodes.size()) | 58 if (index < m_nodes.size()) |
| 44 return m_nodes[index].get(); | 59 return m_nodes[index].get(); |
| 45 return 0; | 60 return 0; |
| 46 } | 61 } |
| 47 | 62 |
| 48 } // namespace WebCore | 63 } // namespace WebCore |
| OLD | NEW |