Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h

Issue 2766943002: Do-not-commit: Count layout tree memory usage
Patch Set: Rebase, add object paint property counter Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 ObjectPaintProperties_h 5 #ifndef ObjectPaintProperties_h
6 #define ObjectPaintProperties_h 6 #define ObjectPaintProperties_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/geometry/LayoutPoint.h" 9 #include "platform/geometry/LayoutPoint.h"
10 #include "platform/graphics/paint/ClipPaintPropertyNode.h" 10 #include "platform/graphics/paint/ClipPaintPropertyNode.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // 2. It preserves existing child->parent pointers. 44 // 2. It preserves existing child->parent pointers.
45 class CORE_EXPORT ObjectPaintProperties { 45 class CORE_EXPORT ObjectPaintProperties {
46 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); 46 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties);
47 USING_FAST_MALLOC(ObjectPaintProperties); 47 USING_FAST_MALLOC(ObjectPaintProperties);
48 48
49 public: 49 public:
50 static std::unique_ptr<ObjectPaintProperties> create() { 50 static std::unique_ptr<ObjectPaintProperties> create() {
51 return WTF::wrapUnique(new ObjectPaintProperties()); 51 return WTF::wrapUnique(new ObjectPaintProperties());
52 } 52 }
53 53
54 char heapMemoryUsage() const {
55 char memory = 0;
56 if (m_paintOffsetTranslation)
57 memory += sizeof(TransformPaintPropertyNode);
58 if (m_transform)
59 memory += sizeof(TransformPaintPropertyNode);
60 if (m_effect)
61 memory += sizeof(EffectPaintPropertyNode);
62 if (m_filter)
63 memory += sizeof(EffectPaintPropertyNode);
64 if (m_mask)
65 memory += sizeof(EffectPaintPropertyNode);
66 if (m_maskClip)
67 memory += sizeof(ClipPaintPropertyNode);
68 if (m_cssClip)
69 memory += sizeof(ClipPaintPropertyNode);
70 if (m_cssClipFixedPosition)
71 memory += sizeof(ClipPaintPropertyNode);
72 if (m_innerBorderRadiusClip)
73 memory += sizeof(ClipPaintPropertyNode);
74 if (m_overflowClip)
75 memory += sizeof(ClipPaintPropertyNode);
76 if (m_perspective)
77 memory += sizeof(TransformPaintPropertyNode);
78 if (m_svgLocalToBorderBoxTransform)
79 memory += sizeof(TransformPaintPropertyNode);
80 if (m_scrollTranslation) {
81 memory += sizeof(TransformPaintPropertyNode);
82 memory += sizeof(ScrollPaintPropertyNode);
83 }
84 if (m_scrollbarPaintOffset)
85 memory += sizeof(TransformPaintPropertyNode);
86 if (m_localBorderBoxProperties)
87 memory += sizeof(PropertyTreeState);
88 if (m_contentsProperties)
89 memory += sizeof(PropertyTreeState);
90 return memory;
91 }
92
93 bool hasContentsProperties() const { return !!m_contentsProperties; }
94
54 // The hierarchy of the transform subtree created by a LayoutObject is as 95 // The hierarchy of the transform subtree created by a LayoutObject is as
55 // follows: 96 // follows:
56 // [ paintOffsetTranslation ] Normally paint offset is accumulated 97 // [ paintOffsetTranslation ] Normally paint offset is accumulated
57 // | without creating a node until we see, 98 // | without creating a node until we see,
58 // | for example, transform or 99 // | for example, transform or
59 // | position:fixed. 100 // | position:fixed.
60 // +---[ transform ] The space created by CSS transform. 101 // +---[ transform ] The space created by CSS transform.
61 // | This is the local border box space, 102 // | This is the local border box space,
62 // | see: localBorderBoxProperties below. 103 // | see: localBorderBoxProperties below.
63 // +---[ perspective ] The space created by CSS perspective. 104 // +---[ perspective ] The space created by CSS perspective.
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 417 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
377 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; 418 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset;
378 419
379 std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties; 420 std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties;
380 mutable std::unique_ptr<PropertyTreeState> m_contentsProperties; 421 mutable std::unique_ptr<PropertyTreeState> m_contentsProperties;
381 }; 422 };
382 423
383 } // namespace blink 424 } // namespace blink
384 425
385 #endif // ObjectPaintProperties_h 426 #endif // ObjectPaintProperties_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698