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

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

Issue 2894093002: Don't access DisplayItemClient::VisualRect() for cached display items. (Closed)
Patch Set: - Created 3 years, 7 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 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/LoggingCanvas.h" 7 #include "platform/graphics/LoggingCanvas.h"
8 #include "platform/graphics/paint/DrawingDisplayItem.h" 8 #include "platform/graphics/paint/DrawingDisplayItem.h"
9 #include "platform/graphics/paint/PaintChunk.h" 9 #include "platform/graphics/paint/PaintChunk.h"
10 10
11 #ifndef NDEBUG 11 #ifndef NDEBUG
12 #include "platform/wtf/text/WTFString.h" 12 #include "platform/wtf/text/WTFString.h"
13 #endif 13 #endif
14 14
15 namespace blink { 15 namespace blink {
16 16
17 DisplayItem& DisplayItemList::AppendByMoving(DisplayItem& item) {
18 #ifndef NDEBUG
19 String original_debug_string = item.AsDebugString();
20 #endif
21 DCHECK(item.HasValidClient());
22 DisplayItem& result =
23 ContiguousContainer::AppendByMoving(item, item.DerivedSize());
24 // ContiguousContainer::appendByMoving() calls an in-place constructor
25 // on item which replaces it with a tombstone/"dead display item" that
26 // can be safely destructed but should never be used.
27 DCHECK(!item.HasValidClient());
28 #ifndef NDEBUG
29 // Save original debug string in the old item to help debugging.
30 item.SetClientDebugString(original_debug_string);
31 #endif
32 return result;
33 }
34
35 void DisplayItemList::AppendVisualRect(const IntRect& visual_rect) {
36 visual_rects_.push_back(visual_rect);
37 }
38
39 DisplayItemList::Range<DisplayItemList::iterator> 17 DisplayItemList::Range<DisplayItemList::iterator>
40 DisplayItemList::ItemsInPaintChunk(const PaintChunk& paint_chunk) { 18 DisplayItemList::ItemsInPaintChunk(const PaintChunk& paint_chunk) {
41 return Range<iterator>(begin() + paint_chunk.begin_index, 19 return Range<iterator>(begin() + paint_chunk.begin_index,
42 begin() + paint_chunk.end_index); 20 begin() + paint_chunk.end_index);
43 } 21 }
44 22
45 DisplayItemList::Range<DisplayItemList::const_iterator> 23 DisplayItemList::Range<DisplayItemList::const_iterator>
46 DisplayItemList::ItemsInPaintChunk(const PaintChunk& paint_chunk) const { 24 DisplayItemList::ItemsInPaintChunk(const PaintChunk& paint_chunk) const {
47 return Range<const_iterator>(begin() + paint_chunk.begin_index, 25 return Range<const_iterator>(begin() + paint_chunk.begin_index,
48 begin() + paint_chunk.end_index); 26 begin() + paint_chunk.end_index);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 #ifndef NDEBUG 69 #ifndef NDEBUG
92 if ((options & kShowPaintRecords) && display_item.IsDrawing()) { 70 if ((options & kShowPaintRecords) && display_item.IsDrawing()) {
93 const DrawingDisplayItem& item = 71 const DrawingDisplayItem& item =
94 static_cast<const DrawingDisplayItem&>(display_item); 72 static_cast<const DrawingDisplayItem&>(display_item);
95 if (const PaintRecord* record = item.GetPaintRecord().get()) { 73 if (const PaintRecord* record = item.GetPaintRecord().get()) {
96 json->SetString("record", RecordAsDebugString(record)); 74 json->SetString("record", RecordAsDebugString(record));
97 } 75 }
98 } 76 }
99 #endif 77 #endif
100 } 78 }
101 if (HasVisualRect(i)) { 79
102 IntRect local_visual_rect = VisualRect(i); 80 json->SetString("visualRect", display_item.VisualRect().ToString());
103 json->SetString( 81
104 "visualRect",
105 String::Format("[%d,%d %dx%d]", local_visual_rect.X(),
106 local_visual_rect.Y(), local_visual_rect.Width(),
107 local_visual_rect.Height()));
108 }
109 json_array->PushObject(std::move(json)); 82 json_array->PushObject(std::move(json));
110 } 83 }
111 return json_array; 84 return json_array;
112 } 85 }
113 86
114 } // namespace blink 87 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698