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

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

Issue 1855203002: Revert of Improve DEFINE_STATIC_LOCAL()'s handling of Blink GCed objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 6491 matching lines...) Expand 10 before | Expand all | Expand 10 after
6502 6502
6503 EXPECT_EQ(1u, vector2.size()); 6503 EXPECT_EQ(1u, vector2.size());
6504 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables 6504 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables
6505 // Vector<>s with inline capacity, remove. 6505 // Vector<>s with inline capacity, remove.
6506 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) 6506 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER)
6507 EXPECT_EQ(16u, vector1.capacity()); 6507 EXPECT_EQ(16u, vector1.capacity());
6508 EXPECT_EQ(16u, vector2.capacity()); 6508 EXPECT_EQ(16u, vector2.capacity());
6509 #endif 6509 #endif
6510 } 6510 }
6511 6511
6512 TEST(HeapTest, TestStaticLocals)
6513 {
6514 // Sanity check DEFINE_STATIC_LOCAL()s over heap allocated objects and colle ctions.
6515
6516 DEFINE_STATIC_LOCAL(IntWrapper, intWrapper, (new IntWrapper(33)));
6517 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<IntWrapper>>, persistentHeap VectorIntWrapper, ());
6518 DEFINE_STATIC_LOCAL(HeapVector<Member<IntWrapper>>, heapVectorIntWrapper, (n ew HeapVector<Member<IntWrapper>>));
6519
6520 EXPECT_EQ(33, intWrapper.value());
6521 EXPECT_EQ(0u, persistentHeapVectorIntWrapper.size());
6522 EXPECT_EQ(0u, heapVectorIntWrapper.size());
6523
6524 persistentHeapVectorIntWrapper.append(&intWrapper);
6525 heapVectorIntWrapper.append(&intWrapper);
6526 EXPECT_EQ(1u, persistentHeapVectorIntWrapper.size());
6527 EXPECT_EQ(1u, heapVectorIntWrapper.size());
6528
6529 EXPECT_EQ(persistentHeapVectorIntWrapper[0], heapVectorIntWrapper[0]);
6530 EXPECT_EQ(33, heapVectorIntWrapper[0]->value());
6531 }
6532
6533 } // namespace blink 6512 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontCache.cpp ('k') | third_party/WebKit/Source/web/InspectorOverlay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698