| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/ContiguousContainer.h" | 5 #include "platform/graphics/ContiguousContainer.h" |
| 6 | 6 |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "wtf/TypeTraits.h" | 9 #include "wtf/TypeTraits.h" |
| 10 | 10 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 ContiguousContainer<SmallStruct> list(sizeof(SmallStruct), | 279 ContiguousContainer<SmallStruct> list(sizeof(SmallStruct), |
| 280 1 * sizeof(SmallStruct)); | 280 1 * sizeof(SmallStruct)); |
| 281 Vector<SmallStruct*> pointers; | 281 Vector<SmallStruct*> pointers; |
| 282 | 282 |
| 283 // Utilities which keep these two lists in sync and check that their | 283 // Utilities which keep these two lists in sync and check that their |
| 284 // iteration order matches. | 284 // iteration order matches. |
| 285 auto push = [&list, &pointers]() { | 285 auto push = [&list, &pointers]() { |
| 286 pointers.append(&list.allocateAndConstruct<SmallStruct>()); | 286 pointers.append(&list.allocateAndConstruct<SmallStruct>()); |
| 287 }; | 287 }; |
| 288 auto pop = [&list, &pointers]() { | 288 auto pop = [&list, &pointers]() { |
| 289 pointers.removeLast(); | 289 pointers.pop_back(); |
| 290 list.removeLast(); | 290 list.removeLast(); |
| 291 }; | 291 }; |
| 292 auto check_equal = [&list, &pointers]() { | 292 auto check_equal = [&list, &pointers]() { |
| 293 // They should be of the same size, and compare equal with all four | 293 // They should be of the same size, and compare equal with all four |
| 294 // kinds of iteration. | 294 // kinds of iteration. |
| 295 const auto& constList = list; | 295 const auto& constList = list; |
| 296 const auto& constPointers = pointers; | 296 const auto& constPointers = pointers; |
| 297 ASSERT_EQ(list.size(), pointers.size()); | 297 ASSERT_EQ(list.size(), pointers.size()); |
| 298 ASSERT_TRUE(EqualPointers(list.begin(), list.end(), pointers.begin())); | 298 ASSERT_TRUE(EqualPointers(list.begin(), list.end(), pointers.begin())); |
| 299 ASSERT_TRUE(EqualPointers(constList.begin(), constList.end(), | 299 ASSERT_TRUE(EqualPointers(constList.begin(), constList.end(), |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 list.appendByMoving(list[2], sizeof(Point3D)); | 533 list.appendByMoving(list[2], sizeof(Point3D)); |
| 534 EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.last()) & (maxAlign - 1)); | 534 EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.last()) & (maxAlign - 1)); |
| 535 list.appendByMoving(list[3], sizeof(Point3D)); | 535 list.appendByMoving(list[3], sizeof(Point3D)); |
| 536 EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.last()) & (maxAlign - 1)); | 536 EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.last()) & (maxAlign - 1)); |
| 537 list.appendByMoving(list[4], sizeof(Point2D)); | 537 list.appendByMoving(list[4], sizeof(Point2D)); |
| 538 EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.last()) & (maxAlign - 1)); | 538 EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.last()) & (maxAlign - 1)); |
| 539 } | 539 } |
| 540 | 540 |
| 541 } // namespace | 541 } // namespace |
| 542 } // namespace blink | 542 } // namespace blink |
| OLD | NEW |