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

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

Issue 813883002: replace COMPILE_ASSERT with static_assert in platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: final fixups Created 6 years 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
« no previous file with comments | « Source/platform/heap/Heap.cpp ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5266 matching lines...) Expand 10 before | Expand all | Expand 10 after
5277 class TraceTypeNonEagerly1 { }; 5277 class TraceTypeNonEagerly1 { };
5278 WILL_NOT_BE_EAGERLY_TRACED(TraceTypeNonEagerly1); 5278 WILL_NOT_BE_EAGERLY_TRACED(TraceTypeNonEagerly1);
5279 class TraceTypeNonEagerly2 : public TraceTypeNonEagerly1 { }; 5279 class TraceTypeNonEagerly2 : public TraceTypeNonEagerly1 { };
5280 5280
5281 class TraceTypeNonEagerly3 { }; 5281 class TraceTypeNonEagerly3 { };
5282 WILL_NOT_BE_EAGERLY_TRACED_CLASS(TraceTypeNonEagerly3); 5282 WILL_NOT_BE_EAGERLY_TRACED_CLASS(TraceTypeNonEagerly3);
5283 class TraceTypeNonEagerly4 : public TraceTypeNonEagerly3 { }; 5283 class TraceTypeNonEagerly4 : public TraceTypeNonEagerly3 { };
5284 5284
5285 TEST(HeapTest, TraceTypesEagerly) 5285 TEST(HeapTest, TraceTypesEagerly)
5286 { 5286 {
5287 COMPILE_ASSERT(TraceEagerlyTrait<TraceTypeEagerly1>::value, ShouldBeTrue); 5287 static_assert(TraceEagerlyTrait<TraceTypeEagerly1>::value, "should be true") ;
5288 COMPILE_ASSERT(TraceEagerlyTrait<Member<TraceTypeEagerly1>>::value, ShouldBe True); 5288 static_assert(TraceEagerlyTrait<Member<TraceTypeEagerly1>>::value, "should b e true");
5289 COMPILE_ASSERT(TraceEagerlyTrait<WeakMember<TraceTypeEagerly1>>::value, Shou ldBeTrue); 5289 static_assert(TraceEagerlyTrait<WeakMember<TraceTypeEagerly1>>::value, "shou ld be true");
5290 COMPILE_ASSERT(TraceEagerlyTrait<RawPtr<TraceTypeEagerly1>>::value == MARKER _EAGER_TRACING, ShouldBeTrue); 5290 static_assert(TraceEagerlyTrait<RawPtr<TraceTypeEagerly1>>::value == MARKER_ EAGER_TRACING, "should be true");
5291 COMPILE_ASSERT(TraceEagerlyTrait<HeapVector<Member<TraceTypeEagerly1>>>::val ue, ShouldBeTrue); 5291 static_assert(TraceEagerlyTrait<HeapVector<Member<TraceTypeEagerly1>>>::valu e, "should be true");
5292 COMPILE_ASSERT(TraceEagerlyTrait<HeapVector<WeakMember<TraceTypeEagerly1>>>: :value, ShouldBeTrue); 5292 static_assert(TraceEagerlyTrait<HeapVector<WeakMember<TraceTypeEagerly1>>>:: value, "should be true");
5293 COMPILE_ASSERT(TraceEagerlyTrait<HeapHashSet<Member<TraceTypeEagerly1>>>::va lue, ShouldBeTrue); 5293 static_assert(TraceEagerlyTrait<HeapHashSet<Member<TraceTypeEagerly1>>>::val ue, "should be true");
5294 COMPILE_ASSERT(TraceEagerlyTrait<HeapHashSet<Member<TraceTypeEagerly1>>>::va lue, ShouldBeTrue); 5294 static_assert(TraceEagerlyTrait<HeapHashSet<Member<TraceTypeEagerly1>>>::val ue, "should be true");
5295 using HashMapIntToObj = HeapHashMap<int, Member<TraceTypeEagerly1>>; 5295 using HashMapIntToObj = HeapHashMap<int, Member<TraceTypeEagerly1>>;
5296 COMPILE_ASSERT(TraceEagerlyTrait<HashMapIntToObj>::value, ShouldBeTrue); 5296 static_assert(TraceEagerlyTrait<HashMapIntToObj>::value, "should be true");
5297 using HashMapObjToInt = HeapHashMap<Member<TraceTypeEagerly1>, int>; 5297 using HashMapObjToInt = HeapHashMap<Member<TraceTypeEagerly1>, int>;
5298 COMPILE_ASSERT(TraceEagerlyTrait<HashMapObjToInt>::value, ShouldBeTrue); 5298 static_assert(TraceEagerlyTrait<HashMapObjToInt>::value, "should be true");
5299 5299
5300 COMPILE_ASSERT(TraceEagerlyTrait<TraceTypeEagerly2>::value, ShouldBeTrue); 5300 static_assert(TraceEagerlyTrait<TraceTypeEagerly2>::value, "should be true") ;
5301 COMPILE_ASSERT(TraceEagerlyTrait<Member<TraceTypeEagerly2>>::value, ShouldBe True); 5301 static_assert(TraceEagerlyTrait<Member<TraceTypeEagerly2>>::value, "should b e true");
5302 5302
5303 COMPILE_ASSERT(!TraceEagerlyTrait<TraceTypeNonEagerly1>::value, ShouldBeTrue ); 5303 static_assert(!TraceEagerlyTrait<TraceTypeNonEagerly1>::value, "should be tr ue");
5304 COMPILE_ASSERT(!TraceEagerlyTrait<TraceTypeNonEagerly2>::value, ShouldBeTrue ); 5304 static_assert(!TraceEagerlyTrait<TraceTypeNonEagerly2>::value, "should be tr ue");
5305 COMPILE_ASSERT(!TraceEagerlyTrait<TraceTypeNonEagerly3>::value, ShouldBeTrue ); 5305 static_assert(!TraceEagerlyTrait<TraceTypeNonEagerly3>::value, "should be tr ue");
5306 COMPILE_ASSERT(TraceEagerlyTrait<TraceTypeNonEagerly4>::value == MARKER_EAGE R_TRACING, ShouldBeTrue); 5306 static_assert(TraceEagerlyTrait<TraceTypeNonEagerly4>::value == MARKER_EAGER _TRACING, "should be true");
5307 } 5307 }
5308 5308
5309 class DeepEagerly final : public GarbageCollected<DeepEagerly> { 5309 class DeepEagerly final : public GarbageCollected<DeepEagerly> {
5310 public: 5310 public:
5311 DeepEagerly(DeepEagerly* next) 5311 DeepEagerly(DeepEagerly* next)
5312 : m_next(next) 5312 : m_next(next)
5313 { 5313 {
5314 } 5314 }
5315 5315
5316 void trace(Visitor* visitor) 5316 void trace(Visitor* visitor)
(...skipping 24 matching lines...) Expand all
5341 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 5341 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
5342 5342
5343 // Verify that the DeepEagerly chain isn't completely unravelled 5343 // Verify that the DeepEagerly chain isn't completely unravelled
5344 // by performing eager trace() calls, but the explicit mark 5344 // by performing eager trace() calls, but the explicit mark
5345 // stack is switched once some nesting limit is exceeded. 5345 // stack is switched once some nesting limit is exceeded.
5346 EXPECT_GT(DeepEagerly::sTraceLazy, 2); 5346 EXPECT_GT(DeepEagerly::sTraceLazy, 2);
5347 #endif 5347 #endif
5348 } 5348 }
5349 5349
5350 } // namespace blink 5350 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/Heap.cpp ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698