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