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 4325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4336 IntWrapper::s_destructorCalls = 0; | 4336 IntWrapper::s_destructorCalls = 0; |
4337 | 4337 |
4338 HeapTerminatedArray<TerminatedArrayItem>* arr = 0; | 4338 HeapTerminatedArray<TerminatedArrayItem>* arr = 0; |
4339 | 4339 |
4340 const size_t prefixSize = 4; | 4340 const size_t prefixSize = 4; |
4341 const size_t suffixSize = 4; | 4341 const size_t suffixSize = 4; |
4342 | 4342 |
4343 { | 4343 { |
4344 HeapTerminatedArrayBuilder<TerminatedArrayItem> builder(arr); | 4344 HeapTerminatedArrayBuilder<TerminatedArrayItem> builder(arr); |
4345 builder.grow(prefixSize); | 4345 builder.grow(prefixSize); |
| 4346 conservativelyCollectGarbage(); |
4346 for (size_t i = 0; i < prefixSize; i++) | 4347 for (size_t i = 0; i < prefixSize; i++) |
4347 builder.append(TerminatedArrayItem(IntWrapper::create(i))); | 4348 builder.append(TerminatedArrayItem(IntWrapper::create(i))); |
4348 arr = builder.release(); | 4349 arr = builder.release(); |
4349 } | 4350 } |
4350 | 4351 |
4351 conservativelyCollectGarbage(); | 4352 conservativelyCollectGarbage(); |
4352 EXPECT_EQ(0, IntWrapper::s_destructorCalls); | 4353 EXPECT_EQ(0, IntWrapper::s_destructorCalls); |
4353 EXPECT_EQ(prefixSize, arr->size()); | 4354 EXPECT_EQ(prefixSize, arr->size()); |
4354 for (size_t i = 0; i < prefixSize; i++) | 4355 for (size_t i = 0; i < prefixSize; i++) |
4355 EXPECT_EQ(i, static_cast<size_t>(arr->at(i).payload()->value())); | 4356 EXPECT_EQ(i, static_cast<size_t>(arr->at(i).payload()->value())); |
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6524 EXPECT_EQ(1u, vector2.size()); | 6525 EXPECT_EQ(1u, vector2.size()); |
6525 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables | 6526 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
6526 // Vector<>s with inline capacity, remove. | 6527 // Vector<>s with inline capacity, remove. |
6527 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) | 6528 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
6528 EXPECT_EQ(16u, vector1.capacity()); | 6529 EXPECT_EQ(16u, vector1.capacity()); |
6529 EXPECT_EQ(16u, vector2.capacity()); | 6530 EXPECT_EQ(16u, vector2.capacity()); |
6530 #endif | 6531 #endif |
6531 } | 6532 } |
6532 | 6533 |
6533 } // namespace blink | 6534 } // namespace blink |
OLD | NEW |