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

Unified Diff: cc/paint/display_item_list.h

Issue 2830243002: cc: Don't perform image analysis if the DisplayItemList has no images. (Closed)
Patch Set: rebase Created 3 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 | « no previous file | cc/paint/display_item_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/display_item_list.h
diff --git a/cc/paint/display_item_list.h b/cc/paint/display_item_list.h
index b65707dc6e0f2d445206627e319811c27378ee78..9d2c5b6b05aff27d18556395b3a8aa0602f44408 100644
--- a/cc/paint/display_item_list.h
+++ b/cc/paint/display_item_list.h
@@ -18,6 +18,7 @@
#include "cc/base/rtree.h"
#include "cc/paint/discardable_image_map.h"
#include "cc/paint/display_item.h"
+#include "cc/paint/drawing_display_item.h"
#include "cc/paint/image_id.h"
#include "cc/paint/paint_export.h"
#include "third_party/skia/include/core/SkPicture.h"
@@ -119,7 +120,10 @@ class CC_PAINT_EXPORT DisplayItemList
visual_rects_.push_back(visual_rect);
GrowCurrentBeginItemVisualRect(visual_rect);
- return AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...);
+ const auto& item =
+ AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...);
+ has_discardable_images_ |= item.picture->HasDiscardableImages();
+ return item;
}
// Called after all items are appended, to process the items and, if
@@ -160,6 +164,8 @@ class CC_PAINT_EXPORT DisplayItemList
return items_.end();
}
+ bool has_discardable_images() const { return has_discardable_images_; }
+
private:
FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, AsValueWithNoItems);
FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, AsValueWithItems);
@@ -198,6 +204,7 @@ class CC_PAINT_EXPORT DisplayItemList
// For testing purposes only. Whether to keep visual rects across calls to
// Finalize().
bool retain_visual_rects_ = false;
+ bool has_discardable_images_ = false;
friend class base::RefCountedThreadSafe<DisplayItemList>;
FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage);
« no previous file with comments | « no previous file | cc/paint/display_item_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698