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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h

Issue 1396783003: Factor PaintArtifact out of DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@const-replay
Patch Set: Created 5 years, 2 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
Index: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h
index 588e52bd9262c92d09f6d21025271ce8dd9af624..22660f019b9909bf49e30fc2780f7601611d355e 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h
@@ -12,6 +12,8 @@
#include "platform/graphics/ContiguousContainer.h"
#include "platform/graphics/PaintInvalidationReason.h"
#include "platform/graphics/paint/DisplayItem.h"
+#include "platform/graphics/paint/DisplayItems.h"
+#include "platform/graphics/paint/PaintArtifact.h"
#include "platform/graphics/paint/PaintChunk.h"
#include "platform/graphics/paint/PaintChunker.h"
#include "platform/graphics/paint/Transform3DDisplayItem.h"
@@ -26,36 +28,11 @@ namespace blink {
class GraphicsLayer;
class GraphicsContext;
-// kDisplayItemAlignment must be a multiple of alignof(derived display item) for
-// each derived display item; the ideal value is the least common multiple.
-// Currently the limiting factor is TransformtionMatrix (in
-// BeginTransform3DDisplayItem), which requests 16-byte alignment.
-static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplayItem);
static const size_t kInitialDisplayItemsCapacity = 64;
-static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem);
-
-class DisplayItems : public ContiguousContainer<DisplayItem, kDisplayItemAlignment> {
-public:
- DisplayItems(size_t initialSizeBytes)
- : ContiguousContainer(kMaximumDisplayItemSize, initialSizeBytes) {}
-
- DisplayItem& appendByMoving(DisplayItem& item)
- {
-#ifndef NDEBUG
- WTF::String originalDebugString = item.asDebugString();
-#endif
- ASSERT(item.isValid());
- DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derivedSize());
- // ContiguousContainer::appendByMoving() called in-place constructor on item, which invalidated it.
- ASSERT(!item.isValid());
-#ifndef NDEBUG
- // Save original debug string in the old item to help debugging.
- item.setClientDebugString(originalDebugString);
-#endif
- return result;
- }
-};
+// Responsible for processing display items as they are produced, and producing
+// a final paint artifact when complete. This class includes logic for caching,
+// cache invalidation, and merging.
pdr. 2015/10/09 03:57:50 +1, I think this is the right abstraction with the
class PLATFORM_EXPORT DisplayItemList {
pdr. 2015/10/09 03:57:50 I'm worried about the name of this class because i
jbroman 2015/10/13 18:20:56 Right, as I said in the original review email, I'd
pdr. 2015/10/13 18:30:32 I sort of think of builders as having temporary st
WTF_MAKE_NONCOPYABLE(DisplayItemList);
WTF_MAKE_FAST_ALLOCATED(DisplayItemList);
@@ -136,24 +113,13 @@ public:
// Should only be called right after commitNewDisplayItems.
size_t approximateUnsharedMemoryUsage() const;
- // Get the paint list generated after the last painting.
- const DisplayItems& displayItems() const;
-
- // Get the paint chunks generated after the last painting.
- const Vector<PaintChunk>& paintChunks() const;
+ // Get the artifact generated after the last commit.
+ const PaintArtifact& paintArtifact() const;
+ const DisplayItems& displayItems() const { return paintArtifact().displayItems(); }
pdr. 2015/10/09 03:57:50 We could just return PaintArtifact from a finish/c
jbroman 2015/10/13 18:20:56 The tricky thing here is that this class does need
+ const Vector<PaintChunk>& paintChunks() const { return paintArtifact().paintChunks(); }
bool clientCacheIsValid(DisplayItemClient) const;
- // Commits the new display items and plays back the updated display items into the given context.
- void commitNewDisplayItemsAndReplay(GraphicsContext& context)
- {
- commitNewDisplayItems();
- replay(context);
- }
-
- void appendToWebDisplayItemList(WebDisplayItemList*);
- void commitNewDisplayItemsAndAppendToWebDisplayItemList(WebDisplayItemList*);
-
bool displayItemConstructionIsDisabled() const { return m_constructionDisabled; }
void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructionDisabled = disable; }
@@ -197,8 +163,7 @@ public:
protected:
DisplayItemList()
- : m_currentDisplayItems(0)
- , m_newDisplayItems(kInitialDisplayItemsCapacity * kMaximumDisplayItemSize)
+ : m_newDisplayItems(kInitialDisplayItemsCapacity * kMaximumDisplayItemSize)
, m_validlyCachedClientsDirty(false)
, m_constructionDisabled(false)
, m_textPainted(false)
@@ -238,15 +203,12 @@ private:
void checkNoRemainingCachedDisplayItems();
#endif
- void replay(GraphicsContext&) const;
+ // The last complete paint artifact.
+ // In SPv2, this includes paint chunks as well as display items.
+ PaintArtifact m_currentPaintArtifact;
pdr. 2015/10/09 03:57:51 Replacing m_currentDisplayItems and m_currentPaint
jbroman 2015/10/13 18:20:56 See my previous comment for why I did this. Argua
- DisplayItems m_currentDisplayItems;
+ // Data being used to build the next paint artifact.
DisplayItems m_newDisplayItems;
-
- // In Slimming Paint v2, paint properties (e.g. transform) useful for
- // compositing are stored in corresponding paint chunks instead of in the
- // display items.
- Vector<PaintChunk> m_currentPaintChunks;
PaintChunker m_newPaintChunks;
// Contains all clients having valid cached paintings if updated.

Powered by Google App Engine
This is Rietveld 408576698