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

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

Issue 2116693002: PaintChunk::id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CommitOnTheWay
Patch Set: Address chrishtr's comments. Created 4 years, 5 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/ScopedPaintChunkProperties.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScopedPaintChunkProperties.h b/third_party/WebKit/Source/platform/graphics/paint/ScopedPaintChunkProperties.h
index ec105314abfd10f60cde85aa1b90a83bfd0986cc..464f71c693394b5a871ab1312ebbddd00b7e92dc 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/ScopedPaintChunkProperties.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/ScopedPaintChunkProperties.h
@@ -5,6 +5,8 @@
#ifndef ScopedPaintChunkProperties_h
#define ScopedPaintChunkProperties_h
+#include "platform/graphics/paint/DisplayItem.h"
+#include "platform/graphics/paint/PaintChunk.h"
#include "platform/graphics/paint/PaintChunkProperties.h"
#include "platform/graphics/paint/PaintController.h"
#include "wtf/Allocator.h"
@@ -16,16 +18,27 @@ class ScopedPaintChunkProperties {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
WTF_MAKE_NONCOPYABLE(ScopedPaintChunkProperties);
public:
- ScopedPaintChunkProperties(PaintController& paintController, const PaintChunkProperties& properties)
+ ScopedPaintChunkProperties(PaintController& paintController, const DisplayItemClient& client, DisplayItem::Type type, const PaintChunkProperties& properties)
: m_paintController(paintController)
, m_previousProperties(paintController.currentPaintChunkProperties())
{
- m_paintController.updateCurrentPaintChunkProperties(properties);
+ PaintChunk::Id id(client, type);
+ m_paintController.updateCurrentPaintChunkProperties(&id, properties);
}
+ // Omits the type parameter, in case that the client creates only one PaintChunkProperties node during each painting.
+ ScopedPaintChunkProperties(PaintController& paintController, const DisplayItemClient& client, const PaintChunkProperties& properties)
+ : ScopedPaintChunkProperties(paintController, client, DisplayItem::UninitializedType, properties)
+ { }
+
~ScopedPaintChunkProperties()
{
- m_paintController.updateCurrentPaintChunkProperties(m_previousProperties);
+ // We should not return to the previous id, because that may cause a new chunk to use
+ // the same id as that of the previous chunk before this ScopedPaintChunkProperties.
+ // The painter should create another scope of paint properties with new id, or the
+ // new chunk will have no id and will not match any old chunk and will be treated as
+ // fully invalidated for rasterization.
+ m_paintController.updateCurrentPaintChunkProperties(nullptr, m_previousProperties);
}
private:

Powered by Google App Engine
This is Rietveld 408576698