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

Unified Diff: ui/compositor/paint_cache.cc

Issue 1101783002: ui: Cache the output of View::OnPaint when the View isn't invalid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cache: . Created 5 years, 8 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_context.h » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..ef0e5a72e874ebe7338ab3a35b4f64c7802d8e69
--- /dev/null
+++ b/ui/compositor/paint_cache.cc
@@ -0,0 +1,31 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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() {
+}
+
+bool PaintCache::UseCache(const PaintContext& context) {
+ if (!display_item_)
+ return false;
+ DCHECK(context.list_);
+ context.list_->AppendItem(display_item_->Clone());
+ return true;
+}
+
+void PaintCache::SetCache(scoped_ptr<cc::DrawingDisplayItem> item) {
+ display_item_ = item.Pass();
+}
+
+} // namespace ui
« no previous file with comments | « ui/compositor/paint_cache.h ('k') | ui/compositor/paint_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698