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(RefPtr<const TransformPaintPropertyNode> node) { |
42 m_transform = node; | 42 m_transform = std::move(node); |
43 DCHECK(!node->hasOneRef()); | |
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(RefPtr<const ClipPaintPropertyNode> node) { |
51 m_clip = node; | 50 m_clip = std::move(node); |
52 DCHECK(!node->hasOneRef()); | |
53 } | 51 } |
54 | 52 |
55 const EffectPaintPropertyNode* effect() const { | 53 const EffectPaintPropertyNode* effect() const { |
56 DCHECK(!m_effect || !m_effect->hasOneRef()); | 54 DCHECK(!m_effect || !m_effect->hasOneRef()); |
57 return m_effect.get(); | 55 return m_effect.get(); |
58 } | 56 } |
59 void setEffect(const EffectPaintPropertyNode* node) { | 57 void setEffect(RefPtr<const EffectPaintPropertyNode> node) { |
60 m_effect = node; | 58 m_effect = std::move(node); |
61 DCHECK(!node->hasOneRef()); | |
62 } | 59 } |
63 | 60 |
64 const ScrollPaintPropertyNode* scroll() const { | 61 const ScrollPaintPropertyNode* scroll() const { |
65 DCHECK(!m_scroll || !m_scroll->hasOneRef()); | 62 DCHECK(!m_scroll || !m_scroll->hasOneRef()); |
66 return m_scroll.get(); | 63 return m_scroll.get(); |
67 } | 64 } |
68 void setScroll(const ScrollPaintPropertyNode* node) { | 65 void setScroll(RefPtr<const ScrollPaintPropertyNode> node) { |
69 m_scroll = node; | 66 m_scroll = std::move(node); |
70 DCHECK(!node->hasOneRef()); | |
71 } | 67 } |
72 | 68 |
73 private: | 69 private: |
74 RefPtr<const TransformPaintPropertyNode> m_transform; | 70 RefPtr<const TransformPaintPropertyNode> m_transform; |
75 RefPtr<const ClipPaintPropertyNode> m_clip; | 71 RefPtr<const ClipPaintPropertyNode> m_clip; |
76 RefPtr<const EffectPaintPropertyNode> m_effect; | 72 RefPtr<const EffectPaintPropertyNode> m_effect; |
77 RefPtr<const ScrollPaintPropertyNode> m_scroll; | 73 RefPtr<const ScrollPaintPropertyNode> m_scroll; |
78 }; | 74 }; |
79 | 75 |
80 inline bool operator==(const PropertyTreeState& a, const PropertyTreeState& b) { | 76 inline bool operator==(const PropertyTreeState& a, const PropertyTreeState& b) { |
81 return a.transform() == b.transform() && a.clip() == b.clip() && | 77 return a.transform() == b.transform() && a.clip() == b.clip() && |
82 a.effect() == b.effect() && a.scroll() == b.scroll(); | 78 a.effect() == b.effect() && a.scroll() == b.scroll(); |
83 } | 79 } |
84 | 80 |
85 } // namespace blink | 81 } // namespace blink |
86 | 82 |
87 #endif // PropertyTreeState_h | 83 #endif // PropertyTreeState_h |
OLD | NEW |