| 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 #include "platform/graphics/paint/DisplayItemList.h" | 5 #include "platform/graphics/paint/DisplayItemList.h" |
| 6 | 6 |
| 7 #include "platform/graphics/paint/DrawingDisplayItem.h" | 7 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 8 #include "platform/graphics/paint/PaintChunk.h" | 8 #include "platform/graphics/paint/PaintChunk.h" |
| 9 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 9 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
| 10 | 10 |
| 11 #ifndef NDEBUG | 11 #ifndef NDEBUG |
| 12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 DisplayItem& DisplayItemList::appendByMoving(DisplayItem& item) | 17 DisplayItem& DisplayItemList::appendByMoving(DisplayItem& item) |
| 18 { | 18 { |
| 19 #ifndef NDEBUG | 19 #ifndef NDEBUG |
| 20 String originalDebugString = item.asDebugString(); | 20 String originalDebugString = item.asDebugString(); |
| 21 #endif | 21 #endif |
| 22 ASSERT(item.hasValidClient()); | 22 DCHECK(!item.hasBeenMoved()); |
| 23 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derived
Size()); | 23 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derived
Size(), size()); |
| 24 // ContiguousContainer::appendByMoving() calls an in-place constructor | 24 // ContiguousContainer::appendByMoving() calls an in-place constructor |
| 25 // on item which replaces it with a tombstone/"dead display item" that | 25 // DisplayItem(size_t) to create a placeholder of type HasBeenMoved in |
| 26 // can be safely destructed but should never be used. | 26 // place of the original item. |
| 27 ASSERT(!item.hasValidClient()); | 27 DCHECK(item.hasBeenMoved()); |
| 28 #ifndef NDEBUG | 28 #ifndef NDEBUG |
| 29 // Save original debug string in the old item to help debugging. | 29 // Save original debug string in the old item to help debugging. |
| 30 item.setClientDebugString(originalDebugString); | 30 item.setClientDebugString(originalDebugString); |
| 31 #endif | 31 #endif |
| 32 return result; | 32 return result; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void DisplayItemList::appendVisualRect(const IntRect& visualRect) | 35 void DisplayItemList::appendVisualRect(const IntRect& visualRect) |
| 36 { | 36 { |
| 37 m_visualRects.append(visualRect); | 37 m_visualRects.append(visualRect); |
| 38 } | 38 } |
| 39 | 39 |
| 40 DisplayItemList::Range<DisplayItemList::iterator> | 40 DisplayItemList::Range<DisplayItemList::iterator> |
| 41 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) | 41 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) |
| 42 { | 42 { |
| 43 return Range<iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk
.endIndex); | 43 return Range<iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk
.endIndex); |
| 44 } | 44 } |
| 45 | 45 |
| 46 DisplayItemList::Range<DisplayItemList::const_iterator> | 46 DisplayItemList::Range<DisplayItemList::const_iterator> |
| 47 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const | 47 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const |
| 48 { | 48 { |
| 49 return Range<const_iterator>(begin() + paintChunk.beginIndex, begin() + pain
tChunk.endIndex); | 49 return Range<const_iterator>(begin() + paintChunk.beginIndex, begin() + pain
tChunk.endIndex); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace blink | 52 } // namespace blink |
| OLD | NEW |