| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012,2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2012,2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2014 Apple Inc. 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 visitor->trace(m_cachedList); | 52 visitor->trace(m_cachedList); |
| 53 Base::trace(visitor); | 53 Base::trace(visitor); |
| 54 } | 54 } |
| 55 | 55 |
| 56 unsigned nodeCount(const Collection&); | 56 unsigned nodeCount(const Collection&); |
| 57 NodeType* nodeAt(const Collection&, unsigned index); | 57 NodeType* nodeAt(const Collection&, unsigned index); |
| 58 void invalidate(); | 58 void invalidate(); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 bool m_listValid; | 61 bool m_listValid; |
| 62 WillBeHeapVector<RawPtrWillBeMember<NodeType>> m_cachedList; | 62 HeapVector<Member<NodeType>> m_cachedList; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 template <typename Collection, typename NodeType> | 65 template <typename Collection, typename NodeType> |
| 66 CollectionItemsCache<Collection, NodeType>::CollectionItemsCache() | 66 CollectionItemsCache<Collection, NodeType>::CollectionItemsCache() |
| 67 : m_listValid(false) | 67 : m_listValid(false) |
| 68 { | 68 { |
| 69 } | 69 } |
| 70 | 70 |
| 71 template <typename Collection, typename NodeType> | 71 template <typename Collection, typename NodeType> |
| 72 CollectionItemsCache<Collection, NodeType>::~CollectionItemsCache() | 72 CollectionItemsCache<Collection, NodeType>::~CollectionItemsCache() |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (m_listValid) { | 107 if (m_listValid) { |
| 108 ASSERT(this->isCachedNodeCountValid()); | 108 ASSERT(this->isCachedNodeCountValid()); |
| 109 return index < this->cachedNodeCount() ? m_cachedList[index] : nullptr; | 109 return index < this->cachedNodeCount() ? m_cachedList[index] : nullptr; |
| 110 } | 110 } |
| 111 return Base::nodeAt(collection, index); | 111 return Base::nodeAt(collection, index); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace blink | 114 } // namespace blink |
| 115 | 115 |
| 116 #endif // CollectionItemsCache_h | 116 #endif // CollectionItemsCache_h |
| OLD | NEW |