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 "platform/wtf/AutoReset.h" | 10 #include "platform/wtf/AutoReset.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 "under-invalidation: new subsequence wrong length", client, start, | 156 "under-invalidation: new subsequence wrong length", client, start, |
| 157 end); | 157 end); |
| 158 CHECK(false); | 158 CHECK(false); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 DCHECK(new_cached_subsequences_.Find(&client) == | 162 DCHECK(new_cached_subsequences_.Find(&client) == |
| 163 new_cached_subsequences_.end()); | 163 new_cached_subsequences_.end()); |
| 164 | 164 |
| 165 new_cached_subsequences_.insert(&client, SubsequenceMarkers(start, end)); | 165 new_cached_subsequences_.insert(&client, SubsequenceMarkers(start, end)); |
| 166 last_cached_subsequence_end_ = end; | |
| 166 } | 167 } |
| 167 | 168 |
| 168 bool PaintController::LastDisplayItemIsNoopBegin() const { | 169 bool PaintController::LastDisplayItemIsNoopBegin() const { |
| 169 if (new_display_item_list_.IsEmpty()) | 170 if (new_display_item_list_.IsEmpty()) |
| 170 return false; | 171 return false; |
| 171 | 172 |
| 172 const auto& last_display_item = new_display_item_list_.Last(); | 173 const auto& last_display_item = new_display_item_list_.Last(); |
| 173 return last_display_item.IsBegin() && !last_display_item.DrawsContent(); | 174 return last_display_item.IsBegin() && !last_display_item.DrawsContent(); |
| 174 } | 175 } |
| 175 | 176 |
| 177 bool PaintController::LastDisplayItemIsSubsequenceEnd() const { | |
| 178 return last_cached_subsequence_end_ == new_display_item_list_.size() - 1; | |
|
wkorman
2017/04/11 20:52:25
We initialize last_cached_subsequence_end_ to 0, a
chrishtr
2017/04/11 21:09:10
Fixed.
| |
| 179 } | |
| 180 | |
| 176 void PaintController::RemoveLastDisplayItem() { | 181 void PaintController::RemoveLastDisplayItem() { |
| 177 if (new_display_item_list_.IsEmpty()) | 182 if (new_display_item_list_.IsEmpty()) |
| 178 return; | 183 return; |
| 179 | 184 |
| 180 #if DCHECK_IS_ON() | 185 #if DCHECK_IS_ON() |
| 181 // Also remove the index pointing to the removed display item. | 186 // Also remove the index pointing to the removed display item. |
| 182 IndicesByClientMap::iterator it = new_display_item_indices_by_client_.Find( | 187 IndicesByClientMap::iterator it = new_display_item_indices_by_client_.Find( |
| 183 &new_display_item_list_.Last().Client()); | 188 &new_display_item_list_.Last().Client()); |
| 184 if (it != new_display_item_indices_by_client_.end()) { | 189 if (it != new_display_item_indices_by_client_.end()) { |
| 185 Vector<size_t>& indices = it->value; | 190 Vector<size_t>& indices = it->value; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 !new_display_item_list_.IsEmpty()) | 534 !new_display_item_list_.IsEmpty()) |
| 530 GenerateChunkRasterInvalidationRects(new_paint_chunks_.LastChunk()); | 535 GenerateChunkRasterInvalidationRects(new_paint_chunks_.LastChunk()); |
| 531 | 536 |
| 532 SkPictureGpuAnalyzer gpu_analyzer; | 537 SkPictureGpuAnalyzer gpu_analyzer; |
| 533 | 538 |
| 534 current_cache_generation_ = | 539 current_cache_generation_ = |
| 535 DisplayItemClient::CacheGenerationOrInvalidationReason::Next(); | 540 DisplayItemClient::CacheGenerationOrInvalidationReason::Next(); |
| 536 | 541 |
| 537 new_cached_subsequences_.Swap(current_cached_subsequences_); | 542 new_cached_subsequences_.Swap(current_cached_subsequences_); |
| 538 new_cached_subsequences_.Clear(); | 543 new_cached_subsequences_.Clear(); |
| 544 last_cached_subsequence_end_ = 0; | |
| 539 for (auto& item : current_cached_subsequences_) { | 545 for (auto& item : current_cached_subsequences_) { |
| 540 item.key->SetDisplayItemsCached(current_cache_generation_); | 546 item.key->SetDisplayItemsCached(current_cache_generation_); |
| 541 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 547 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 542 DisplayItemClient::EndShouldKeepAliveAllClients(item.key); | 548 DisplayItemClient::EndShouldKeepAliveAllClients(item.key); |
| 543 #endif | 549 #endif |
| 544 } | 550 } |
| 545 | 551 |
| 546 Vector<const DisplayItemClient*> skipped_cache_clients; | 552 Vector<const DisplayItemClient*> skipped_cache_clients; |
| 547 for (const auto& item : new_display_item_list_) { | 553 for (const auto& item : new_display_item_list_) { |
| 548 // No reason to continue the analysis once we have a veto. | 554 // No reason to continue the analysis once we have a veto. |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 924 show_paint_records | 930 show_paint_records |
| 925 ? (DisplayItemList::JsonOptions::kShowPaintRecords | | 931 ? (DisplayItemList::JsonOptions::kShowPaintRecords | |
| 926 DisplayItemList::JsonOptions::kShowClientDebugName) | 932 DisplayItemList::JsonOptions::kShowClientDebugName) |
| 927 : DisplayItemList::JsonOptions::kShowClientDebugName) | 933 : DisplayItemList::JsonOptions::kShowClientDebugName) |
| 928 ->ToPrettyJSONString() | 934 ->ToPrettyJSONString() |
| 929 .Utf8() | 935 .Utf8() |
| 930 .Data()); | 936 .Data()); |
| 931 } | 937 } |
| 932 | 938 |
| 933 } // namespace blink | 939 } // namespace blink |
| OLD | NEW |