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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h

Issue 1812153002: Move DisplayItemList complex inline method implementations to .cpp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head. Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 DisplayItemList_h 5 #ifndef DisplayItemList_h
6 #define DisplayItemList_h 6 #define DisplayItemList_h
7 7
8 #include "platform/graphics/ContiguousContainer.h" 8 #include "platform/graphics/ContiguousContainer.h"
9 #include "platform/graphics/paint/DisplayItem.h" 9 #include "platform/graphics/paint/DisplayItem.h"
10 #include "platform/graphics/paint/Transform3DDisplayItem.h" 10 #include "platform/graphics/paint/Transform3DDisplayItem.h"
11 #include "wtf/Alignment.h" 11 #include "wtf/Alignment.h"
12 #include "wtf/Assertions.h" 12 #include "wtf/Assertions.h"
13 13
14 #ifndef NDEBUG
15 #include "wtf/text/WTFString.h"
16 #endif
17
18 namespace blink { 14 namespace blink {
19 15
20 struct PaintChunk; 16 struct PaintChunk;
21 17
22 // kDisplayItemAlignment must be a multiple of alignof(derived display item) for 18 // kDisplayItemAlignment must be a multiple of alignof(derived display item) for
23 // each derived display item; the ideal value is the least common multiple. 19 // each derived display item; the ideal value is the least common multiple.
24 // Currently the limiting factor is TransformationMatrix (in 20 // Currently the limiting factor is TransformationMatrix (in
25 // BeginTransform3DDisplayItem), which requests 16-byte alignment. 21 // BeginTransform3DDisplayItem), which requests 16-byte alignment.
26 static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplay Item); 22 static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplay Item);
27 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem ); 23 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem );
(...skipping 10 matching lines...) Expand all
38 {} 34 {}
39 35
40 DisplayItemList& operator=(DisplayItemList&& source) 36 DisplayItemList& operator=(DisplayItemList&& source)
41 { 37 {
42 ContiguousContainer::operator=(std::move(source)); 38 ContiguousContainer::operator=(std::move(source));
43 m_visualRects = std::move(source.m_visualRects); 39 m_visualRects = std::move(source.m_visualRects);
44 m_beginItemIndices = std::move(source.m_beginItemIndices); 40 m_beginItemIndices = std::move(source.m_beginItemIndices);
45 return *this; 41 return *this;
46 } 42 }
47 43
48 DisplayItem& appendByMoving(DisplayItem& item, const IntRect& visualRect) 44 DisplayItem& appendByMoving(DisplayItem&, const IntRect& visualRect);
49 {
50 #ifndef NDEBUG
51 WTF::String originalDebugString = item.asDebugString();
52 #endif
53 ASSERT(item.hasValidClient());
54 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.der ivedSize());
55 // ContiguousContainer::appendByMoving() calls an in-place constructor
56 // on item which replaces it with a tombstone/"dead display item" that
57 // can be safely destructed but should never be used.
58 ASSERT(!item.hasValidClient());
59 #ifndef NDEBUG
60 // Save original debug string in the old item to help debugging.
61 item.setClientDebugString(originalDebugString);
62 #endif
63 appendVisualRect(visualRect);
64 return result;
65 }
66 45
67 IntRect visualRect(unsigned index) const 46 IntRect visualRect(unsigned index) const
68 { 47 {
69 ASSERT(index < m_visualRects.size()); 48 ASSERT(index < m_visualRects.size());
70 return m_visualRects[index]; 49 return m_visualRects[index];
71 } 50 }
72 51
73 void appendVisualRect(const IntRect& visualRect); 52 void appendVisualRect(const IntRect& visualRect);
74 53
75 #if ENABLE(ASSERT) 54 #if ENABLE(ASSERT)
76 void assertDisplayItemClientsAreAlive() const 55 void assertDisplayItemClientsAreAlive() const;
77 {
78 for (auto& item : *this) {
79 #ifdef NDEBUG
80 DCHECK(DisplayItemClient::isAlive(item.client())) << "Short-lived Di splayItemClient. See crbug.com/570030.";
81 #else
82 DCHECK(DisplayItemClient::isAlive(item.client())) << "Short-lived Di splayItemClient: " << item.clientDebugString() << ". See crbug.com/570030.";
83 #endif
84 }
85 }
86 #endif 56 #endif
87 57
88 // Useful for iterating with a range-based for loop. 58 // Useful for iterating with a range-based for loop.
89 template <typename Iterator> 59 template <typename Iterator>
90 class Range { 60 class Range {
91 public: 61 public:
92 Range(const Iterator& begin, const Iterator& end) 62 Range(const Iterator& begin, const Iterator& end)
93 : m_begin(begin), m_end(end) {} 63 : m_begin(begin), m_end(end) {}
94 Iterator begin() const { return m_begin; } 64 Iterator begin() const { return m_begin; }
95 Iterator end() const { return m_end; } 65 Iterator end() const { return m_end; }
96 private: 66 private:
97 Iterator m_begin; 67 Iterator m_begin;
98 Iterator m_end; 68 Iterator m_end;
99 }; 69 };
100 Range<iterator> itemsInPaintChunk(const PaintChunk&); 70 Range<iterator> itemsInPaintChunk(const PaintChunk&);
101 Range<const_iterator> itemsInPaintChunk(const PaintChunk&) const; 71 Range<const_iterator> itemsInPaintChunk(const PaintChunk&) const;
102 72
103 private: 73 private:
104 // If we're currently within a paired display item block, unions the 74 // If we're currently within a paired display item block, unions the
105 // given visual rect with the begin display item's visual rect. 75 // given visual rect with the begin display item's visual rect.
106 void growCurrentBeginItemVisualRect(const IntRect& visualRect); 76 void growCurrentBeginItemVisualRect(const IntRect& visualRect);
107 77
108 Vector<IntRect> m_visualRects; 78 Vector<IntRect> m_visualRects;
109 Vector<size_t> m_beginItemIndices; 79 Vector<size_t> m_beginItemIndices;
110 }; 80 };
111 81
112 } // namespace blink 82 } // namespace blink
113 83
114 #endif // DisplayItemList_h 84 #endif // DisplayItemList_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698