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

Side by Side Diff: sky/engine/core/dom/StaticNodeList.h

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sky/engine/core/dom/SelectorQuery.cpp ('k') | sky/engine/core/dom/Text.cpp » ('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, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 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 #ifndef SKY_ENGINE_CORE_DOM_STATICNODELIST_H_ 29 #ifndef SKY_ENGINE_CORE_DOM_STATICNODELIST_H_
30 #define SKY_ENGINE_CORE_DOM_STATICNODELIST_H_ 30 #define SKY_ENGINE_CORE_DOM_STATICNODELIST_H_
31 31
32 #include "sky/engine/core/dom/NodeList.h" 32 #include "sky/engine/core/dom/NodeList.h"
33 #include "sky/engine/wtf/PassRefPtr.h" 33 #include "sky/engine/wtf/PassRefPtr.h"
34 #include "sky/engine/wtf/RefPtr.h" 34 #include "sky/engine/wtf/RefPtr.h"
35 #include "sky/engine/wtf/Vector.h" 35 #include "sky/engine/wtf/Vector.h"
36 #include "v8/include/v8.h"
37 36
38 namespace blink { 37 namespace blink {
39 38
40 class Element; 39 class Element;
41 class Node; 40 class Node;
42 41
43 template <typename NodeType> 42 template <typename NodeType>
44 class StaticNodeTypeList final : public NodeList { 43 class StaticNodeTypeList final : public NodeList {
45 public: 44 public:
46 static PassRefPtr<StaticNodeTypeList> adopt(Vector<RefPtr<NodeType> >& nodes ); 45 static PassRefPtr<StaticNodeTypeList> adopt(Vector<RefPtr<NodeType> >& nodes );
(...skipping 18 matching lines...) Expand all
65 }; 64 };
66 65
67 typedef StaticNodeTypeList<Node> StaticNodeList; 66 typedef StaticNodeTypeList<Node> StaticNodeList;
68 typedef StaticNodeTypeList<Element> StaticElementList; 67 typedef StaticNodeTypeList<Element> StaticElementList;
69 68
70 template <typename NodeType> 69 template <typename NodeType>
71 PassRefPtr<StaticNodeTypeList<NodeType> > StaticNodeTypeList<NodeType>::adopt(Ve ctor<RefPtr<NodeType> >& nodes) 70 PassRefPtr<StaticNodeTypeList<NodeType> > StaticNodeTypeList<NodeType>::adopt(Ve ctor<RefPtr<NodeType> >& nodes)
72 { 71 {
73 RefPtr<StaticNodeTypeList<NodeType> > nodeList = adoptRef(new StaticNodeType List<NodeType>); 72 RefPtr<StaticNodeTypeList<NodeType> > nodeList = adoptRef(new StaticNodeType List<NodeType>);
74 nodeList->m_nodes.swap(nodes); 73 nodeList->m_nodes.swap(nodes);
75 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeList->A llocationSize());
76 return nodeList.release(); 74 return nodeList.release();
77 } 75 }
78 76
79 template <typename NodeType> 77 template <typename NodeType>
80 StaticNodeTypeList<NodeType>::~StaticNodeTypeList() 78 StaticNodeTypeList<NodeType>::~StaticNodeTypeList()
81 { 79 {
82 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-Allocation Size());
83 } 80 }
84 81
85 template <typename NodeType> 82 template <typename NodeType>
86 unsigned StaticNodeTypeList<NodeType>::length() const 83 unsigned StaticNodeTypeList<NodeType>::length() const
87 { 84 {
88 return m_nodes.size(); 85 return m_nodes.size();
89 } 86 }
90 87
91 template <typename NodeType> 88 template <typename NodeType>
92 NodeType* StaticNodeTypeList<NodeType>::item(unsigned index) const 89 NodeType* StaticNodeTypeList<NodeType>::item(unsigned index) const
93 { 90 {
94 if (index < m_nodes.size()) 91 if (index < m_nodes.size())
95 return m_nodes[index].get(); 92 return m_nodes[index].get();
96 return 0; 93 return 0;
97 } 94 }
98 95
99 } // namespace blink 96 } // namespace blink
100 97
101 #endif // SKY_ENGINE_CORE_DOM_STATICNODELIST_H_ 98 #endif // SKY_ENGINE_CORE_DOM_STATICNODELIST_H_
OLDNEW
« no previous file with comments | « sky/engine/core/dom/SelectorQuery.cpp ('k') | sky/engine/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698