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/graphics/GraphicsLayer.h" | 7 #include "platform/graphics/GraphicsLayer.h" |
| 8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 9 #include "platform/instrumentation/tracing/TraceEvent.h" | 9 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 visualRectForDisplayItem(item, offsetFromLayoutObject)); | 518 visualRectForDisplayItem(item, offsetFromLayoutObject)); |
| 519 | 519 |
| 520 if (item.isCacheable()) { | 520 if (item.isCacheable()) { |
| 521 item.client().setDisplayItemsCached(m_currentCacheGeneration); | 521 item.client().setDisplayItemsCached(m_currentCacheGeneration); |
| 522 } else { | 522 } else { |
| 523 if (item.client().isJustCreated()) | 523 if (item.client().isJustCreated()) |
| 524 item.client().clearIsJustCreated(); | 524 item.client().clearIsJustCreated(); |
| 525 if (item.skippedCache()) | 525 if (item.skippedCache()) |
| 526 skippedCacheClients.push_back(&item.client()); | 526 skippedCacheClients.push_back(&item.client()); |
| 527 } | 527 } |
| 528 | |
| 529 if (UNLIKELY(!m_firstPainted) && item.isDrawing() && | |
|
pdr.
2017/01/12 22:21:55
This will still be called for all new and cached i
Xianzhu
2017/01/12 22:32:22
Done.
Considered this but thought the cost of 'if
| |
| 530 // Here we ignore all document-background paintings because we don't | |
| 531 // know if the background is default. ViewPainter should have called | |
| 532 // setFirstPainted() if this display item is for non-default background. | |
| 533 item.getType() != DisplayItem::kDocumentBackground && | |
| 534 item.drawsContent()) { | |
| 535 m_firstPainted = true; | |
| 536 } | |
| 528 } | 537 } |
| 529 | 538 |
| 530 for (auto* client : skippedCacheClients) | 539 for (auto* client : skippedCacheClients) |
| 531 client->setDisplayItemsUncached(); | 540 client->setDisplayItemsUncached(); |
| 532 | 541 |
| 533 // The new list will not be appended to again so we can release unused memory. | 542 // The new list will not be appended to again so we can release unused memory. |
| 534 m_newDisplayItemList.shrinkToFit(); | 543 m_newDisplayItemList.shrinkToFit(); |
| 535 m_currentPaintArtifact = PaintArtifact( | 544 m_currentPaintArtifact = PaintArtifact( |
| 536 std::move(m_newDisplayItemList), m_newPaintChunks.releasePaintChunks(), | 545 std::move(m_newDisplayItemList), m_newPaintChunks.releasePaintChunks(), |
| 537 gpuAnalyzer.suitableForGpuRasterization()); | 546 gpuAnalyzer.suitableForGpuRasterization()); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 0, m_newDisplayItemList.size(), | 855 0, m_newDisplayItemList.size(), |
| 847 showPictures ? (DisplayItemList::JsonOptions::ShowPictures | | 856 showPictures ? (DisplayItemList::JsonOptions::ShowPictures | |
| 848 DisplayItemList::JsonOptions::ShowClientDebugName) | 857 DisplayItemList::JsonOptions::ShowClientDebugName) |
| 849 : DisplayItemList::JsonOptions::ShowClientDebugName) | 858 : DisplayItemList::JsonOptions::ShowClientDebugName) |
| 850 ->toPrettyJSONString() | 859 ->toPrettyJSONString() |
| 851 .utf8() | 860 .utf8() |
| 852 .data()); | 861 .data()); |
| 853 } | 862 } |
| 854 | 863 |
| 855 } // namespace blink | 864 } // namespace blink |
| OLD | NEW |