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

Unified Diff: cc/playback/clip_display_item.cc

Issue 1226503006: cc: More consistent reasoning about display list memory usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: capacity unit test Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/playback/clip_display_item.cc
diff --git a/cc/playback/clip_display_item.cc b/cc/playback/clip_display_item.cc
index 2a19eadd85477180cb36090d92fe657f0f94d650..5941502860bff21cff6723c64fbcc42c13e83574 100644
--- a/cc/playback/clip_display_item.cc
+++ b/cc/playback/clip_display_item.cc
@@ -24,12 +24,11 @@ void ClipDisplayItem::SetNew(gfx::Rect clip_rect,
clip_rect_ = clip_rect;
rounded_clip_rects_ = rounded_clip_rects;
- size_t memory_usage = sizeof(gfx::Rect);
- for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) {
- memory_usage += sizeof(rounded_clip_rects_[i]);
- }
+ size_t external_memory_usage =
+ rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]);
+
DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
- memory_usage);
+ external_memory_usage);
}
void ClipDisplayItem::Raster(SkCanvas* canvas,
@@ -77,7 +76,7 @@ void ClipDisplayItem::AsValueInto(base::trace_event::TracedValue* array) const {
EndClipDisplayItem::EndClipDisplayItem() {
DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
- 0 /* memory_usage */);
+ 0 /* external_memory_usage */);
}
EndClipDisplayItem::~EndClipDisplayItem() {

Powered by Google App Engine
This is Rietveld 408576698