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

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

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 | « third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "platform/graphics/paint/DisplayItemList.h" 5 #include "platform/graphics/paint/DisplayItemList.h"
6 6
7 #include "platform/graphics/paint/PaintChunk.h" 7 #include "platform/graphics/paint/PaintChunk.h"
8 8
9 #ifndef NDEBUG
10 #include "wtf/text/WTFString.h"
11 #endif
12
9 namespace blink { 13 namespace blink {
10 14
15 DisplayItem& DisplayItemList::appendByMoving(DisplayItem& item, const IntRect& v isualRect)
16 {
17 #ifndef NDEBUG
18 String originalDebugString = item.asDebugString();
19 #endif
20 ASSERT(item.hasValidClient());
21 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derived Size());
22 // ContiguousContainer::appendByMoving() calls an in-place constructor
23 // on item which replaces it with a tombstone/"dead display item" that
24 // can be safely destructed but should never be used.
25 ASSERT(!item.hasValidClient());
26 #ifndef NDEBUG
27 // Save original debug string in the old item to help debugging.
28 item.setClientDebugString(originalDebugString);
29 #endif
30 appendVisualRect(visualRect);
31 return result;
32 }
33
34 #if ENABLE(ASSERT)
35 void DisplayItemList::assertDisplayItemClientsAreAlive() const
36 {
37 for (auto& item : *this) {
38 #ifdef NDEBUG
39 DCHECK(DisplayItemClient::isAlive(item.client())) << "Short-lived Displa yItemClient. See crbug.com/570030.";
40 #else
41 DCHECK(DisplayItemClient::isAlive(item.client())) << "Short-lived Displa yItemClient: " << item.clientDebugString() << ". See crbug.com/570030.";
42 #endif
43 }
44 }
45 #endif
46
11 void DisplayItemList::appendVisualRect(const IntRect& visualRect) 47 void DisplayItemList::appendVisualRect(const IntRect& visualRect)
12 { 48 {
13 size_t itemIndex = m_visualRects.size(); 49 size_t itemIndex = m_visualRects.size();
14 const DisplayItem& item = (*this)[itemIndex]; 50 const DisplayItem& item = (*this)[itemIndex];
15 51
16 // For paired display items such as transforms, since we are not guaranteed containment, the 52 // For paired display items such as transforms, since we are not guaranteed containment, the
17 // visual rect must comprise the union of the visual rects for all items wit hin its block. 53 // visual rect must comprise the union of the visual rects for all items wit hin its block.
18 54
19 if (item.isBegin()) { 55 if (item.isBegin()) {
20 m_visualRects.append(visualRect); 56 m_visualRects.append(visualRect);
(...skipping 27 matching lines...) Expand all
48 return Range<iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk .endIndex); 84 return Range<iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk .endIndex);
49 } 85 }
50 86
51 DisplayItemList::Range<DisplayItemList::const_iterator> 87 DisplayItemList::Range<DisplayItemList::const_iterator>
52 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const 88 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const
53 { 89 {
54 return Range<const_iterator>(begin() + paintChunk.beginIndex, begin() + pain tChunk.endIndex); 90 return Range<const_iterator>(begin() + paintChunk.beginIndex, begin() + pain tChunk.endIndex);
55 } 91 }
56 92
57 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698