Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/PaintChunk.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunk.h b/third_party/WebKit/Source/platform/graphics/paint/PaintChunk.h |
| index bafb8298ecdc2ba775afed614f996c1d485bfab7..1cf56449992a28bc613cc8880d26b54bf741fb42 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunk.h |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunk.h |
| @@ -6,8 +6,10 @@ |
| #define PaintChunk_h |
| #include "platform/geometry/FloatRect.h" |
| +#include "platform/graphics/paint/DisplayItem.h" |
| #include "platform/graphics/paint/PaintChunkProperties.h" |
| #include "wtf/Allocator.h" |
| +#include "wtf/Optional.h" |
| #include <iosfwd> |
| namespace blink { |
| @@ -21,8 +23,12 @@ namespace blink { |
| struct PaintChunk { |
| DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| PaintChunk() : beginIndex(0), endIndex(0), knownToBeOpaque(false) { } |
| - PaintChunk(unsigned begin, unsigned end, const PaintChunkProperties& props) |
| - : beginIndex(begin), endIndex(end), properties(props), knownToBeOpaque(false) { } |
| + PaintChunk(unsigned begin, unsigned end, const DisplayItem::Id* chunkId, const PaintChunkProperties& props) |
|
pdr.
2016/07/13 23:31:34
Since this is just for foreign layers, foreignLaye
Xianzhu
2016/07/14 04:53:09
The ids are not just for foreign layers, but for a
|
| + : beginIndex(begin), endIndex(end), properties(props), knownToBeOpaque(false) |
| + { |
| + if (chunkId) |
| + id.emplace(*chunkId); |
| + } |
| unsigned size() const |
| { |
| @@ -30,6 +36,21 @@ struct PaintChunk { |
| return endIndex - beginIndex; |
| } |
| + // Check if a new PaintChunk created in the latest paint matches an old PaintChunk |
| + // created in the previous paint. |
| + bool idMatches(const PaintChunk& other) const |
|
pdr.
2016/07/13 23:31:34
Is this used/tested? The need for isJustCreated is
Xianzhu
2016/07/14 04:53:09
Added PaintChunkTest.* for this method.
The isJus
|
| + { |
| + // A PaintChunk without an id doesn't match any other PaintChunks. |
| + if (!id || !other.id) |
| + return false; |
| + if (*id != *other.id) |
| + return false; |
| + // If the client is just created, it's actually a new client. The client |
| + // of this or the other PaintChunk was allocated at the same address and has |
| + // been deleted. |
| + return !id->client.isJustCreated(); |
| + } |
| + |
| // Index of the first drawing in this chunk. |
| unsigned beginIndex; |
| @@ -37,6 +58,9 @@ struct PaintChunk { |
| // |endIndex - beginIndex| drawings in the chunk. |
| unsigned endIndex; |
| + // Identifier of this chunk. If it has a value, it should be unique. |
| + Optional<DisplayItem::Id> id; |
| + |
| // The paint properties which apply to this chunk. |
| PaintChunkProperties properties; |
| @@ -51,6 +75,7 @@ inline bool operator==(const PaintChunk& a, const PaintChunk& b) |
| { |
| return a.beginIndex == b.beginIndex |
| && a.endIndex == b.endIndex |
| + && a.id == b.id |
| && a.properties == b.properties |
| && a.bounds == b.bounds |
| && a.knownToBeOpaque == b.knownToBeOpaque; |