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

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

Issue 2110363002: Rename SameThreadClosure to Closure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_ExplicitWTFBind
Patch Set: Add WTF:: to Closure Created 4 years, 5 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 5233 matching lines...) Expand 10 before | Expand all | Expand 10 after
5244 { 5244 {
5245 Persistent<HeapHashMap<int, WeakMember<IntWrapper>>> map = new HeapHashMap<i nt, WeakMember<IntWrapper>>(); 5245 Persistent<HeapHashMap<int, WeakMember<IntWrapper>>> map = new HeapHashMap<i nt, WeakMember<IntWrapper>>();
5246 addElementsToWeakMap(map); 5246 addElementsToWeakMap(map);
5247 HeapHashMap<int, WeakMember<IntWrapper>>::AddResult result = map->add(800, n ullptr); 5247 HeapHashMap<int, WeakMember<IntWrapper>>::AddResult result = map->add(800, n ullptr);
5248 conservativelyCollectGarbage(); 5248 conservativelyCollectGarbage();
5249 result.storedValue->value = IntWrapper::create(42); 5249 result.storedValue->value = IntWrapper::create(42);
5250 } 5250 }
5251 5251
5252 TEST(HeapTest, Bind) 5252 TEST(HeapTest, Bind)
5253 { 5253 {
5254 std::unique_ptr<SameThreadClosure> closure = WTF::bind(static_cast<void (Bar ::*)(Visitor*)>(&Bar::trace), wrapPersistent(Bar::create()), nullptr); 5254 std::unique_ptr<WTF::Closure> closure = WTF::bind(static_cast<void (Bar::*)( Visitor*)>(&Bar::trace), wrapPersistent(Bar::create()), nullptr);
5255 // OffHeapInt* should not make Persistent. 5255 // OffHeapInt* should not make Persistent.
5256 std::unique_ptr<SameThreadClosure> closure2 = WTF::bind(&OffHeapInt::voidFun ction, OffHeapInt::create(1)); 5256 std::unique_ptr<WTF::Closure> closure2 = WTF::bind(&OffHeapInt::voidFunction , OffHeapInt::create(1));
5257 preciselyCollectGarbage(); 5257 preciselyCollectGarbage();
5258 // The closure should have a persistent handle to the Bar. 5258 // The closure should have a persistent handle to the Bar.
5259 EXPECT_EQ(1u, Bar::s_live); 5259 EXPECT_EQ(1u, Bar::s_live);
5260 5260
5261 UseMixin::s_traceCount = 0; 5261 UseMixin::s_traceCount = 0;
5262 Mixin* mixin = UseMixin::create(); 5262 Mixin* mixin = UseMixin::create();
5263 std::unique_ptr<SameThreadClosure> mixinClosure = WTF::bind(static_cast<void (Mixin::*)(Visitor*)>(&Mixin::trace), wrapPersistent(mixin), nullptr); 5263 std::unique_ptr<WTF::Closure> mixinClosure = WTF::bind(static_cast<void (Mix in::*)(Visitor*)>(&Mixin::trace), wrapPersistent(mixin), nullptr);
5264 preciselyCollectGarbage(); 5264 preciselyCollectGarbage();
5265 // The closure should have a persistent handle to the mixin. 5265 // The closure should have a persistent handle to the mixin.
5266 EXPECT_EQ(1, UseMixin::s_traceCount); 5266 EXPECT_EQ(1, UseMixin::s_traceCount);
5267 } 5267 }
5268 5268
5269 typedef HeapHashSet<WeakMember<IntWrapper>> WeakSet; 5269 typedef HeapHashSet<WeakMember<IntWrapper>> WeakSet;
5270 5270
5271 // These special traits will remove a set from a map when the set is empty. 5271 // These special traits will remove a set from a map when the set is empty.
5272 struct EmptyClearingHashSetTraits : HashTraits<WeakSet> { 5272 struct EmptyClearingHashSetTraits : HashTraits<WeakSet> {
5273 static const WTF::WeakHandlingFlag weakHandlingFlag = WTF::WeakHandlingInCol lections; 5273 static const WTF::WeakHandlingFlag weakHandlingFlag = WTF::WeakHandlingInCol lections;
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after
6946 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe r>>>::value, "HeapLinkedHashSet"); 6946 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe r>>>::value, "HeapLinkedHashSet");
6947 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper> >>::value, "HeapListHashSet"); 6947 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper> >>::value, "HeapListHashSet");
6948 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp er>>>::value, "HeapHashCountedSet"); 6948 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp er>>>::value, "HeapHashCountedSet");
6949 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper >>>::value, "HeapHashMap"); 6949 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper >>>::value, "HeapHashMap");
6950 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v alue, "HeapVector"); 6950 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v alue, "HeapVector");
6951 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va lue, "HeapDeque"); 6951 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va lue, "HeapDeque");
6952 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap per>>>::value, "HeapTerminatedArray"); 6952 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap per>>>::value, "HeapTerminatedArray");
6953 } 6953 }
6954 6954
6955 } // namespace blink 6955 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698