Commit ffdcd145 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[SPv175] Count paint invalidator and subsequence memory usage

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: If60370c0af378fa1d0a4f970d3cf3fe0f2f4925b
Reviewed-on: https://chromium-review.googlesource.com/1011234Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550410}
parent ef312307
...@@ -308,4 +308,9 @@ void CompositedLayerRasterInvalidator::Generate( ...@@ -308,4 +308,9 @@ void CompositedLayerRasterInvalidator::Generate(
} }
} }
size_t CompositedLayerRasterInvalidator::ApproximateUnsharedMemoryUsage()
const {
return sizeof(*this) + paint_chunks_info_.capacity() * sizeof(PaintChunkInfo);
}
} // namespace blink } // namespace blink
...@@ -46,6 +46,8 @@ class PLATFORM_EXPORT CompositedLayerRasterInvalidator { ...@@ -46,6 +46,8 @@ class PLATFORM_EXPORT CompositedLayerRasterInvalidator {
const gfx::Rect& LayerBounds() const { return layer_bounds_; } const gfx::Rect& LayerBounds() const { return layer_bounds_; }
size_t ApproximateUnsharedMemoryUsage() const;
private: private:
friend class CompositedLayerRasterInvalidatorTest; friend class CompositedLayerRasterInvalidatorTest;
......
...@@ -1437,7 +1437,11 @@ void GraphicsLayer::PaintContents(WebDisplayItemList* web_display_item_list, ...@@ -1437,7 +1437,11 @@ void GraphicsLayer::PaintContents(WebDisplayItemList* web_display_item_list,
} }
size_t GraphicsLayer::ApproximateUnsharedMemoryUsage() const { size_t GraphicsLayer::ApproximateUnsharedMemoryUsage() const {
return GetPaintController().ApproximateUnsharedMemoryUsage(); size_t result = sizeof(*this);
result += GetPaintController().ApproximateUnsharedMemoryUsage();
if (raster_invalidator_)
result += raster_invalidator_->ApproximateUnsharedMemoryUsage();
return result;
} }
bool ScopedSetNeedsDisplayInRectForTrackingOnly::s_enabled_ = false; bool ScopedSetNeedsDisplayInRectForTrackingOnly::s_enabled_ = false;
......
...@@ -679,7 +679,7 @@ void PaintController::CommitNewDisplayItems() { ...@@ -679,7 +679,7 @@ void PaintController::CommitNewDisplayItems() {
size_t PaintController::ApproximateUnsharedMemoryUsage() const { size_t PaintController::ApproximateUnsharedMemoryUsage() const {
size_t memory_usage = sizeof(*this); size_t memory_usage = sizeof(*this);
// Memory outside this class due to m_currentPaintArtifact. // Memory outside this class due to current_paint_artifact_.
memory_usage += current_paint_artifact_.ApproximateUnsharedMemoryUsage() - memory_usage += current_paint_artifact_.ApproximateUnsharedMemoryUsage() -
sizeof(current_paint_artifact_); sizeof(current_paint_artifact_);
...@@ -694,10 +694,18 @@ size_t PaintController::ApproximateUnsharedMemoryUsage() const { ...@@ -694,10 +694,18 @@ size_t PaintController::ApproximateUnsharedMemoryUsage() const {
// the rounded clips vector in ClipDisplayItem, which is not expected to // the rounded clips vector in ClipDisplayItem, which is not expected to
// contribute significantly to memory usage. // contribute significantly to memory usage.
// Memory outside this class due to m_newDisplayItemList. // Memory outside this class due to new_display_item_list_.
DCHECK(new_display_item_list_.IsEmpty()); DCHECK(new_display_item_list_.IsEmpty());
memory_usage += new_display_item_list_.MemoryUsageInBytes(); memory_usage += new_display_item_list_.MemoryUsageInBytes();
// Memory outside this class due to current_cached_subsequences_ and
// new_cached_subsequences_.
memory_usage += current_cached_subsequences_.Capacity() *
sizeof(*current_cached_subsequences_.begin());
DCHECK(new_cached_subsequences_.IsEmpty());
memory_usage += new_cached_subsequences_.Capacity() *
sizeof(*new_cached_subsequences_.begin());
return memory_usage; return memory_usage;
} }
......
...@@ -161,7 +161,7 @@ class PLATFORM_EXPORT PaintController { ...@@ -161,7 +161,7 @@ class PLATFORM_EXPORT PaintController {
// Returns the approximate memory usage, excluding memory likely to be // Returns the approximate memory usage, excluding memory likely to be
// shared with the embedder after copying to WebPaintController. // shared with the embedder after copying to WebPaintController.
// Should only be called right after commitNewDisplayItems. // Should only be called after a full document life cycle update.
size_t ApproximateUnsharedMemoryUsage() const; size_t ApproximateUnsharedMemoryUsage() const;
// Get the artifact generated after the last commit. // Get the artifact generated after the last commit.
......
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