| 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 25 matching lines...) Expand all Loading... |
| 36 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
| 37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
| 39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class SVGElement; | 43 class SVGElement; |
| 44 class SVGAnimationElement; | 44 class SVGAnimationElement; |
| 45 | 45 |
| 46 class SVGPropertyBase : public RefCountedWillBeRefCountedGarbageCollected<SVGPro
pertyBase> { | 46 class SVGPropertyBase : public RefCounted<SVGPropertyBase> { |
| 47 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); | 47 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); |
| 48 | 48 |
| 49 public: | 49 public: |
| 50 // Properties do not have a primitive type by default | 50 // Properties do not have a primitive type by default |
| 51 typedef void PrimitiveType; | 51 typedef void PrimitiveType; |
| 52 | 52 |
| 53 virtual ~SVGPropertyBase() | 53 virtual ~SVGPropertyBase() |
| 54 { | 54 { |
| 55 ASSERT(!m_ownerList); | 55 ASSERT(!m_ownerList); |
| 56 } | 56 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 void setOwnerList(SVGPropertyBase* ownerList) | 79 void setOwnerList(SVGPropertyBase* ownerList) |
| 80 { | 80 { |
| 81 // Previous owner list must be cleared before setting new owner list. | 81 // Previous owner list must be cleared before setting new owner list. |
| 82 ASSERT((!ownerList && m_ownerList) || (ownerList && !m_ownerList)); | 82 ASSERT((!ownerList && m_ownerList) || (ownerList && !m_ownerList)); |
| 83 | 83 |
| 84 m_ownerList = ownerList; | 84 m_ownerList = ownerList; |
| 85 } | 85 } |
| 86 | 86 |
| 87 virtual void trace(Visitor* visitor) | |
| 88 { | |
| 89 visitor->trace(m_ownerList); | |
| 90 } | |
| 91 | |
| 92 protected: | 87 protected: |
| 93 explicit SVGPropertyBase(AnimatedPropertyType type) | 88 explicit SVGPropertyBase(AnimatedPropertyType type) |
| 94 : m_type(type) | 89 : m_type(type) |
| 95 , m_ownerList(nullptr) | 90 , m_ownerList(nullptr) |
| 96 { | 91 { |
| 97 #if ENABLE(OILPAN) | |
| 98 // FIXME: Oilpan: the objects that derive from this RefCountedGarbageCol
lected<> | |
| 99 // base object are all RefPtr<T>-exposed (i.e., create()s returning a Pa
ssRefPtr<T>.) | |
| 100 // | |
| 101 // Following r183582, RefCountedGarbageCollected<>::m_refCount is initia
lized | |
| 102 // as 0, which is safe assuming the constructor result is initially hand
led/returned | |
| 103 // as a raw pointer. But to support an "RefCounted-identical" view of su
ch a fresh | |
| 104 // object, we need to adjust the RefCountedGarbageCollected<>::m_refCoun
t to be | |
| 105 // its assumed 1 for these derived objects to function as expected. | |
| 106 // | |
| 107 // This would be simpler if the derived SVG property objects created GCe
d objects | |
| 108 // proper. Remove this ref count adjustment when this happens. | |
| 109 ref(); | |
| 110 #endif | |
| 111 } | 92 } |
| 112 | 93 |
| 113 private: | 94 private: |
| 114 const AnimatedPropertyType m_type; | 95 const AnimatedPropertyType m_type; |
| 115 | 96 |
| 116 RawPtrWillBeMember<SVGPropertyBase> m_ownerList; | 97 SVGPropertyBase* m_ownerList; |
| 117 }; | 98 }; |
| 118 | 99 |
| 119 } | 100 } |
| 120 | 101 |
| 121 #endif // SVGProperty_h | 102 #endif // SVGProperty_h |
| OLD | NEW |