| 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 5012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5023 | 5023 |
| 5024 { | 5024 { |
| 5025 TraceIfNeededTester<HeapVector<Member<SimpleObject> > >* m_vec = TraceIf
NeededTester<HeapVector<Member<SimpleObject> > >::create(); | 5025 TraceIfNeededTester<HeapVector<Member<SimpleObject> > >* m_vec = TraceIf
NeededTester<HeapVector<Member<SimpleObject> > >::create(); |
| 5026 m_vec->obj().append(SimpleObject::create()); | 5026 m_vec->obj().append(SimpleObject::create()); |
| 5027 visitor.reset(); | 5027 visitor.reset(); |
| 5028 m_vec->trace(&visitor); | 5028 m_vec->trace(&visitor); |
| 5029 EXPECT_EQ(2u, visitor.count()); | 5029 EXPECT_EQ(2u, visitor.count()); |
| 5030 } | 5030 } |
| 5031 } | 5031 } |
| 5032 | 5032 |
| 5033 static bool allocateAndReturnBool() |
| 5034 { |
| 5035 Heap::collectGarbage(ThreadState::HeapPointersOnStack); |
| 5036 return true; |
| 5037 } |
| 5038 |
| 5039 class PartObjectWithVirtualMethod { |
| 5040 public: |
| 5041 virtual void trace(Visitor*) { } |
| 5042 }; |
| 5043 |
| 5044 class ObjectWithVirtualPartObject : public GarbageCollected<ObjectWithVirtualPar
tObject> { |
| 5045 public: |
| 5046 ObjectWithVirtualPartObject() : m_dummy(allocateAndReturnBool()) { } |
| 5047 void trace(Visitor* visitor) { visitor->trace(m_part); } |
| 5048 private: |
| 5049 bool m_dummy; |
| 5050 PartObjectWithVirtualMethod m_part; |
| 5051 }; |
| 5052 |
| 5053 TEST(HeapTest, PartObjectWithVirtualMethod) |
| 5054 { |
| 5055 ObjectWithVirtualPartObject* object = new ObjectWithVirtualPartObject(); |
| 5056 EXPECT_TRUE(object); |
| 5057 } |
| 5058 |
| 5033 } // namespace blink | 5059 } // namespace blink |
| OLD | NEW |