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 3960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3971 | 3971 |
3972 // class SimpleObject : public GarbageCollected<SimpleObject> {}; | 3972 // class SimpleObject : public GarbageCollected<SimpleObject> {}; |
3973 EXPECT_FALSE(NeedsAdjustAndMark<SimpleObject>::value); | 3973 EXPECT_FALSE(NeedsAdjustAndMark<SimpleObject>::value); |
3974 EXPECT_FALSE(NeedsAdjustAndMark<const SimpleObject>::value); | 3974 EXPECT_FALSE(NeedsAdjustAndMark<const SimpleObject>::value); |
3975 | 3975 |
3976 // class UseMixin : public SimpleObject, public Mixin {}; | 3976 // class UseMixin : public SimpleObject, public Mixin {}; |
3977 EXPECT_FALSE(NeedsAdjustAndMark<UseMixin>::value); | 3977 EXPECT_FALSE(NeedsAdjustAndMark<UseMixin>::value); |
3978 EXPECT_FALSE(NeedsAdjustAndMark<const UseMixin>::value); | 3978 EXPECT_FALSE(NeedsAdjustAndMark<const UseMixin>::value); |
3979 } | 3979 } |
3980 | 3980 |
3981 TEST(HeapTest, Bind) | |
3982 { | |
3983 Closure closure = bind(&Bar::trace, Bar::create(), static_cast<Visitor*>(0))
; | |
3984 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | |
3985 // The closure should have a persistent handle to the Bar. | |
3986 EXPECT_EQ(1u, Bar::s_live); | |
3987 | |
3988 Closure closure2 = bind(&Bar::trace, RawPtr<Bar>(Bar::create()), static_cast
<Visitor*>(0)); | |
3989 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | |
3990 // The closure should have a persistent handle to the Bar. | |
3991 EXPECT_EQ(2u, Bar::s_live); | |
3992 | |
3993 UseMixin::s_traceCount = 0; | |
3994 Mixin* mixin = UseMixin::create(); | |
3995 Closure mixinClosure = bind(&Mixin::trace, mixin, static_cast<Visitor*>(0)); | |
3996 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | |
3997 // The closure should have a persistent handle to the mixin. | |
3998 EXPECT_EQ(1, UseMixin::s_traceCount); | |
3999 } | |
4000 | |
4001 } // WebCore namespace | 3981 } // WebCore namespace |
OLD | NEW |