| 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 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 HeapVector<Member<IntWrapper>, inlineCapacity> vector1; | 2332 HeapVector<Member<IntWrapper>, inlineCapacity> vector1; |
| 2333 vector1.reserveCapacity(128); | 2333 vector1.reserveCapacity(128); |
| 2334 EXPECT_LE(128u, vector1.capacity()); | 2334 EXPECT_LE(128u, vector1.capacity()); |
| 2335 vector1.grow(vector1.capacity()); | 2335 vector1.grow(vector1.capacity()); |
| 2336 | 2336 |
| 2337 // Shrink the external buffer. | 2337 // Shrink the external buffer. |
| 2338 vector1.shrink(90); | 2338 vector1.shrink(90); |
| 2339 vector1.shrinkToFit(); | 2339 vector1.shrinkToFit(); |
| 2340 EXPECT_GT(128u, vector1.capacity()); | 2340 EXPECT_GT(128u, vector1.capacity()); |
| 2341 | 2341 |
| 2342 // TODO(sof): if the ASan support for 'contiguous containers' is enabled, |
| 2343 // Vector inline buffers are disabled; that constraint should be attempted |
| 2344 // removed, but until that time, disable testing handling of capacities |
| 2345 // of inline buffers. |
| 2346 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
| 2342 // Shrinking switches the buffer from the external one to the inline one. | 2347 // Shrinking switches the buffer from the external one to the inline one. |
| 2343 vector1.shrink(inlineCapacity - 1); | 2348 vector1.shrink(inlineCapacity - 1); |
| 2344 vector1.shrinkToFit(); | 2349 vector1.shrinkToFit(); |
| 2345 EXPECT_EQ(inlineCapacity, vector1.capacity()); | 2350 EXPECT_EQ(inlineCapacity, vector1.capacity()); |
| 2346 | 2351 |
| 2347 // Try to shrink the inline buffer. | 2352 // Try to shrink the inline buffer. |
| 2348 vector1.shrink(1); | 2353 vector1.shrink(1); |
| 2349 vector1.shrinkToFit(); | 2354 vector1.shrinkToFit(); |
| 2350 EXPECT_EQ(inlineCapacity, vector1.capacity()); | 2355 EXPECT_EQ(inlineCapacity, vector1.capacity()); |
| 2356 #endif |
| 2351 } | 2357 } |
| 2352 | 2358 |
| 2353 template<typename T, size_t inlineCapacity, typename U> | 2359 template<typename T, size_t inlineCapacity, typename U> |
| 2354 bool dequeContains(HeapDeque<T, inlineCapacity>& deque, U u) | 2360 bool dequeContains(HeapDeque<T, inlineCapacity>& deque, U u) |
| 2355 { | 2361 { |
| 2356 typedef typename HeapDeque<T, inlineCapacity>::iterator iterator; | 2362 typedef typename HeapDeque<T, inlineCapacity>::iterator iterator; |
| 2357 for (iterator it = deque.begin(); it != deque.end(); ++it) { | 2363 for (iterator it = deque.begin(); it != deque.end(); ++it) { |
| 2358 if (*it == u) | 2364 if (*it == u) |
| 2359 return true; | 2365 return true; |
| 2360 } | 2366 } |
| (...skipping 3331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5692 { | 5698 { |
| 5693 Persistent<ClassWithMember> object = ClassWithMember::create(); | 5699 Persistent<ClassWithMember> object = ClassWithMember::create(); |
| 5694 EXPECT_EQ(0, object->traceCount()); | 5700 EXPECT_EQ(0, object->traceCount()); |
| 5695 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); | 5701 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); |
| 5696 EXPECT_TRUE(mixin); | 5702 EXPECT_TRUE(mixin); |
| 5697 EXPECT_GT(object->traceCount(), 0); | 5703 EXPECT_GT(object->traceCount(), 0); |
| 5698 EXPECT_GT(mixin->traceCount(), 0); | 5704 EXPECT_GT(mixin->traceCount(), 0); |
| 5699 } | 5705 } |
| 5700 | 5706 |
| 5701 } // namespace blink | 5707 } // namespace blink |
| OLD | NEW |