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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 virtual bool isMarked(const void*) = 0; | 406 virtual bool isMarked(const void*) = 0; |
407 | 407 |
408 template<typename T> inline bool isAlive(T* obj) | 408 template<typename T> inline bool isAlive(T* obj) |
409 { | 409 { |
410 return !!obj && ObjectAliveTrait<T>::isAlive(this, obj); | 410 return !!obj && ObjectAliveTrait<T>::isAlive(this, obj); |
411 } | 411 } |
412 template<typename T> inline bool isAlive(const Member<T>& member) | 412 template<typename T> inline bool isAlive(const Member<T>& member) |
413 { | 413 { |
414 return isAlive(member.get()); | 414 return isAlive(member.get()); |
415 } | 415 } |
| 416 template<typename T> inline bool isAlive(RawPtr<T> ptr) |
| 417 { |
| 418 return isAlive(ptr.get()); |
| 419 } |
416 | 420 |
417 #ifndef NDEBUG | 421 #ifndef NDEBUG |
418 void checkGCInfo(const void*, const GCInfo*); | 422 void checkGCInfo(const void*, const GCInfo*); |
419 #endif | 423 #endif |
420 | 424 |
421 // Macro to declare methods needed for each typed heap. | 425 // Macro to declare methods needed for each typed heap. |
422 #define DECLARE_VISITOR_METHODS(Type) \ | 426 #define DECLARE_VISITOR_METHODS(Type) \ |
423 DEBUG_ONLY(void checkGCInfo(const Type*, const GCInfo*);) \ | 427 DEBUG_ONLY(void checkGCInfo(const Type*, const GCInfo*);) \ |
424 virtual void mark(const Type*, TraceCallback) = 0; \ | 428 virtual void mark(const Type*, TraceCallback) = 0; \ |
425 virtual bool isMarked(const Type*) = 0; | 429 virtual bool isMarked(const Type*) = 0; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 // compute the object header addr statically, this dynamic dispatch is not used. | 639 // compute the object header addr statically, this dynamic dispatch is not used. |
636 | 640 |
637 class GarbageCollectedMixin { | 641 class GarbageCollectedMixin { |
638 public: | 642 public: |
639 virtual void adjustAndMark(Visitor*) const = 0; | 643 virtual void adjustAndMark(Visitor*) const = 0; |
640 virtual bool isAlive(Visitor*) const = 0; | 644 virtual bool isAlive(Visitor*) const = 0; |
641 }; | 645 }; |
642 | 646 |
643 #define USING_GARBAGE_COLLECTED_MIXIN(TYPE) \ | 647 #define USING_GARBAGE_COLLECTED_MIXIN(TYPE) \ |
644 public: \ | 648 public: \ |
645 virtual void adjustAndMark(Visitor* visitor) const OVERRIDE \ | 649 virtual void adjustAndMark(WebCore::Visitor* visitor) const OVERRIDE \ |
646 { \ | 650 { \ |
647 typedef WTF::IsSubclassOfTemplate<TYPE, WebCore::GarbageCollected> IsSub
classOfGarbageCollected; \ | 651 typedef WTF::IsSubclassOfTemplate<TYPE, WebCore::GarbageCollected> IsSub
classOfGarbageCollected; \ |
648 COMPILE_ASSERT(IsSubclassOfGarbageCollected::value, OnlyGarbageCollected
ObjectsCanHaveGarbageCollectedMixins); \ | 652 COMPILE_ASSERT(IsSubclassOfGarbageCollected::value, OnlyGarbageCollected
ObjectsCanHaveGarbageCollectedMixins); \ |
649 visitor->mark(this, &TraceTrait<TYPE>::trace);\ | 653 visitor->mark(this, &WebCore::TraceTrait<TYPE>::trace); \ |
650 } \ | 654 } \ |
651 virtual bool isAlive(Visitor* visitor) const OVERRIDE \ | 655 virtual bool isAlive(WebCore::Visitor* visitor) const OVERRIDE \ |
652 { \ | 656 { \ |
653 return visitor->isAlive(this); \ | 657 return visitor->isAlive(this); \ |
654 } | 658 } |
655 | 659 |
656 #if ENABLE(OILPAN) | 660 #if ENABLE(OILPAN) |
657 #define WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TYPE) USING_GARBAGE_COLLECTED_MIXI
N(TYPE) | 661 #define WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TYPE) USING_GARBAGE_COLLECTED_MIXI
N(TYPE) |
658 #else | 662 #else |
659 #define WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TYPE) | 663 #define WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TYPE) |
660 #endif | 664 #endif |
661 | 665 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 struct GCInfoTrait { | 708 struct GCInfoTrait { |
705 static const GCInfo* get() | 709 static const GCInfo* get() |
706 { | 710 { |
707 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 711 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
708 } | 712 } |
709 }; | 713 }; |
710 | 714 |
711 } | 715 } |
712 | 716 |
713 #endif | 717 #endif |
OLD | NEW |