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

Unified Diff: cc/resources/largest_display_item.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 | « cc/resources/largest_display_item.h ('k') | cc/resources/transform_display_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/largest_display_item.cc
diff --git a/cc/resources/largest_display_item.cc b/cc/resources/largest_display_item.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4fd932a29da7810fb382879e4249aa51c2392526
--- /dev/null
+++ b/cc/resources/largest_display_item.cc
@@ -0,0 +1,71 @@
+// 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 "cc/resources/largest_display_item.h"
+
+#include <algorithm>
+
+#include "cc/resources/clip_display_item.h"
+#include "cc/resources/clip_path_display_item.h"
+#include "cc/resources/compositing_display_item.h"
+#include "cc/resources/drawing_display_item.h"
+#include "cc/resources/filter_display_item.h"
+#include "cc/resources/float_clip_display_item.h"
+#include "cc/resources/transform_display_item.h"
+
+#include "third_party/skia/include/core/SkPicture.h"
+
+namespace {
+const size_t kLargestDisplayItemSize = sizeof(cc::TransformDisplayItem);
+} // namespace
+
+namespace cc {
+
+size_t LargestDisplayItemSize() {
+ // Use compile assert to make sure largest is actually larger than all other
+ // type of display_items.
+ static_assert(sizeof(ClipDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. ClipDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(EndClipDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. EndClipDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(ClipPathDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. ClipPathDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(EndClipPathDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. EndClipPathDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(CompositingDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. CompositingDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(EndCompositingDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. EndCompositingDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(DrawingDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. DrawingDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(FilterDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. FilterDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(EndFilterDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. EndFilterDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(FloatClipDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. FloatClipDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(EndFloatClipDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. EndFloatClipDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(TransformDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. TransformDisplayItem"
+ " is currently largest.");
+ static_assert(sizeof(EndTransformDisplayItem) <= kLargestDisplayItemSize,
+ "Largest Draw Quad size needs update. EndTransformDisplayItem"
+ " is currently largest.");
+
+ return kLargestDisplayItemSize;
+}
+
+} // namespace cc
« no previous file with comments | « cc/resources/largest_display_item.h ('k') | cc/resources/transform_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698