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