| 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 18 matching lines...) Expand all Loading... |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef CollectionIndexCache_h | 32 #ifndef CollectionIndexCache_h |
| 33 #define CollectionIndexCache_h | 33 #define CollectionIndexCache_h |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 template <typename Collection, typename NodeType> | 37 template <typename Collection, typename NodeType> |
| 38 class CollectionIndexCache { | 38 class CollectionIndexCache { |
| 39 DISALLOW_ALLOCATION(); | 39 DISALLOW_NEW(); |
| 40 public: | 40 public: |
| 41 CollectionIndexCache(); | 41 CollectionIndexCache(); |
| 42 | 42 |
| 43 bool isEmpty(const Collection& collection) | 43 bool isEmpty(const Collection& collection) |
| 44 { | 44 { |
| 45 if (isCachedNodeCountValid()) | 45 if (isCachedNodeCountValid()) |
| 46 return !cachedNodeCount(); | 46 return !cachedNodeCount(); |
| 47 if (cachedNode()) | 47 if (cachedNode()) |
| 48 return false; | 48 return false; |
| 49 return !nodeAt(collection, 0); | 49 return !nodeAt(collection, 0); |
| (...skipping 148 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 |