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

Unified Diff: ui/compositor/paint_cache.cc

Issue 1123983002: cc: Use a ListContainer for DisplayItemList to reduce allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displaylistcontainer: fixdcheck Created 5 years, 7 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
« no previous file with comments | « ui/compositor/paint_cache.h ('k') | ui/compositor/paint_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/paint_cache.cc
diff --git a/ui/compositor/paint_cache.cc b/ui/compositor/paint_cache.cc
index ef0e5a72e874ebe7338ab3a35b4f64c7802d8e69..7a39352a2c7135c42f19fbe0c5929b44b61e5fc0 100644
--- a/ui/compositor/paint_cache.cc
+++ b/ui/compositor/paint_cache.cc
@@ -5,27 +5,28 @@
#include "ui/compositor/paint_cache.h"
#include "cc/resources/display_item_list.h"
-#include "cc/resources/drawing_display_item.h"
#include "ui/compositor/paint_context.h"
namespace ui {
-PaintCache::PaintCache() {
+PaintCache::PaintCache() : has_cache_(false) {
}
PaintCache::~PaintCache() {
}
bool PaintCache::UseCache(const PaintContext& context) {
- if (!display_item_)
+ if (!has_cache_)
return false;
DCHECK(context.list_);
- context.list_->AppendItem(display_item_->Clone());
+ auto* item = context.list_->CreateAndAppendItem<cc::DrawingDisplayItem>();
+ display_item_.CloneTo(item);
return true;
}
-void PaintCache::SetCache(scoped_ptr<cc::DrawingDisplayItem> item) {
- display_item_ = item.Pass();
+void PaintCache::SetCache(const cc::DrawingDisplayItem* item) {
+ item->CloneTo(&display_item_);
+ has_cache_ = true;
}
} // namespace ui
« no previous file with comments | « ui/compositor/paint_cache.h ('k') | ui/compositor/paint_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698