Chromium Code Reviews| Index: Source/platform/graphics/paint/DisplayItemList.h |
| diff --git a/Source/platform/graphics/paint/DisplayItemList.h b/Source/platform/graphics/paint/DisplayItemList.h |
| index 51dc0f8289d6a6b88eccc3d471a86f9de37706bb..ab039d9c888e94f7552f9f2312ba9b70280dea86 100644 |
| --- a/Source/platform/graphics/paint/DisplayItemList.h |
| +++ b/Source/platform/graphics/paint/DisplayItemList.h |
| @@ -10,6 +10,9 @@ |
| #include "platform/graphics/paint/DisplayItems.h" |
| #include "wtf/HashMap.h" |
| #include "wtf/PassOwnPtr.h" |
| +#include "wtf/StdLibExtras.h" |
| +#include "wtf/TypeTraits.h" |
| +#include "wtf/Utility.h" |
| #include "wtf/Vector.h" |
| namespace blink { |
| @@ -30,7 +33,14 @@ public: |
| void invalidateAll(); |
| // These methods are called during painting. |
| - void add(WTF::PassOwnPtr<DisplayItem>); |
| + |
| + template <typename DisplayItemClass, typename... Args> |
| + void createAndAppendIfNeeded(Args&&... args) |
| + { |
|
Xianzhu
2015/06/19 16:19:11
Can we put displayItemConstructionIsDisabled() che
|
| + DisplayItemClass& displayItem = m_newDisplayItems.emplaceBack<DisplayItemClass>(WTF::forward<Args>(args)...); |
| + processNewItem(displayItem); |
| + } |
| + |
| void beginScope(DisplayItemClient); |
| void endScope(DisplayItemClient); |
| @@ -77,6 +87,10 @@ private: |
| friend class DisplayItemListPaintTest; |
| friend class LayoutObjectDrawingRecorderTest; |
| + |
| + // Adjust the list as necessary for newly appended items. |
| + void processNewItem(DisplayItem&); |
| + |
| void updateValidlyCachedClientsIfNeeded() const; |
| #ifndef NDEBUG |