| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ALWAYS_INLINE void setCachedNodeCount(unsigned length) | 82 ALWAYS_INLINE void setCachedNodeCount(unsigned length) |
| 83 { | 83 { |
| 84 m_cachedNodeCount = length; | 84 m_cachedNodeCount = length; |
| 85 m_isLengthCacheValid = true; | 85 m_isLengthCacheValid = true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 NodeType* nodeBeforeCachedNode(const Collection&, unsigned index); | 89 NodeType* nodeBeforeCachedNode(const Collection&, unsigned index); |
| 90 NodeType* nodeAfterCachedNode(const Collection&, unsigned index); | 90 NodeType* nodeAfterCachedNode(const Collection&, unsigned index); |
| 91 | 91 |
| 92 RawPtrWillBeMember<NodeType> m_currentNode; | 92 Member<NodeType> m_currentNode; |
| 93 unsigned m_cachedNodeCount; | 93 unsigned m_cachedNodeCount; |
| 94 unsigned m_cachedNodeIndex : 31; | 94 unsigned m_cachedNodeIndex : 31; |
| 95 unsigned m_isLengthCacheValid : 1; | 95 unsigned m_isLengthCacheValid : 1; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 template <typename Collection, typename NodeType> | 98 template <typename Collection, typename NodeType> |
| 99 CollectionIndexCache<Collection, NodeType>::CollectionIndexCache() | 99 CollectionIndexCache<Collection, NodeType>::CollectionIndexCache() |
| 100 : m_currentNode(nullptr) | 100 : m_currentNode(nullptr) |
| 101 , m_cachedNodeCount(0) | 101 , m_cachedNodeCount(0) |
| 102 , m_cachedNodeIndex(0) | 102 , m_cachedNodeIndex(0) |
| (...skipping 95 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 |