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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 | 166 |
167 const DisplayItem* PaintController::lastDisplayItem(unsigned offset) { | 167 const DisplayItem* PaintController::lastDisplayItem(unsigned offset) { |
168 if (offset < m_newDisplayItemList.size()) | 168 if (offset < m_newDisplayItemList.size()) |
169 return &m_newDisplayItemList[m_newDisplayItemList.size() - offset - 1]; | 169 return &m_newDisplayItemList[m_newDisplayItemList.size() - offset - 1]; |
170 return nullptr; | 170 return nullptr; |
171 } | 171 } |
172 | 172 |
173 void PaintController::processNewItem(DisplayItem& displayItem) { | 173 void PaintController::processNewItem(DisplayItem& displayItem) { |
174 DCHECK(!m_constructionDisabled); | 174 DCHECK(!m_constructionDisabled); |
175 | 175 |
176 if (!m_firstPainted && displayItem.isDrawing() && | |
pdr.
2017/01/12 21:56:45
processNewItem is pretty hot so I'm worried about
Xianzhu
2017/01/12 22:13:39
Good idea. Done.
| |
177 // Here we ignore all document-background paintings because we don't know | |
178 // if the background is default. ViewPainter should have called | |
179 // setFirstPainted() if this display item is for non-default background. | |
180 displayItem.getType() != DisplayItem::kDocumentBackground && | |
181 displayItem.drawsContent()) { | |
182 m_firstPainted = true; | |
183 } | |
184 | |
176 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 185 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
177 if (!isSkippingCache()) { | 186 if (!isSkippingCache()) { |
178 if (displayItem.isCacheable()) { | 187 if (displayItem.isCacheable()) { |
179 // Mark the client shouldKeepAlive under this PaintController. | 188 // Mark the client shouldKeepAlive under this PaintController. |
180 // The status will end after the new display items are committed. | 189 // The status will end after the new display items are committed. |
181 displayItem.client().beginShouldKeepAlive(this); | 190 displayItem.client().beginShouldKeepAlive(this); |
182 | 191 |
183 if (!m_currentSubsequenceClients.isEmpty()) { | 192 if (!m_currentSubsequenceClients.isEmpty()) { |
184 // Mark the client shouldKeepAlive under the current subsequence. | 193 // Mark the client shouldKeepAlive under the current subsequence. |
185 // The status will end when the subsequence owner is invalidated or | 194 // The status will end when the subsequence owner is invalidated or |
(...skipping 660 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 |