| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PaintController_h | 5 #ifndef PaintController_h |
| 6 #define PaintController_h | 6 #define PaintController_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
| 10 #include "platform/geometry/IntRect.h" | 10 #include "platform/geometry/IntRect.h" |
| 11 #include "platform/geometry/LayoutPoint.h" | 11 #include "platform/geometry/LayoutPoint.h" |
| 12 #include "platform/graphics/ContiguousContainer.h" | 12 #include "platform/graphics/ContiguousContainer.h" |
| 13 #include "platform/graphics/PaintInvalidationReason.h" | |
| 14 #include "platform/graphics/paint/DisplayItem.h" | 13 #include "platform/graphics/paint/DisplayItem.h" |
| 15 #include "platform/graphics/paint/DisplayItemList.h" | 14 #include "platform/graphics/paint/DisplayItemList.h" |
| 16 #include "platform/graphics/paint/PaintArtifact.h" | 15 #include "platform/graphics/paint/PaintArtifact.h" |
| 17 #include "platform/graphics/paint/PaintChunk.h" | 16 #include "platform/graphics/paint/PaintChunk.h" |
| 18 #include "platform/graphics/paint/PaintChunker.h" | 17 #include "platform/graphics/paint/PaintChunker.h" |
| 19 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 18 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
| 20 #include "wtf/Alignment.h" | 19 #include "wtf/Alignment.h" |
| 21 #include "wtf/HashMap.h" | 20 #include "wtf/HashMap.h" |
| 22 #include "wtf/HashSet.h" | 21 #include "wtf/HashSet.h" |
| 23 #include "wtf/PassOwnPtr.h" | 22 #include "wtf/PassOwnPtr.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 WTF_MAKE_NONCOPYABLE(PaintController); | 36 WTF_MAKE_NONCOPYABLE(PaintController); |
| 38 USING_FAST_MALLOC(PaintController); | 37 USING_FAST_MALLOC(PaintController); |
| 39 public: | 38 public: |
| 40 static PassOwnPtr<PaintController> create() | 39 static PassOwnPtr<PaintController> create() |
| 41 { | 40 { |
| 42 return adoptPtr(new PaintController()); | 41 return adoptPtr(new PaintController()); |
| 43 } | 42 } |
| 44 | 43 |
| 45 // These methods are called during paint invalidation (or paint if SlimmingP
aintV2 is on). | 44 // These methods are called during paint invalidation (or paint if SlimmingP
aintV2 is on). |
| 46 | 45 |
| 47 // If |visualRect| is not nullptr, for slimming paint v1, it contains all pi
xels within the GraphicsLayer | 46 void invalidate(const DisplayItemClient&); |
| 48 // which might be painted into by the display item client, in coordinate spa
ce of the GraphicsLayer. | |
| 49 // TODO(pdr): define it for spv2. | |
| 50 // |visualRect| can be nullptr if we know it's unchanged and PaintController
has cached the previous value. | |
| 51 void invalidate(const DisplayItemClient&, PaintInvalidationReason, const Int
Rect* visualRect); | |
| 52 void invalidateUntracked(const DisplayItemClient&); | 47 void invalidateUntracked(const DisplayItemClient&); |
| 53 void invalidateAll(); | 48 void invalidateAll(); |
| 54 | 49 |
| 55 // Record when paint offsets change during paint. | 50 // Record when paint offsets change during paint. |
| 56 void invalidatePaintOffset(const DisplayItemClient&); | 51 void invalidatePaintOffset(const DisplayItemClient&); |
| 57 #if ENABLE(ASSERT) | 52 #if ENABLE(ASSERT) |
| 58 bool paintOffsetWasInvalidated(const DisplayItemClient&) const; | 53 bool paintOffsetWasInvalidated(const DisplayItemClient&) const; |
| 59 #endif | 54 #endif |
| 60 | 55 |
| 61 // These methods are called during painting. | 56 // These methods are called during painting. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 , m_skippingCacheCount(0) | 185 , m_skippingCacheCount(0) |
| 191 , m_numCachedNewItems(0) | 186 , m_numCachedNewItems(0) |
| 192 , m_nextScope(1) { } | 187 , m_nextScope(1) { } |
| 193 | 188 |
| 194 private: | 189 private: |
| 195 // Set new item state (scopes, cache skipping, etc) for a new item. | 190 // Set new item state (scopes, cache skipping, etc) for a new item. |
| 196 void processNewItem(DisplayItem&); | 191 void processNewItem(DisplayItem&); |
| 197 | 192 |
| 198 void updateValidlyCachedClientsIfNeeded() const; | 193 void updateValidlyCachedClientsIfNeeded() const; |
| 199 | 194 |
| 200 void invalidateClient(const DisplayItemClient&); | |
| 201 | |
| 202 #ifndef NDEBUG | 195 #ifndef NDEBUG |
| 203 WTF::String displayItemListAsDebugString(const DisplayItemList&) const; | 196 WTF::String displayItemListAsDebugString(const DisplayItemList&) const; |
| 204 #endif | 197 #endif |
| 205 | 198 |
| 206 // Indices into PaintList of all DrawingDisplayItems and BeginSubsequenceDis
playItems of each client. | 199 // Indices into PaintList of all DrawingDisplayItems and BeginSubsequenceDis
playItems of each client. |
| 207 // Temporarily used during merge to find out-of-order display items. | 200 // Temporarily used during merge to find out-of-order display items. |
| 208 using DisplayItemIndicesByClientMap = HashMap<const DisplayItemClient*, Vect
or<size_t>>; | 201 using DisplayItemIndicesByClientMap = HashMap<const DisplayItemClient*, Vect
or<size_t>>; |
| 209 | 202 |
| 210 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Displa
yItemIndicesByClientMap&, const DisplayItemList&); | 203 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Displa
yItemIndicesByClientMap&, const DisplayItemList&); |
| 211 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Display
ItemIndicesByClientMap&); | 204 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Display
ItemIndicesByClientMap&); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // easily find where the duplicated ids are from. | 271 // easily find where the duplicated ids are from. |
| 279 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 272 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 280 #endif | 273 #endif |
| 281 | 274 |
| 282 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; | 275 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
| 283 }; | 276 }; |
| 284 | 277 |
| 285 } // namespace blink | 278 } // namespace blink |
| 286 | 279 |
| 287 #endif // PaintController_h | 280 #endif // PaintController_h |
| OLD | NEW |