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 6092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6103 | 6103 |
6104 namespace blink { | 6104 namespace blink { |
6105 | 6105 |
6106 TEST(HeapTest, DequePartObjectsExpand) | 6106 TEST(HeapTest, DequePartObjectsExpand) |
6107 { | 6107 { |
6108 // Test expansion of HeapDeque<PartObject> | 6108 // Test expansion of HeapDeque<PartObject> |
6109 | 6109 |
6110 using PartDeque = HeapDeque<PartObjectWithRef>; | 6110 using PartDeque = HeapDeque<PartObjectWithRef>; |
6111 | 6111 |
6112 Persistent<PartDeque> deque = new PartDeque(); | 6112 Persistent<PartDeque> deque = new PartDeque(); |
6113 // Auxillary Deque used to prevent 'inline' buffer expansion. | 6113 // Auxiliary Deque used to prevent 'inline' buffer expansion. |
6114 Persistent<PartDeque> dequeUnused = new PartDeque(); | 6114 Persistent<PartDeque> dequeUnused = new PartDeque(); |
6115 | 6115 |
6116 // Append a sequence, bringing about repeated expansions of the | 6116 // Append a sequence, bringing about repeated expansions of the |
6117 // deque's buffer. | 6117 // deque's buffer. |
6118 int i = 0; | 6118 int i = 0; |
6119 for (; i < 60; ++i) { | 6119 for (; i < 60; ++i) { |
6120 deque->append(PartObjectWithRef(i)); | 6120 deque->append(PartObjectWithRef(i)); |
6121 dequeUnused->append(PartObjectWithRef(i)); | 6121 dequeUnused->append(PartObjectWithRef(i)); |
6122 } | 6122 } |
6123 | 6123 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6449 EXPECT_EQ(1u, vector2.size()); | 6449 EXPECT_EQ(1u, vector2.size()); |
6450 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables | 6450 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
6451 // Vector<>s with inline capacity, remove. | 6451 // Vector<>s with inline capacity, remove. |
6452 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) | 6452 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
6453 EXPECT_EQ(16u, vector1.capacity()); | 6453 EXPECT_EQ(16u, vector1.capacity()); |
6454 EXPECT_EQ(16u, vector2.capacity()); | 6454 EXPECT_EQ(16u, vector2.capacity()); |
6455 #endif | 6455 #endif |
6456 } | 6456 } |
6457 | 6457 |
6458 } // namespace blink | 6458 } // namespace blink |
OLD | NEW |