OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 21 matching lines...) Expand all Loading... |
32 #define TreeNode_h | 32 #define TreeNode_h |
33 | 33 |
34 #include "wtf/Assertions.h" | 34 #include "wtf/Assertions.h" |
35 | 35 |
36 namespace WTF { | 36 namespace WTF { |
37 | 37 |
38 // | 38 // |
39 // TreeNode is generic, ContainerNode-like linked tree data structure. | 39 // TreeNode is generic, ContainerNode-like linked tree data structure. |
40 // There are a few notable difference between TreeNode and Node: | 40 // There are a few notable difference between TreeNode and Node: |
41 // | 41 // |
42 // * Each TreeNode node is NOT ref counted. The user have to retain its lifetim
e somehow. | 42 // * Each TreeNode node is NOT ref counted. The user have to retain its |
43 // FIXME: lifetime management could be parameterized so that ref counted impl
ementations can be used. | 43 // lifetime somehow. |
44 // * It ASSERT()s invalid input. The callers have to ensure that given paramete
r is sound. | 44 // FIXME: lifetime management could be parameterized so that ref counted |
45 // * There is no branch-leaf difference. Every node can be a parent of other no
de. | 45 // implementations can be used. |
| 46 // * It ASSERT()s invalid input. The callers have to ensure that given |
| 47 // parameter is sound. |
| 48 // * There is no branch-leaf difference. Every node can be a parent of other |
| 49 // node. |
46 // | 50 // |
47 // FIXME: oilpan: Trace tree node edges to ensure we don't have dangling pointer
s. | 51 // FIXME: oilpan: Trace tree node edges to ensure we don't have dangling |
| 52 // pointers. |
48 // As it is used in HTMLImport it is safe since they all die together. | 53 // As it is used in HTMLImport it is safe since they all die together. |
49 template <class T> | 54 template <class T> |
50 class TreeNode { | 55 class TreeNode { |
51 public: | 56 public: |
52 typedef T NodeType; | 57 typedef T NodeType; |
53 | 58 |
54 TreeNode() | 59 TreeNode() |
55 : m_next(0), | 60 : m_next(0), |
56 m_previous(0), | 61 m_previous(0), |
57 m_parent(0), | 62 m_parent(0), |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return next; | 203 return next; |
199 } | 204 } |
200 | 205 |
201 } // namespace WTF | 206 } // namespace WTF |
202 | 207 |
203 using WTF::TreeNode; | 208 using WTF::TreeNode; |
204 using WTF::traverseNext; | 209 using WTF::traverseNext; |
205 using WTF::traverseNextPostOrder; | 210 using WTF::traverseNextPostOrder; |
206 | 211 |
207 #endif | 212 #endif |
OLD | NEW |