Commit 253ef880 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[rm-for-spv175] Cleanup DisplayItem and PaintController about paired display items

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I3524d99338e48de260f1ff7acf7fa2cda537ed10
Reviewed-on: https://chromium-review.googlesource.com/1112313
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569897}
parent 807c7cf8
......@@ -115,7 +115,7 @@ struct CORE_EXPORT PaintInfo {
}
DisplayItem::Type DisplayItemTypeForClipping() const {
return DisplayItem::PaintPhaseToClipBoxType(phase);
return DisplayItem::PaintPhaseToClipType(phase);
}
const LayoutBoxModelObject* PaintContainer() const {
......
......@@ -985,7 +985,7 @@ void PaintLayerPainter::PaintOverflowControlsForFragments(
fragment_paint_chunk_properties.emplace(
context.GetPaintController(),
fragment.fragment_data->LocalBorderBoxProperties(), paint_layer_,
DisplayItem::kScrollOverflowControls);
DisplayItem::kOverflowControls);
}
// We need to apply the same clips and transforms that
......
......@@ -183,9 +183,9 @@ void ScrollableAreaPainter::PaintOverflowControls(
DCHECK(properties);
if (properties) {
if (const auto* clip = properties->OverflowControlsClip()) {
scoped_paint_chunk_properties.emplace(
context.GetPaintController(), clip, box,
DisplayItem::kClipLayerOverflowControls);
scoped_paint_chunk_properties.emplace(context.GetPaintController(), clip,
box,
DisplayItem::kOverflowControls);
}
}
......
......@@ -373,8 +373,7 @@ bool GraphicsLayer::Paint(const IntRect* interest_rect,
if (auto record = tracking.UnderInvalidationRecord()) {
// Add the under-invalidation overlay onto the painted result.
GetPaintController().AppendDebugDrawingAfterCommit(
*this, std::move(record),
layer_state_ ? &layer_state_->state : nullptr);
*this, std::move(record), layer_state_->state);
// Ensure the compositor will raster the under-invalidation overlay.
layer_->SetNeedsDisplay();
}
......
......@@ -81,6 +81,7 @@ static WTF::String SpecialDrawingTypeAsDebugString(DisplayItem::Type type) {
DEBUG_STRING_CASE(SVGImage);
DEBUG_STRING_CASE(LinkHighlight);
DEBUG_STRING_CASE(ImageAreaFocusRing);
DEBUG_STRING_CASE(OverflowControls);
DEBUG_STRING_CASE(PageOverlay);
DEBUG_STRING_CASE(PopupContainerBorder);
DEBUG_STRING_CASE(PopupListBoxBackground);
......@@ -131,50 +132,6 @@ static String ForeignLayerTypeAsDebugString(DisplayItem::Type type) {
}
}
static String ScrollHitTestTypeAsDebugString(DisplayItem::Type type) {
switch (type) {
DEBUG_STRING_CASE(ScrollHitTest);
DEFAULT_CASE;
}
}
static WTF::String ClipTypeAsDebugString(DisplayItem::Type type) {
PAINT_PHASE_BASED_DEBUG_STRINGS(ClipBox);
PAINT_PHASE_BASED_DEBUG_STRINGS(ClipColumnBounds);
PAINT_PHASE_BASED_DEBUG_STRINGS(ClipLayerFragment);
switch (type) {
DEBUG_STRING_CASE(ClipFileUploadControlRect);
DEBUG_STRING_CASE(ClipFrameToVisibleContentRect);
DEBUG_STRING_CASE(ClipFrameScrollbars);
DEBUG_STRING_CASE(ClipLayerBackground);
DEBUG_STRING_CASE(ClipLayerColumnBounds);
DEBUG_STRING_CASE(ClipLayerFilter);
DEBUG_STRING_CASE(ClipLayerForeground);
DEBUG_STRING_CASE(ClipLayerParent);
DEBUG_STRING_CASE(ClipLayerOverflowControls);
DEBUG_STRING_CASE(ClipPopupListBoxFrame);
DEBUG_STRING_CASE(ClipScrollbarsToBoxBounds);
DEBUG_STRING_CASE(ClipSelectionImage);
DEFAULT_CASE;
}
}
static String ScrollTypeAsDebugString(DisplayItem::Type type) {
PAINT_PHASE_BASED_DEBUG_STRINGS(Scroll);
switch (type) {
DEBUG_STRING_CASE(ScrollOverflowControls);
DEFAULT_CASE;
}
}
static String Transform3DTypeAsDebugString(DisplayItem::Type type) {
switch (type) {
DEBUG_STRING_CASE(Transform3DElementTransform);
DEFAULT_CASE;
}
}
WTF::String DisplayItem::TypeAsDebugString(Type type) {
if (IsDrawingType(type))
return DrawingTypeAsDebugString(type);
......@@ -182,43 +139,13 @@ WTF::String DisplayItem::TypeAsDebugString(Type type) {
if (IsForeignLayerType(type))
return ForeignLayerTypeAsDebugString(type);
if (IsClipType(type))
return ClipTypeAsDebugString(type);
if (IsEndClipType(type))
return "End" + ClipTypeAsDebugString(endClipTypeToClipType(type));
PAINT_PHASE_BASED_DEBUG_STRINGS(FloatClip);
if (type == kFloatClipClipPathBounds)
return "FloatClipClipPathBounds";
if (IsEndFloatClipType(type))
return "End" + TypeAsDebugString(endFloatClipTypeToFloatClipType(type));
if (IsScrollType(type))
return ScrollTypeAsDebugString(type);
if (IsEndScrollType(type))
return "End" + ScrollTypeAsDebugString(endScrollTypeToScrollType(type));
PAINT_PHASE_BASED_DEBUG_STRINGS(Clip);
PAINT_PHASE_BASED_DEBUG_STRINGS(Scroll);
PAINT_PHASE_BASED_DEBUG_STRINGS(SVGTransform);
PAINT_PHASE_BASED_DEBUG_STRINGS(SVGEffect);
if (IsTransform3DType(type))
return Transform3DTypeAsDebugString(type);
if (IsEndTransform3DType(type))
return "End" + Transform3DTypeAsDebugString(
endTransform3DTypeToTransform3DType(type));
if (IsScrollHitTestType(type))
return ScrollHitTestTypeAsDebugString(type);
switch (type) {
DEBUG_STRING_CASE(BeginFilter);
DEBUG_STRING_CASE(EndFilter);
DEBUG_STRING_CASE(BeginCompositing);
DEBUG_STRING_CASE(EndCompositing);
DEBUG_STRING_CASE(BeginTransform);
DEBUG_STRING_CASE(EndTransform);
DEBUG_STRING_CASE(BeginClipPath);
DEBUG_STRING_CASE(EndClipPath);
DEBUG_STRING_CASE(ScrollHitTest);
DEBUG_STRING_CASE(LayerChunkBackground);
DEBUG_STRING_CASE(LayerChunkNegativeZOrderChildren);
DEBUG_STRING_CASE(LayerChunkDescendantBackgrounds);
......
......@@ -84,6 +84,7 @@ class PLATFORM_EXPORT DisplayItem {
kSVGImage,
kLinkHighlight,
kImageAreaFocusRing,
kOverflowControls,
kPageOverlay,
kPopupContainerBorder,
kPopupListBoxBackground,
......@@ -127,47 +128,11 @@ class PLATFORM_EXPORT DisplayItem {
kForeignLayerContentsWrapper,
kForeignLayerLast = kForeignLayerContentsWrapper,
kClipFirst,
kClipBoxPaintPhaseFirst = kClipFirst,
kClipBoxPaintPhaseLast = kClipBoxPaintPhaseFirst + kPaintPhaseMax,
kClipColumnBoundsPaintPhaseFirst,
kClipColumnBoundsPaintPhaseLast =
kClipColumnBoundsPaintPhaseFirst + kPaintPhaseMax,
kClipLayerFragmentPaintPhaseFirst,
kClipLayerFragmentPaintPhaseLast =
kClipLayerFragmentPaintPhaseFirst + kPaintPhaseMax,
kClipFileUploadControlRect,
kClipFrameToVisibleContentRect,
kClipFrameScrollbars,
kClipLayerBackground,
kClipLayerColumnBounds,
kClipLayerFilter,
kClipLayerForeground,
kClipLayerParent,
kClipLayerOverflowControls,
kClipPopupListBoxFrame,
kClipScrollbarsToBoxBounds,
kClipSelectionImage,
kClipLast = kClipSelectionImage,
kEndClipFirst,
kEndClipLast = kEndClipFirst + kClipLast - kClipFirst,
kFloatClipFirst,
kFloatClipPaintPhaseFirst = kFloatClipFirst,
kFloatClipPaintPhaseLast = kFloatClipFirst + kPaintPhaseMax,
kFloatClipClipPathBounds,
kFloatClipLast = kFloatClipClipPathBounds,
kEndFloatClipFirst,
kEndFloatClipLast = kEndFloatClipFirst + kFloatClipLast - kFloatClipFirst,
kScrollFirst,
kScrollPaintPhaseFirst = kScrollFirst,
kClipPaintPhaseFirst,
kClipPaintPhaseLast = kClipPaintPhaseFirst + kPaintPhaseMax,
kScrollPaintPhaseFirst,
kScrollPaintPhaseLast = kScrollPaintPhaseFirst + kPaintPhaseMax,
kScrollOverflowControls,
kScrollLast = kScrollOverflowControls,
kEndScrollFirst,
kEndScrollLast = kEndScrollFirst + kScrollLast - kScrollFirst,
kSVGTransformPaintPhaseFirst,
kSVGTransformPaintPhaseLast = kSVGTransformPaintPhaseFirst + kPaintPhaseMax,
......@@ -175,21 +140,6 @@ class PLATFORM_EXPORT DisplayItem {
kSVGEffectPaintPhaseFirst,
kSVGEffectPaintPhaseLast = kSVGEffectPaintPhaseFirst + kPaintPhaseMax,
kTransform3DFirst,
kTransform3DElementTransform = kTransform3DFirst,
kTransform3DLast = kTransform3DElementTransform,
kEndTransform3DFirst,
kEndTransform3DLast =
kEndTransform3DFirst + kTransform3DLast - kTransform3DFirst,
kBeginFilter,
kEndFilter,
kBeginCompositing,
kEndCompositing,
kBeginTransform,
kEndTransform,
kBeginClipPath,
kEndClipPath,
kScrollHitTest,
kLayerChunkBackground,
......@@ -308,11 +258,6 @@ class PLATFORM_EXPORT DisplayItem {
k##Category1##First); \
}
#define DEFINE_PAIRED_CATEGORY_METHODS(Category, category) \
DEFINE_CATEGORY_METHODS(Category) \
DEFINE_CATEGORY_METHODS(End##Category) \
DEFINE_CONVERSION_METHODS(Category, category, End##Category, end##Category)
#define DEFINE_PAINT_PHASE_CONVERSION_METHOD(Category) \
static Type PaintPhaseTo##Category##Type(PaintPhase paint_phase) { \
static_assert( \
......@@ -329,22 +274,11 @@ class PLATFORM_EXPORT DisplayItem {
DEFINE_CATEGORY_METHODS(ForeignLayer)
DEFINE_PAIRED_CATEGORY_METHODS(Clip, clip)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(ClipLayerFragment)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(ClipBox)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(ClipColumnBounds)
DEFINE_PAIRED_CATEGORY_METHODS(FloatClip, floatClip)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(FloatClip)
DEFINE_PAIRED_CATEGORY_METHODS(Scroll, scroll)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(Clip)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(Scroll)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(SVGTransform)
DEFINE_PAINT_PHASE_CONVERSION_METHOD(SVGEffect)
DEFINE_PAIRED_CATEGORY_METHODS(Transform3D, transform3D)
static bool IsScrollHitTestType(Type type) { return type == kScrollHitTest; }
bool IsScrollHitTest() const { return IsScrollHitTestType(GetType()); }
......@@ -354,15 +288,6 @@ class PLATFORM_EXPORT DisplayItem {
return !SkippedCache() && IsCacheableType(GetType());
}
virtual bool IsBegin() const { return false; }
virtual bool IsEnd() const { return false; }
#if DCHECK_IS_ON()
virtual bool IsEndAndPairedWith(DisplayItem::Type other_type) const {
return false;
}
#endif
virtual bool Equals(const DisplayItem& other) const {
// Failure of this DCHECK would cause bad casts in subclasses.
SECURITY_CHECK(!is_tombstone_);
......@@ -418,36 +343,6 @@ inline bool operator!=(const DisplayItem::Id& a, const DisplayItem::Id& b) {
return !(a == b);
}
class PLATFORM_EXPORT PairedBeginDisplayItem : public DisplayItem {
protected:
PairedBeginDisplayItem(const DisplayItemClient& client,
Type type,
size_t derived_size)
: DisplayItem(client, type, derived_size) {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
}
private:
bool IsBegin() const final { return true; }
};
class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem {
protected:
PairedEndDisplayItem(const DisplayItemClient& client,
Type type,
size_t derived_size)
: DisplayItem(client, type, derived_size) {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
}
#if DCHECK_IS_ON()
bool IsEndAndPairedWith(DisplayItem::Type other_type) const override = 0;
#endif
private:
bool IsEnd() const final { return true; }
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_DISPLAY_ITEM_H_
......@@ -56,19 +56,6 @@ class PLATFORM_EXPORT DisplayItemList
return result;
}
// This is used by PaintUnderInvalidationChecking in SPv1 to restore a
// paired-begin display item that was moved to the new display item list then
// was removed because the pair is a no-op. This ensures that we won't compare
// the next new display item against the tombstone display item.
void RestoreTombstone(size_t index, DisplayItem& item) {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
DCHECK((*this)[index].IsTombstone());
SECURITY_CHECK((*this)[index].DerivedSize() == item.DerivedSize());
memcpy(static_cast<void*>(&(*this)[index]), static_cast<void*>(&item),
item.DerivedSize());
new (&item) DisplayItem;
}
// Useful for iterating with a range-based for loop.
template <typename Iterator>
class Range {
......
......@@ -212,56 +212,11 @@ void PaintController::EndSubsequence(const DisplayItemClient& client,
last_cached_subsequence_end_ = end;
}
bool PaintController::LastDisplayItemIsNoopBegin() const {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
if (new_display_item_list_.IsEmpty())
return false;
const auto& last_display_item = new_display_item_list_.Last();
return last_display_item.IsBegin() && !last_display_item.DrawsContent();
}
bool PaintController::LastDisplayItemIsSubsequenceEnd() const {
return !new_cached_subsequences_.IsEmpty() &&
last_cached_subsequence_end_ == new_display_item_list_.size();
}
void PaintController::RemoveLastDisplayItem() {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
if (new_display_item_list_.IsEmpty())
return;
#if DCHECK_IS_ON()
// Also remove the index pointing to the removed display item.
IndicesByClientMap::iterator it = new_display_item_indices_by_client_.find(
&new_display_item_list_.Last().Client());
if (it != new_display_item_indices_by_client_.end()) {
Vector<size_t>& indices = it->value;
if (!indices.IsEmpty() &&
indices.back() == (new_display_item_list_.size() - 1))
indices.pop_back();
}
#endif
if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() &&
IsCheckingUnderInvalidation()) {
if (skipped_probable_under_invalidation_count_) {
--skipped_probable_under_invalidation_count_;
} else {
DCHECK(under_invalidation_checking_begin_);
--under_invalidation_checking_begin_;
// The old display item is a tombstone because it was matched by the begin
// display item being removed. Restore the tombstone so that we can match
// the next new display item against it.
current_paint_artifact_.GetDisplayItemList().RestoreTombstone(
under_invalidation_checking_begin_, new_display_item_list_.Last());
}
}
new_display_item_list_.RemoveLast();
}
const DisplayItem* PaintController::LastDisplayItem(unsigned offset) {
if (offset < new_display_item_list_.size())
return &new_display_item_list_[new_display_item_list_.size() - offset - 1];
......@@ -279,10 +234,8 @@ void PaintController::ProcessNewItem(DisplayItem& display_item) {
&display_item.Client(), display_item.Client().DebugName());
}
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
size_t last_chunk_index = new_paint_chunks_.LastChunkIndex();
bool chunk_added =
new_paint_chunks_.IncrementDisplayItemIndex(display_item);
bool chunk_added = new_paint_chunks_.IncrementDisplayItemIndex(display_item);
auto& last_chunk = new_paint_chunks_.LastChunk();
#if DCHECK_IS_ON()
......@@ -302,17 +255,8 @@ void PaintController::ProcessNewItem(DisplayItem& display_item) {
last_chunk.outset_for_raster_effects =
std::max(last_chunk.outset_for_raster_effects,
display_item.OutsetForRasterEffects());
}
#if DCHECK_IS_ON()
// Verify noop begin/end pairs have been removed.
if (new_display_item_list_.size() >= 2 && display_item.IsEnd()) {
const auto& begin_display_item =
new_display_item_list_[new_display_item_list_.size() - 2];
if (begin_display_item.IsBegin() && !begin_display_item.DrawsContent())
DCHECK(!display_item.IsEndAndPairedWith(begin_display_item.GetType()));
}
if (display_item.IsCacheable()) {
size_t index = FindMatchingItemFromIndex(
display_item.GetId(), new_display_item_indices_by_client_,
......@@ -507,21 +451,13 @@ void PaintController::CopyCachedSubsequence(size_t begin_index,
DisplayItem* cached_item =
&current_paint_artifact_.GetDisplayItemList()[begin_index];
Vector<PaintChunk>::const_iterator cached_chunk;
base::Optional<PropertyTreeState> properties_before_subsequence;
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
cached_chunk =
auto* cached_chunk =
current_paint_artifact_.FindChunkByDisplayItemIndex(begin_index);
DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end());
properties_before_subsequence =
auto properties_before_subsequence =
new_paint_chunks_.CurrentPaintChunkProperties();
UpdateCurrentPaintChunkPropertiesUsingIdWithFragment(
cached_chunk->id, cached_chunk->properties.GetPropertyTreeState());
} else {
// Avoid uninitialized variable error on Windows.
cached_chunk = current_paint_artifact_.PaintChunks().begin();
}
for (size_t current_index = begin_index; current_index < end_index;
++current_index) {
......@@ -531,8 +467,7 @@ void PaintController::CopyCachedSubsequence(size_t begin_index,
DCHECK(cached_item->Client().IsAlive());
#endif
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled() &&
current_index == cached_chunk->end_index) {
if (current_index == cached_chunk->end_index) {
++cached_chunk;
DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end());
new_paint_chunks_.ForceNewChunk();
......@@ -554,22 +489,20 @@ void PaintController::CopyCachedSubsequence(size_t begin_index,
#endif
ProcessNewItem(MoveItemFromCurrentListToNewList(current_index));
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
DCHECK((!new_paint_chunks_.LastChunk().is_cacheable &&
!cached_chunk->is_cacheable) ||
new_paint_chunks_.LastChunk().Matches(*cached_chunk));
}
}
if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) {
under_invalidation_checking_end_ = end_index;
DCHECK(IsCheckingUnderInvalidation());
} else if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
} else {
// Restore properties and force new chunk for any trailing display items
// after the cached subsequence without new properties.
new_paint_chunks_.ForceNewChunk();
UpdateCurrentPaintChunkProperties(base::nullopt,
*properties_before_subsequence);
properties_before_subsequence);
}
}
......@@ -579,7 +512,6 @@ void PaintController::ResetCurrentListIndices() {
next_chunk_to_match_ = 0;
under_invalidation_checking_begin_ = 0;
under_invalidation_checking_end_ = 0;
skipped_probable_under_invalidation_count_ = 0;
}
DISABLE_CFI_PERF
......@@ -596,8 +528,7 @@ void PaintController::CommitNewDisplayItems() {
new_paint_chunk_indices_by_client_.clear();
#endif
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled() &&
!new_display_item_list_.IsEmpty())
if (!new_display_item_list_.IsEmpty())
GenerateRasterInvalidations(new_paint_chunks_.LastChunk());
auto old_cache_generation = current_cache_generation_;
......@@ -613,7 +544,6 @@ void PaintController::CommitNewDisplayItems() {
Vector<const DisplayItemClient*> skipped_cache_clients;
for (const auto& item : new_display_item_list_) {
const auto& client = item.Client();
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled())
client.ClearPartialInvalidationVisualRect();
if (item.IsCacheable()) {
......@@ -648,12 +578,10 @@ void PaintController::CommitNewDisplayItems() {
out_of_order_chunk_indices_.clear();
items_moved_into_new_list_.clear();
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
for (const auto& chunk : current_paint_artifact_.PaintChunks()) {
if (chunk.id.client.IsJustCreated())
chunk.id.client.ClearIsJustCreated();
}
}
// We'll allocate the initial buffer when we start the next paint.
new_display_item_list_ = DisplayItemList(0);
......@@ -724,7 +652,7 @@ size_t PaintController::ApproximateUnsharedMemoryUsage() const {
void PaintController::AppendDebugDrawingAfterCommit(
const DisplayItemClient& display_item_client,
sk_sp<const PaintRecord> record,
const PropertyTreeState* property_tree_state) {
const PropertyTreeState& property_tree_state) {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled());
DCHECK(new_display_item_list_.IsEmpty());
auto& display_item_list = current_paint_artifact_.GetDisplayItemList();
......@@ -733,17 +661,13 @@ void PaintController::AppendDebugDrawingAfterCommit(
display_item_client, DisplayItem::kDebugDrawing, std::move(record));
display_item.SetSkippedCache();
if (property_tree_state) {
DCHECK(RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
// Create a PaintChunk for the debug drawing.
current_paint_artifact_.PaintChunks().emplace_back(
display_item_list.size() - 1, display_item_list.size(),
display_item.GetId(), *property_tree_state);
}
display_item.GetId(), property_tree_state);
}
void PaintController::GenerateRasterInvalidations(PaintChunk& new_chunk) {
DCHECK(RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
if (new_chunk.begin_index >=
current_cached_subsequence_begin_index_in_new_list_)
return;
......@@ -821,8 +745,6 @@ void PaintController::TrackRasterInvalidation(const DisplayItemClient& client,
void PaintController::GenerateRasterInvalidationsComparingChunks(
PaintChunk& new_chunk,
const PaintChunk& old_chunk) {
DCHECK(RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
// TODO(wangxianzhu): Optimize paint offset change.
struct OldAndNewDisplayItems {
......@@ -1086,41 +1008,18 @@ void PaintController::CheckUnderInvalidation() {
return;
}
size_t old_item_index = under_invalidation_checking_begin_ +
skipped_probable_under_invalidation_count_;
size_t old_item_index = under_invalidation_checking_begin_;
DisplayItem* old_item =
old_item_index < current_paint_artifact_.GetDisplayItemList().size()
? &current_paint_artifact_.GetDisplayItemList()[old_item_index]
: nullptr;
bool old_and_new_equal = (old_item && new_item.Equals(*old_item));
if (!old_and_new_equal) {
if (new_item.IsBegin()) {
// Temporarily skip mismatching begin display item which may be removed
// when we remove a no-op pair.
++skipped_probable_under_invalidation_count_;
return;
}
if (new_item.IsDrawing() &&
skipped_probable_under_invalidation_count_ == 1) {
DCHECK_GE(new_display_item_list_.size(), 2u);
if (new_display_item_list_[new_display_item_list_.size() - 2].GetType() ==
DisplayItem::kBeginCompositing) {
// This might be a drawing item between a pair of begin/end compositing
// display items that will be folded into a single drawing display item.
++skipped_probable_under_invalidation_count_;
return;
}
}
}
if (skipped_probable_under_invalidation_count_ || !old_and_new_equal) {
if (!old_item || !new_item.Equals(*old_item)) {
// If we ever skipped reporting any under-invalidations, report the earliest
// one.
ShowUnderInvalidationError(
"under-invalidation: display item changed",
new_display_item_list_[new_display_item_list_.size() -
skipped_probable_under_invalidation_count_ - 1],
new_display_item_list_.Last(),
&current_paint_artifact_
.GetDisplayItemList()[under_invalidation_checking_begin_]);
CHECK(false);
......
......@@ -123,23 +123,6 @@ class PLATFORM_EXPORT PaintController {
ProcessNewItem(display_item);
}
// Creates and appends an ending display item to pair with a preceding
// beginning item iff the display item actually draws content. For no-op
// items, rather than creating an ending item, the begin item will
// instead be removed, thereby maintaining brevity of the list. If display
// item construction is disabled, no list mutations will be performed.
template <typename DisplayItemClass, typename... Args>
void EndItem(Args&&... args) {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
if (DisplayItemConstructionIsDisabled())
return;
if (LastDisplayItemIsNoopBegin())
RemoveLastDisplayItem();
else
CreateAndAppend<DisplayItemClass>(std::forward<Args>(args)...);
}
// Tries to find the cached drawing display item corresponding to the given
// parameters. If found, appends the cached display item to the new display
// list and returns true. Otherwise returns false.
......@@ -155,8 +138,6 @@ class PLATFORM_EXPORT PaintController {
// BeginSubsequence().
void EndSubsequence(const DisplayItemClient&, size_t start);
// True if the last display item is a begin that doesn't draw content.
void RemoveLastDisplayItem();
const DisplayItem* LastDisplayItem(unsigned offset);
void BeginSkippingCache() { ++skipping_cache_count_; }
......@@ -212,7 +193,7 @@ class PLATFORM_EXPORT PaintController {
void AppendDebugDrawingAfterCommit(const DisplayItemClient&,
sk_sp<const PaintRecord>,
const PropertyTreeState*);
const PropertyTreeState&);
#if DCHECK_IS_ON()
void ShowDebugData() const;
......@@ -277,8 +258,6 @@ class PLATFORM_EXPORT PaintController {
void InvalidateAllForTesting() { InvalidateAllInternal(); }
void InvalidateAllInternal();
bool LastDisplayItemIsNoopBegin() const;
void EnsureNewDisplayItemListInitialCapacity() {
if (new_display_item_list_.IsEmpty()) {
// TODO(wangxianzhu): Consider revisiting this heuristic.
......@@ -458,10 +437,6 @@ class PLATFORM_EXPORT PaintController {
size_t under_invalidation_checking_begin_;
size_t under_invalidation_checking_end_;
// Number of probable under-invalidations that have been skipped temporarily
// because the mismatching display items may be removed in the future because
// of no-op pairs or compositing folding.
int skipped_probable_under_invalidation_count_;
String under_invalidation_message_prefix_;
struct RasterInvalidationTrackingInfo {
......
......@@ -130,7 +130,7 @@ const DisplayItem::Type kForegroundType =
const DisplayItem::Type kDocumentBackgroundType =
DisplayItem::kDocumentBackground;
const DisplayItem::Type kScrollHitTestType = DisplayItem::kScrollHitTest;
const DisplayItem::Type kClipType = DisplayItem::kClipFirst;
const DisplayItem::Type kClipType = DisplayItem::kClipPaintPhaseFirst;
} // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment