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

Unified Diff: cc/playback/clip_display_item.cc

Issue 1494223003: cc: Shrink size of display item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make ui compile too oops Created 5 years 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 d89566c1e0d685a327e4a4e97bc05c791f38f2e2..d5e3829a72eab0cd537353dc09051782453f8fa6 100644
--- a/cc/playback/clip_display_item.cc
+++ b/cc/playback/clip_display_item.cc
@@ -17,24 +17,24 @@
namespace cc {
-ClipDisplayItem::ClipDisplayItem() {
+ClipDisplayItem::ClipDisplayItem(
+ gfx::Rect clip_rect,
+ const std::vector<SkRRect>& rounded_clip_rects) {
+ SetNew(clip_rect, rounded_clip_rects);
}
-ClipDisplayItem::~ClipDisplayItem() {
+ClipDisplayItem::ClipDisplayItem(const proto::DisplayItem& proto) {
+ FromProtobuf(proto);
}
void ClipDisplayItem::SetNew(gfx::Rect clip_rect,
const std::vector<SkRRect>& rounded_clip_rects) {
clip_rect_ = clip_rect;
rounded_clip_rects_ = rounded_clip_rects;
-
- size_t external_memory_usage =
- rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]);
-
- DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
- external_memory_usage);
}
+ClipDisplayItem::~ClipDisplayItem() {}
+
void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
proto->set_type(proto::DisplayItem::Type_Clip);
@@ -104,9 +104,18 @@ void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect,
array->AppendString(value);
}
-EndClipDisplayItem::EndClipDisplayItem() {
- DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
- 0 /* external_memory_usage */);
+size_t ClipDisplayItem::ExternalMemoryUsage() const {
+ return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]);
+}
+
+int ClipDisplayItem::ApproximateOpCount() const {
+ return 1;
+}
+
+EndClipDisplayItem::EndClipDisplayItem() {}
+
+EndClipDisplayItem::EndClipDisplayItem(const proto::DisplayItem& proto) {
+ FromProtobuf(proto);
}
EndClipDisplayItem::~EndClipDisplayItem() {
@@ -133,4 +142,12 @@ void EndClipDisplayItem::AsValueInto(
visual_rect.ToString().c_str()));
}
+size_t EndClipDisplayItem::ExternalMemoryUsage() const {
+ return 0;
+}
+
+int EndClipDisplayItem::ApproximateOpCount() const {
+ return 0;
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698