Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapTest.cpp

Issue 1410223006: Zero-initialize persistent heap vector inline backing buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for unit test, handle ANNOTATE_CONTIGUOUS_CONTAINER's non-support of inline buffers Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 6416 matching lines...) Expand 10 before | Expand all | Expand 10 after
6427 EXPECT_FALSE(crossThreadWeakPersistent.get()); 6427 EXPECT_FALSE(crossThreadWeakPersistent.get());
6428 { 6428 {
6429 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); 6429 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex());
6430 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); 6430 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls);
6431 } 6431 }
6432 6432
6433 wakeWorkerThread(); 6433 wakeWorkerThread();
6434 parkMainThread(); 6434 parkMainThread();
6435 } 6435 }
6436 6436
6437 class TestPersistentHeapVectorWithUnusedSlots : public PersistentHeapVector<Vect orObject, 16> {
6438 public:
6439 void checkUnused()
6440 {
6441 checkUnusedSlots(end(), end() + (capacity() - size()));
6442 }
6443 };
6444
6445 TEST(HeapTest, TestPersistentHeapVectorWithUnusedSlots)
6446 {
6447 TestPersistentHeapVectorWithUnusedSlots vector1;
6448 TestPersistentHeapVectorWithUnusedSlots vector2(vector1);
6449
6450 vector1.checkUnused();
6451 vector2.checkUnused();
6452
6453 vector2.append(VectorObject());
6454 vector2.checkUnused();
6455
6456 EXPECT_EQ(0u, vector1.size());
6457
6458 EXPECT_EQ(1u, vector2.size());
6459 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables
6460 // Vector<>s with inline capacity, remove.
6461 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER)
6462 EXPECT_EQ(16u, vector1.capacity());
6463 EXPECT_EQ(16u, vector2.capacity());
6464 #endif
6465 }
6466
6437 } // namespace blink 6467 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Handle.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698