Chromium Code Reviews| 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 #include "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
| 6 | 6 |
| 7 #include "platform/NotImplemented.h" | 7 #include "platform/NotImplemented.h" |
| 8 #include "platform/TraceEvent.h" | 8 #include "platform/TraceEvent.h" |
| 9 #include "platform/graphics/GraphicsLayer.h" | 9 #include "platform/graphics/GraphicsLayer.h" |
| 10 #include "platform/graphics/paint/DrawingDisplayItem.h" | 10 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 #endif | 134 #endif |
| 135 | 135 |
| 136 invalidateUntracked(client); | 136 invalidateUntracked(client); |
| 137 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_trackedPaintInvali dationObjects) | 137 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_trackedPaintInvali dationObjects) |
| 138 m_trackedPaintInvalidationObjects->append(client.debugName()); | 138 m_trackedPaintInvalidationObjects->append(client.debugName()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void PaintController::invalidateUntracked(const DisplayItemClient& client) | 141 void PaintController::invalidateUntracked(const DisplayItemClient& client) |
| 142 { | 142 { |
| 143 // This can be called during painting, but we can't invalidate already paint ed clients. | 143 // This can be called during painting, but we can't invalidate already paint ed clients. |
| 144 client.setDisplayItemsCached(DisplayItemClient::kInvalidCacheGeneration); | |
| 144 ASSERT(!m_newDisplayItemIndicesByClient.contains(&client)); | 145 ASSERT(!m_newDisplayItemIndicesByClient.contains(&client)); |
| 145 updateValidlyCachedClientsIfNeeded(); | |
| 146 m_validlyCachedClients.remove(&client); | |
| 147 } | 146 } |
| 148 | 147 |
| 149 void PaintController::invalidateAll() | 148 void PaintController::invalidateAll() |
| 150 { | 149 { |
| 151 // Can only be called during layout/paintInvalidation, not during painting. | 150 // Can only be called during layout/paintInvalidation, not during painting. |
| 152 ASSERT(m_newDisplayItemList.isEmpty()); | 151 ASSERT(m_newDisplayItemList.isEmpty()); |
| 153 m_currentPaintArtifact.reset(); | 152 m_currentPaintArtifact.reset(); |
| 154 m_validlyCachedClients.clear(); | 153 m_currentCacheGeneration = DisplayItemClient::kInvalidCacheGeneration; |
| 155 m_validlyCachedClientsDirty = false; | |
| 156 | 154 |
| 157 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_trackedPaintInvali dationObjects) | 155 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_trackedPaintInvali dationObjects) |
| 158 m_trackedPaintInvalidationObjects->append("##ALL##"); | 156 m_trackedPaintInvalidationObjects->append("##ALL##"); |
| 159 } | 157 } |
| 160 | 158 |
| 161 bool PaintController::clientCacheIsValid(const DisplayItemClient& client) const | 159 bool PaintController::clientCacheIsValid(const DisplayItemClient& client) const |
| 162 { | 160 { |
| 163 if (skippingCache()) | 161 ASSERT(DisplayItemClient::isAlive(client)); |
| 162 if (!canUseClientCacheStatus() || skippingCache()) | |
| 164 return false; | 163 return false; |
| 165 updateValidlyCachedClientsIfNeeded(); | 164 return client.displayItemsAreCached(m_currentCacheGeneration); |
| 166 return m_validlyCachedClients.contains(&client); | |
| 167 } | 165 } |
| 168 | 166 |
| 169 void PaintController::invalidatePaintOffset(const DisplayItemClient& client) | 167 void PaintController::invalidatePaintOffset(const DisplayItemClient& client) |
| 170 { | 168 { |
| 171 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); | 169 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); |
| 172 invalidateClient(client); | 170 invalidateClient(client); |
| 173 | 171 |
| 174 #if ENABLE(ASSERT) | 172 #if ENABLE(ASSERT) |
| 175 ASSERT(!paintOffsetWasInvalidated(client)); | 173 ASSERT(!paintOffsetWasInvalidated(client)); |
| 176 m_clientsWithPaintOffsetInvalidations.add(&client); | 174 m_clientsWithPaintOffsetInvalidations.add(&client); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 return findOutOfOrderCachedItemForward(id, context); | 230 return findOutOfOrderCachedItemForward(id, context); |
| 233 } | 231 } |
| 234 | 232 |
| 235 // Find forward for the item and index all skipped indexable items. | 233 // Find forward for the item and index all skipped indexable items. |
| 236 DisplayItemList::iterator PaintController::findOutOfOrderCachedItemForward(const DisplayItem::Id& id, OutOfOrderIndexContext& context) | 234 DisplayItemList::iterator PaintController::findOutOfOrderCachedItemForward(const DisplayItem::Id& id, OutOfOrderIndexContext& context) |
| 237 { | 235 { |
| 238 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.displayItemLis t().end(); | 236 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.displayItemLis t().end(); |
| 239 for (; context.nextItemToIndex != currentEnd; ++context.nextItemToIndex) { | 237 for (; context.nextItemToIndex != currentEnd; ++context.nextItemToIndex) { |
| 240 const DisplayItem& item = *context.nextItemToIndex; | 238 const DisplayItem& item = *context.nextItemToIndex; |
| 241 ASSERT(item.hasValidClient()); | 239 ASSERT(item.hasValidClient()); |
| 242 if (item.isCacheable() && clientCacheIsValid(item.client())) { | 240 if (id.matches(item)) |
| 243 if (id.matches(item)) | 241 return context.nextItemToIndex++; |
| 244 return context.nextItemToIndex++; | 242 if (item.isCacheable()) |
| 245 | |
| 246 addItemToIndexIfNeeded(item, context.nextItemToIndex - m_currentPain tArtifact.displayItemList().begin(), context.displayItemIndicesByClient); | 243 addItemToIndexIfNeeded(item, context.nextItemToIndex - m_currentPain tArtifact.displayItemList().begin(), context.displayItemIndicesByClient); |
| 247 } | |
| 248 } | 244 } |
| 249 return currentEnd; | 245 return currentEnd; |
| 250 } | 246 } |
| 251 | 247 |
| 252 void PaintController::copyCachedSubsequence(DisplayItemList::iterator& currentIt , DisplayItemList& updatedList) | 248 void PaintController::copyCachedSubsequence(DisplayItemList::iterator& currentIt , DisplayItemList& updatedList) |
| 253 { | 249 { |
| 254 ASSERT(currentIt->type() == DisplayItem::Subsequence); | 250 ASSERT(currentIt->type() == DisplayItem::Subsequence); |
| 255 ASSERT(!currentIt->scope()); | 251 ASSERT(!currentIt->scope()); |
| 256 DisplayItem::Id endSubsequenceId(currentIt->client(), DisplayItem::EndSubseq uence, 0); | 252 DisplayItem::Id endSubsequenceId(currentIt->client(), DisplayItem::EndSubseq uence, 0); |
| 257 do { | 253 do { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 285 // Coefficients are related to the ratio of out-of-order CachedDisplayItems | 281 // Coefficients are related to the ratio of out-of-order CachedDisplayItems |
| 286 // and the average number of (Drawing|Subsequence)DisplayItems per client. | 282 // and the average number of (Drawing|Subsequence)DisplayItems per client. |
| 287 // | 283 // |
| 288 void PaintController::commitNewDisplayItemsInternal() | 284 void PaintController::commitNewDisplayItemsInternal() |
| 289 { | 285 { |
| 290 TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", | 286 TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", |
| 291 "current_display_list_size", (int)m_currentPaintArtifact.displayItemList ().size(), | 287 "current_display_list_size", (int)m_currentPaintArtifact.displayItemList ().size(), |
| 292 "num_non_cached_new_items", (int)m_newDisplayItemList.size() - m_numCach edNewItems); | 288 "num_non_cached_new_items", (int)m_newDisplayItemList.size() - m_numCach edNewItems); |
| 293 m_numCachedNewItems = 0; | 289 m_numCachedNewItems = 0; |
| 294 | 290 |
| 295 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 296 m_clientsCheckedPaintInvalidation.clear(); | |
| 297 | |
| 298 // These data structures are used during painting only. | 291 // These data structures are used during painting only. |
| 299 ASSERT(m_scopeStack.isEmpty()); | 292 ASSERT(m_scopeStack.isEmpty()); |
| 300 m_scopeStack.clear(); | 293 m_scopeStack.clear(); |
| 301 m_nextScope = 1; | 294 m_nextScope = 1; |
| 302 ASSERT(!skippingCache()); | 295 ASSERT(!skippingCache()); |
| 303 #if ENABLE(ASSERT) | 296 #if ENABLE(ASSERT) |
| 304 m_newDisplayItemIndicesByClient.clear(); | 297 m_newDisplayItemIndicesByClient.clear(); |
| 305 m_clientsWithPaintOffsetInvalidations.clear(); | 298 m_clientsWithPaintOffsetInvalidations.clear(); |
| 306 m_invalidations.clear(); | 299 m_invalidations.clear(); |
| 307 #endif | 300 #endif |
| 308 | 301 |
| 309 if (m_currentPaintArtifact.isEmpty()) { | 302 if (m_currentPaintArtifact.isEmpty()) { |
| 310 #if ENABLE(ASSERT) | 303 #if ENABLE(ASSERT) |
| 311 for (const auto& item : m_newDisplayItemList) | 304 for (const auto& item : m_newDisplayItemList) |
| 312 ASSERT(!item.isCached()); | 305 ASSERT(!item.isCached()); |
| 313 #endif | 306 #endif |
| 314 m_currentPaintArtifact.displayItemList().swap(m_newDisplayItemList); | 307 m_currentPaintArtifact.displayItemList().swap(m_newDisplayItemList); |
| 315 m_currentPaintArtifact.paintChunks() = m_newPaintChunks.releasePaintChun ks(); | 308 m_currentPaintArtifact.paintChunks() = m_newPaintChunks.releasePaintChun ks(); |
| 316 m_validlyCachedClientsDirty = true; | 309 updateCacheGeneration(); |
| 317 return; | 310 return; |
| 318 } | 311 } |
| 319 | 312 |
| 320 updateValidlyCachedClientsIfNeeded(); | |
| 321 | |
| 322 // Stores indices to valid DrawingDisplayItems in m_currentDisplayItems that have not been matched | 313 // Stores indices to valid DrawingDisplayItems in m_currentDisplayItems that have not been matched |
| 323 // by CachedDisplayItems during synchronized matching. The indexed items wil l be matched | 314 // by CachedDisplayItems during synchronized matching. The indexed items wil l be matched |
| 324 // by later out-of-order CachedDisplayItems in m_newDisplayItemList. This en sures that when | 315 // by later out-of-order CachedDisplayItems in m_newDisplayItemList. This en sures that when |
| 325 // out-of-order CachedDisplayItems occur, we only traverse at most once over m_currentDisplayItems | 316 // out-of-order CachedDisplayItems occur, we only traverse at most once over m_currentDisplayItems |
| 326 // looking for potential matches. Thus we can ensure that the algorithm runs in linear time. | 317 // looking for potential matches. Thus we can ensure that the algorithm runs in linear time. |
| 327 OutOfOrderIndexContext outOfOrderIndexContext(m_currentPaintArtifact.display ItemList().begin()); | 318 OutOfOrderIndexContext outOfOrderIndexContext(m_currentPaintArtifact.display ItemList().begin()); |
| 328 | 319 |
| 329 // TODO(jbroman): Consider revisiting this heuristic. | 320 // TODO(jbroman): Consider revisiting this heuristic. |
| 330 DisplayItemList updatedList(std::max(m_currentPaintArtifact.displayItemList( ).usedCapacityInBytes(), m_newDisplayItemList.usedCapacityInBytes())); | 321 DisplayItemList updatedList(std::max(m_currentPaintArtifact.displayItemList( ).usedCapacityInBytes(), m_newDisplayItemList.usedCapacityInBytes())); |
| 331 Vector<PaintChunk> updatedPaintChunks; | 322 Vector<PaintChunk> updatedPaintChunks; |
| 332 DisplayItemList::iterator currentIt = m_currentPaintArtifact.displayItemList ().begin(); | 323 DisplayItemList::iterator currentIt = m_currentPaintArtifact.displayItemList ().begin(); |
| 333 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.displayItemLis t().end(); | 324 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.displayItemLis t().end(); |
| 334 for (DisplayItemList::iterator newIt = m_newDisplayItemList.begin(); newIt ! = m_newDisplayItemList.end(); ++newIt) { | 325 for (DisplayItemList::iterator newIt = m_newDisplayItemList.begin(); newIt ! = m_newDisplayItemList.end(); ++newIt) { |
| 335 const DisplayItem& newDisplayItem = *newIt; | 326 const DisplayItem& newDisplayItem = *newIt; |
| 336 const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId(); | 327 const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId(); |
| 337 bool newDisplayItemHasCachedType = newDisplayItem.type() != newDisplayIt emId.type; | 328 bool newDisplayItemHasCachedType = newDisplayItem.type() != newDisplayIt emId.type; |
| 338 | 329 |
| 339 bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matche s(*currentIt); | 330 bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matche s(*currentIt); |
| 340 | 331 |
| 341 if (newDisplayItemHasCachedType) { | 332 if (newDisplayItemHasCachedType) { |
| 342 ASSERT(newDisplayItem.isCached()); | 333 ASSERT(newDisplayItem.isCached()); |
| 343 ASSERT(clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnable dFeatures::slimmingPaintOffsetCachingEnabled() && !paintOffsetWasInvalidated(new DisplayItem.client()))); | 334 // ASSERT(clientCacheIsValid(newDisplayItem.client()) || (RuntimeEna bledFeatures::slimmingPaintOffsetCachingEnabled() && !paintOffsetWasInvalidated( newDisplayItem.client()))); |
|
pdr.
2016/01/04 21:19:30
Drive by: did you forget this?
| |
| 344 if (!isSynchronized) { | 335 if (!isSynchronized) { |
| 345 currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrde rIndexContext); | 336 currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrde rIndexContext); |
| 346 | 337 |
| 347 if (currentIt == currentEnd) { | 338 if (currentIt == currentEnd) { |
| 348 #ifndef NDEBUG | 339 #ifndef NDEBUG |
| 349 showDebugData(); | 340 showDebugData(); |
| 350 WTFLogAlways("%s not found in m_currentDisplayItemList\n", n ewDisplayItem.asDebugString().utf8().data()); | 341 WTFLogAlways("%s not found in m_currentDisplayItemList\n", n ewDisplayItem.asDebugString().utf8().data()); |
| 351 #endif | 342 #endif |
| 352 ASSERT_NOT_REACHED(); | 343 ASSERT_NOT_REACHED(); |
| 353 // We did not find the cached display item. This should be i mpossible, but may occur if there is a bug | 344 // We did not find the cached display item. This should be i mpossible, but may occur if there is a bug |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 364 #endif | 355 #endif |
| 365 if (newDisplayItem.isCachedDrawing()) { | 356 if (newDisplayItem.isCachedDrawing()) { |
| 366 updatedList.appendByMoving(*currentIt); | 357 updatedList.appendByMoving(*currentIt); |
| 367 ++currentIt; | 358 ++currentIt; |
| 368 } else { | 359 } else { |
| 369 ASSERT(newDisplayItem.type() == DisplayItem::CachedSubsequence); | 360 ASSERT(newDisplayItem.type() == DisplayItem::CachedSubsequence); |
| 370 copyCachedSubsequence(currentIt, updatedList); | 361 copyCachedSubsequence(currentIt, updatedList); |
| 371 ASSERT(updatedList.last().type() == DisplayItem::EndSubsequence) ; | 362 ASSERT(updatedList.last().type() == DisplayItem::EndSubsequence) ; |
| 372 } | 363 } |
| 373 } else { | 364 } else { |
| 374 ASSERT(!newDisplayItem.isDrawing() | 365 /*ASSERT(!newDisplayItem.isDrawing() |
|
pdr.
2016/01/04 21:19:30
Drive by: did you forget this?
| |
| 375 || newDisplayItem.skippedCache() | 366 || newDisplayItem.skippedCache() |
| 376 || !clientCacheIsValid(newDisplayItem.client()) | 367 || !clientCacheIsValid(newDisplayItem.client()) |
| 377 || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintOffsetWasInvalidated(newDisplayItem.client()))); | 368 || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintOffsetWasInvalidated(newDisplayItem.client()))); |
| 378 | 369 */ |
| 379 updatedList.appendByMoving(*newIt); | 370 updatedList.appendByMoving(*newIt); |
| 380 | 371 |
| 381 if (isSynchronized) | 372 if (isSynchronized) |
| 382 ++currentIt; | 373 ++currentIt; |
| 383 } | 374 } |
| 384 // Items before currentIt should have been copied so we don't need to in dex them. | 375 // Items before currentIt should have been copied so we don't need to in dex them. |
| 385 if (currentIt - outOfOrderIndexContext.nextItemToIndex > 0) | 376 if (currentIt - outOfOrderIndexContext.nextItemToIndex > 0) |
| 386 outOfOrderIndexContext.nextItemToIndex = currentIt; | 377 outOfOrderIndexContext.nextItemToIndex = currentIt; |
| 387 } | 378 } |
| 388 | 379 |
| 389 #if ENABLE(ASSERT) | 380 #if ENABLE(ASSERT) |
| 390 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) | 381 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) |
| 391 checkNoRemainingCachedDisplayItems(); | 382 checkNoRemainingCachedDisplayItems(); |
| 392 #endif // ENABLE(ASSERT) | 383 #endif // ENABLE(ASSERT) |
| 393 | 384 |
| 394 // TODO(jbroman): When subsequence caching applies to SPv2, we'll need to | 385 // TODO(jbroman): When subsequence caching applies to SPv2, we'll need to |
| 395 // merge the paint chunks as well. | 386 // merge the paint chunks as well. |
| 396 m_currentPaintArtifact.displayItemList().swap(updatedList); | 387 m_currentPaintArtifact.displayItemList().swap(updatedList); |
| 397 m_currentPaintArtifact.paintChunks() = m_newPaintChunks.releasePaintChunks() ; | 388 m_currentPaintArtifact.paintChunks() = m_newPaintChunks.releasePaintChunks() ; |
| 398 | 389 |
| 399 m_newDisplayItemList.clear(); | 390 m_newDisplayItemList.clear(); |
| 400 m_validlyCachedClientsDirty = true; | 391 updateCacheGeneration(); |
| 401 } | 392 } |
| 402 | 393 |
| 403 size_t PaintController::approximateUnsharedMemoryUsage() const | 394 size_t PaintController::approximateUnsharedMemoryUsage() const |
| 404 { | 395 { |
| 405 size_t memoryUsage = sizeof(*this); | 396 size_t memoryUsage = sizeof(*this); |
| 406 | 397 |
| 407 // Memory outside this class due to m_currentPaintArtifact. | 398 // Memory outside this class due to m_currentPaintArtifact. |
| 408 memoryUsage += m_currentPaintArtifact.approximateUnsharedMemoryUsage() - siz eof(m_currentPaintArtifact); | 399 memoryUsage += m_currentPaintArtifact.approximateUnsharedMemoryUsage() - siz eof(m_currentPaintArtifact); |
| 409 | 400 |
| 410 // TODO(jbroman): If display items begin to have significant external memory | 401 // TODO(jbroman): If display items begin to have significant external memory |
| 411 // usage that's not shared with the embedder, we should account for it here. | 402 // usage that's not shared with the embedder, we should account for it here. |
| 412 // | 403 // |
| 413 // External objects, shared with the embedder, such as SkPicture, should be | 404 // External objects, shared with the embedder, such as SkPicture, should be |
| 414 // excluded to avoid double counting. It is the embedder's responsibility to | 405 // excluded to avoid double counting. It is the embedder's responsibility to |
| 415 // count such objects. | 406 // count such objects. |
| 416 // | 407 // |
| 417 // At time of writing, the only known case of unshared external memory was | 408 // At time of writing, the only known case of unshared external memory was |
| 418 // the rounded clips vector in ClipDisplayItem, which is not expected to | 409 // the rounded clips vector in ClipDisplayItem, which is not expected to |
| 419 // contribute significantly to memory usage. | 410 // contribute significantly to memory usage. |
| 420 | 411 |
| 421 // Memory outside this class due to m_newDisplayItemList. | 412 // Memory outside this class due to m_newDisplayItemList. |
| 422 ASSERT(m_newDisplayItemList.isEmpty()); | 413 ASSERT(m_newDisplayItemList.isEmpty()); |
| 423 memoryUsage += m_newDisplayItemList.memoryUsageInBytes(); | 414 memoryUsage += m_newDisplayItemList.memoryUsageInBytes(); |
| 424 | 415 |
| 425 return memoryUsage; | 416 return memoryUsage; |
| 426 } | 417 } |
| 427 | 418 |
| 428 void PaintController::updateValidlyCachedClientsIfNeeded() const | 419 unsigned PaintController::nextCacheGeneration() |
| 429 { | 420 { |
| 430 if (!m_validlyCachedClientsDirty) | 421 static unsigned cacheGeneration = DisplayItemClient::kInvalidCacheGeneration ; |
| 422 ++cacheGeneration; | |
| 423 if (cacheGeneration == DisplayItemClient::kInvalidCacheGeneration) { | |
| 424 // TODO(wangxianzhu): We'll reuse an old cache generation. Should invali date all | |
| 425 // clients that are still using the old generation. | |
| 426 ++cacheGeneration; | |
| 427 } | |
| 428 return cacheGeneration; | |
| 429 } | |
| 430 | |
| 431 void PaintController::updateCacheGeneration() | |
| 432 { | |
| 433 if (!canUseClientCacheStatus()) | |
| 431 return; | 434 return; |
| 432 | 435 |
| 433 m_validlyCachedClients.clear(); | 436 m_currentCacheGeneration = nextCacheGeneration(); |
| 434 m_validlyCachedClientsDirty = false; | 437 for (const auto& item : displayItemList()) { |
| 435 | 438 if (item.isCacheable()) |
| 436 const DisplayItemClient* lastAddedClient = nullptr; | 439 item.client().setDisplayItemsCached(m_currentCacheGeneration); |
| 437 for (const DisplayItem& displayItem : m_currentPaintArtifact.displayItemList ()) { | |
| 438 if (&displayItem.client() == lastAddedClient) | |
| 439 continue; | |
| 440 if (displayItem.isCacheable()) { | |
| 441 lastAddedClient = &displayItem.client(); | |
| 442 m_validlyCachedClients.add(lastAddedClient); | |
| 443 } | |
| 444 } | 440 } |
| 445 } | 441 } |
| 446 | 442 |
| 447 #if ENABLE(ASSERT) | 443 #if ENABLE(ASSERT) |
| 448 | 444 |
| 449 void PaintController::checkUnderInvalidation(DisplayItemList::iterator& newIt, D isplayItemList::iterator& currentIt) | 445 void PaintController::checkUnderInvalidation(DisplayItemList::iterator& newIt, D isplayItemList::iterator& currentIt) |
| 450 { | 446 { |
| 451 ASSERT(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled ()); | 447 ASSERT(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled ()); |
| 452 ASSERT(newIt->isCached()); | 448 ASSERT(newIt->isCached()); |
| 453 | 449 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 { | 496 { |
| 501 ASSERT(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled ()); | 497 ASSERT(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled ()); |
| 502 ASSERT(!newItem.isCached()); | 498 ASSERT(!newItem.isCached()); |
| 503 ASSERT(!oldItem.isCached()); | 499 ASSERT(!oldItem.isCached()); |
| 504 | 500 |
| 505 if (newItem.skippedCache()) { | 501 if (newItem.skippedCache()) { |
| 506 showUnderInvalidationError(messagePrefix, "ERROR: under-invalidation: sk ipped-cache in cached subsequence", &newItem, &oldItem); | 502 showUnderInvalidationError(messagePrefix, "ERROR: under-invalidation: sk ipped-cache in cached subsequence", &newItem, &oldItem); |
| 507 ASSERT_NOT_REACHED(); | 503 ASSERT_NOT_REACHED(); |
| 508 } | 504 } |
| 509 | 505 |
| 510 if (newItem.isCacheable() && !m_validlyCachedClients.contains(&newItem.clien t())) { | 506 if (newItem.isCacheable()) { /////// EEE && !m_validlyCachedClients.contains (&newItem.client())) { |
|
pdr.
2016/01/04 21:19:30
Drive by: did you forget this?
| |
| 511 showUnderInvalidationError(messagePrefix, "ERROR: under-invalidation: in validated in cached subsequence", &newItem, &oldItem); | 507 showUnderInvalidationError(messagePrefix, "ERROR: under-invalidation: in validated in cached subsequence", &newItem, &oldItem); |
| 512 ASSERT_NOT_REACHED(); | 508 ASSERT_NOT_REACHED(); |
| 513 } | 509 } |
| 514 | 510 |
| 515 if (newItem.equals(oldItem)) | 511 if (newItem.equals(oldItem)) |
| 516 return; | 512 return; |
| 517 | 513 |
| 518 showUnderInvalidationError(messagePrefix, "ERROR: under-invalidation: displa y item changed", &newItem, &oldItem); | 514 showUnderInvalidationError(messagePrefix, "ERROR: under-invalidation: displa y item changed", &newItem, &oldItem); |
| 519 | 515 |
| 520 #ifndef NDEBUG | 516 #ifndef NDEBUG |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 549 WTF::String PaintController::displayItemListAsDebugString(const DisplayItemList& list) const | 545 WTF::String PaintController::displayItemListAsDebugString(const DisplayItemList& list) const |
| 550 { | 546 { |
| 551 StringBuilder stringBuilder; | 547 StringBuilder stringBuilder; |
| 552 size_t i = 0; | 548 size_t i = 0; |
| 553 for (auto it = list.begin(); it != list.end(); ++it, ++i) { | 549 for (auto it = list.begin(); it != list.end(); ++it, ++i) { |
| 554 const DisplayItem& displayItem = *it; | 550 const DisplayItem& displayItem = *it; |
| 555 if (i) | 551 if (i) |
| 556 stringBuilder.append(",\n"); | 552 stringBuilder.append(",\n"); |
| 557 stringBuilder.append(String::format("{index: %d, ", (int)i)); | 553 stringBuilder.append(String::format("{index: %d, ", (int)i)); |
| 558 displayItem.dumpPropertiesAsDebugString(stringBuilder); | 554 displayItem.dumpPropertiesAsDebugString(stringBuilder); |
| 559 stringBuilder.append(", cacheIsValid: "); | 555 if (displayItem.hasValidClient()) { |
| 560 stringBuilder.append(clientCacheIsValid(displayItem.client()) ? "true" : "false"); | 556 stringBuilder.append(", cacheIsValid: "); |
| 557 stringBuilder.append(clientCacheIsValid(displayItem.client()) ? "tru e" : "false"); | |
| 558 } | |
| 561 stringBuilder.append('}'); | 559 stringBuilder.append('}'); |
| 562 } | 560 } |
| 563 return stringBuilder.toString(); | 561 return stringBuilder.toString(); |
| 564 } | 562 } |
| 565 | 563 |
| 566 void PaintController::showDebugData() const | 564 void PaintController::showDebugData() const |
| 567 { | 565 { |
| 568 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.displayItemList()).utf8().data()); | 566 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.displayItemList()).utf8().data()); |
| 569 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); | 567 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); |
| 570 } | 568 } |
| 571 | 569 |
| 572 #endif // ifndef NDEBUG | 570 #endif // ifndef NDEBUG |
| 573 | 571 |
| 574 } // namespace blink | 572 } // namespace blink |
| OLD | NEW |