Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PropertyTreeState_h | 5 #ifndef PropertyTreeState_h |
| 6 #define PropertyTreeState_h | 6 #define PropertyTreeState_h |
| 7 | 7 |
| 8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 10 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | 10 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 DCHECK(!m_transform || !m_transform->hasOneRef()); | 31 DCHECK(!m_transform || !m_transform->hasOneRef()); |
| 32 DCHECK(!m_clip || !m_clip->hasOneRef()); | 32 DCHECK(!m_clip || !m_clip->hasOneRef()); |
| 33 DCHECK(!m_effect || !m_effect->hasOneRef()); | 33 DCHECK(!m_effect || !m_effect->hasOneRef()); |
| 34 DCHECK(!m_scroll || !m_scroll->hasOneRef()); | 34 DCHECK(!m_scroll || !m_scroll->hasOneRef()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 const TransformPaintPropertyNode* transform() const { | 37 const TransformPaintPropertyNode* transform() const { |
| 38 DCHECK(!m_transform || !m_transform->hasOneRef()); | 38 DCHECK(!m_transform || !m_transform->hasOneRef()); |
| 39 return m_transform.get(); | 39 return m_transform.get(); |
| 40 } | 40 } |
| 41 void setTransform(const TransformPaintPropertyNode* node) { | 41 void setTransform(PassRefPtr<const TransformPaintPropertyNode> node) { |
| 42 m_transform = node; | 42 m_transform = node; |
| 43 DCHECK(!node->hasOneRef()); | |
|
trchen
2016/12/15 04:15:52
Just realized this DCHECK makes no sense. The only
| |
| 44 } | 43 } |
| 45 | 44 |
| 46 const ClipPaintPropertyNode* clip() const { | 45 const ClipPaintPropertyNode* clip() const { |
| 47 DCHECK(!m_clip || !m_clip->hasOneRef()); | 46 DCHECK(!m_clip || !m_clip->hasOneRef()); |
| 48 return m_clip.get(); | 47 return m_clip.get(); |
| 49 } | 48 } |
| 50 void setClip(const ClipPaintPropertyNode* node) { | 49 void setClip(PassRefPtr<const ClipPaintPropertyNode> node) { m_clip = node; } |
| 51 m_clip = node; | |
| 52 DCHECK(!node->hasOneRef()); | |
| 53 } | |
| 54 | 50 |
| 55 const EffectPaintPropertyNode* effect() const { | 51 const EffectPaintPropertyNode* effect() const { |
| 56 DCHECK(!m_effect || !m_effect->hasOneRef()); | 52 DCHECK(!m_effect || !m_effect->hasOneRef()); |
| 57 return m_effect.get(); | 53 return m_effect.get(); |
| 58 } | 54 } |
| 59 void setEffect(const EffectPaintPropertyNode* node) { | 55 void setEffect(PassRefPtr<const EffectPaintPropertyNode> node) { |
| 60 m_effect = node; | 56 m_effect = node; |
| 61 DCHECK(!node->hasOneRef()); | |
| 62 } | 57 } |
| 63 | 58 |
| 64 const ScrollPaintPropertyNode* scroll() const { | 59 const ScrollPaintPropertyNode* scroll() const { |
| 65 DCHECK(!m_scroll || !m_scroll->hasOneRef()); | 60 DCHECK(!m_scroll || !m_scroll->hasOneRef()); |
| 66 return m_scroll.get(); | 61 return m_scroll.get(); |
| 67 } | 62 } |
| 68 void setScroll(const ScrollPaintPropertyNode* node) { | 63 void setScroll(PassRefPtr<const ScrollPaintPropertyNode> node) { |
| 69 m_scroll = node; | 64 m_scroll = node; |
| 70 DCHECK(!node->hasOneRef()); | |
| 71 } | 65 } |
| 72 | 66 |
| 73 private: | 67 private: |
| 74 RefPtr<const TransformPaintPropertyNode> m_transform; | 68 RefPtr<const TransformPaintPropertyNode> m_transform; |
| 75 RefPtr<const ClipPaintPropertyNode> m_clip; | 69 RefPtr<const ClipPaintPropertyNode> m_clip; |
| 76 RefPtr<const EffectPaintPropertyNode> m_effect; | 70 RefPtr<const EffectPaintPropertyNode> m_effect; |
| 77 RefPtr<const ScrollPaintPropertyNode> m_scroll; | 71 RefPtr<const ScrollPaintPropertyNode> m_scroll; |
| 78 }; | 72 }; |
| 79 | 73 |
| 80 inline bool operator==(const PropertyTreeState& a, const PropertyTreeState& b) { | 74 inline bool operator==(const PropertyTreeState& a, const PropertyTreeState& b) { |
| 81 return a.transform() == b.transform() && a.clip() == b.clip() && | 75 return a.transform() == b.transform() && a.clip() == b.clip() && |
| 82 a.effect() == b.effect() && a.scroll() == b.scroll(); | 76 a.effect() == b.effect() && a.scroll() == b.scroll(); |
| 83 } | 77 } |
| 84 | 78 |
| 85 } // namespace blink | 79 } // namespace blink |
| 86 | 80 |
| 87 #endif // PropertyTreeState_h | 81 #endif // PropertyTreeState_h |
| OLD | NEW |