OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 if (cachedNode()) | 55 if (cachedNode()) |
56 return !cachedNodeIndex() && !nodeAt(collection, 1); | 56 return !cachedNodeIndex() && !nodeAt(collection, 1); |
57 return nodeAt(collection, 0) && !nodeAt(collection, 1); | 57 return nodeAt(collection, 0) && !nodeAt(collection, 1); |
58 } | 58 } |
59 | 59 |
60 unsigned nodeCount(const Collection&); | 60 unsigned nodeCount(const Collection&); |
61 NodeType* nodeAt(const Collection&, unsigned index); | 61 NodeType* nodeAt(const Collection&, unsigned index); |
62 | 62 |
63 void invalidate(); | 63 void invalidate(); |
64 | 64 |
65 void trace(Visitor* visitor) | 65 DEFINE_INLINE_TRACE() |
66 { | 66 { |
67 visitor->trace(m_currentNode); | 67 visitor->trace(m_currentNode); |
68 } | 68 } |
69 | 69 |
70 protected: | 70 protected: |
71 ALWAYS_INLINE NodeType* cachedNode() const { return m_currentNode; } | 71 ALWAYS_INLINE NodeType* cachedNode() const { return m_currentNode; } |
72 ALWAYS_INLINE unsigned cachedNodeIndex() const { ASSERT(cachedNode()); retur
n m_cachedNodeIndex; } | 72 ALWAYS_INLINE unsigned cachedNodeIndex() const { ASSERT(cachedNode()); retur
n m_cachedNodeIndex; } |
73 ALWAYS_INLINE void setCachedNode(NodeType* node, unsigned index) | 73 ALWAYS_INLINE void setCachedNode(NodeType* node, unsigned index) |
74 { | 74 { |
75 ASSERT(node); | 75 ASSERT(node); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 setCachedNodeCount(currentIndex + 1); | 198 setCachedNodeCount(currentIndex + 1); |
199 return nullptr; | 199 return nullptr; |
200 } | 200 } |
201 setCachedNode(currentNode, currentIndex); | 201 setCachedNode(currentNode, currentIndex); |
202 return currentNode; | 202 return currentNode; |
203 } | 203 } |
204 | 204 |
205 } // namespace blink | 205 } // namespace blink |
206 | 206 |
207 #endif // CollectionIndexCache_h | 207 #endif // CollectionIndexCache_h |
OLD | NEW |