| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 // USING_GARBAGE_COLLECTED_MIXIN(A) | 578 // USING_GARBAGE_COLLECTED_MIXIN(A) |
| 579 // }; | 579 // }; |
| 580 // | 580 // |
| 581 // With the helper, as long as we are using Member<B>, TypeTrait<B> will | 581 // With the helper, as long as we are using Member<B>, TypeTrait<B> will |
| 582 // dispatch adjustAndMark dynamically to find collect addr of the object header. | 582 // dispatch adjustAndMark dynamically to find collect addr of the object header. |
| 583 // Note that this is only enabled for Member<B>. For Member<A> which we can | 583 // Note that this is only enabled for Member<B>. For Member<A> which we can |
| 584 // compute the object header addr statically, this dynamic dispatch is not used. | 584 // compute the object header addr statically, this dynamic dispatch is not used. |
| 585 | 585 |
| 586 class PLATFORM_EXPORT GarbageCollectedMixin { | 586 class PLATFORM_EXPORT GarbageCollectedMixin { |
| 587 public: | 587 public: |
| 588 virtual void adjustAndMark(Visitor*) const { }; | 588 virtual void adjustAndMark(Visitor*) const = 0; |
| 589 virtual bool isHeapObjectAlive(Visitor*) const { return true; }; | 589 virtual bool isHeapObjectAlive(Visitor*) const = 0; |
| 590 virtual void trace(Visitor*) { } | 590 virtual void trace(Visitor*) { } |
| 591 }; | 591 }; |
| 592 | 592 |
| 593 #define USING_GARBAGE_COLLECTED_MIXIN(TYPE) \ | 593 #define USING_GARBAGE_COLLECTED_MIXIN(TYPE) \ |
| 594 public: \ | 594 public: \ |
| 595 virtual void adjustAndMark(blink::Visitor* visitor) const override \ | 595 virtual void adjustAndMark(blink::Visitor* visitor) const override \ |
| 596 { \ | 596 { \ |
| 597 typedef WTF::IsSubclassOfTemplate<typename WTF::RemoveConst<TYPE>::Type,
blink::GarbageCollected> IsSubclassOfGarbageCollected; \ | 597 typedef WTF::IsSubclassOfTemplate<typename WTF::RemoveConst<TYPE>::Type,
blink::GarbageCollected> IsSubclassOfGarbageCollected; \ |
| 598 COMPILE_ASSERT(IsSubclassOfGarbageCollected::value, OnlyGarbageCollected
ObjectsCanHaveGarbageCollectedMixins); \ | 598 COMPILE_ASSERT(IsSubclassOfGarbageCollected::value, OnlyGarbageCollected
ObjectsCanHaveGarbageCollectedMixins); \ |
| 599 visitor->mark(static_cast<const TYPE*>(this), &blink::TraceTrait<TYPE>::
trace); \ | 599 visitor->mark(static_cast<const TYPE*>(this), &blink::TraceTrait<TYPE>::
trace); \ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 struct GCInfoTrait { | 655 struct GCInfoTrait { |
| 656 static const GCInfo* get() | 656 static const GCInfo* get() |
| 657 { | 657 { |
| 658 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 658 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
| 659 } | 659 } |
| 660 }; | 660 }; |
| 661 | 661 |
| 662 } | 662 } |
| 663 | 663 |
| 664 #endif | 664 #endif |
| OLD | NEW |