Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp

Issue 2812103002: Don't allow the composited-alpha folding optimization to cross subsequences (Closed)
Patch Set: none Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 !new_cached_subsequences_.IsEmpty() &&
179 last_cached_subsequence_end_ == new_display_item_list_.size() - 1;
180 }
181
176 void PaintController::RemoveLastDisplayItem() { 182 void PaintController::RemoveLastDisplayItem() {
177 if (new_display_item_list_.IsEmpty()) 183 if (new_display_item_list_.IsEmpty())
178 return; 184 return;
179 185
180 #if DCHECK_IS_ON() 186 #if DCHECK_IS_ON()
181 // Also remove the index pointing to the removed display item. 187 // Also remove the index pointing to the removed display item.
182 IndicesByClientMap::iterator it = new_display_item_indices_by_client_.Find( 188 IndicesByClientMap::iterator it = new_display_item_indices_by_client_.Find(
183 &new_display_item_list_.Last().Client()); 189 &new_display_item_list_.Last().Client());
184 if (it != new_display_item_indices_by_client_.end()) { 190 if (it != new_display_item_indices_by_client_.end()) {
185 Vector<size_t>& indices = it->value; 191 Vector<size_t>& indices = it->value;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 !new_display_item_list_.IsEmpty()) 535 !new_display_item_list_.IsEmpty())
530 GenerateChunkRasterInvalidationRects(new_paint_chunks_.LastChunk()); 536 GenerateChunkRasterInvalidationRects(new_paint_chunks_.LastChunk());
531 537
532 SkPictureGpuAnalyzer gpu_analyzer; 538 SkPictureGpuAnalyzer gpu_analyzer;
533 539
534 current_cache_generation_ = 540 current_cache_generation_ =
535 DisplayItemClient::CacheGenerationOrInvalidationReason::Next(); 541 DisplayItemClient::CacheGenerationOrInvalidationReason::Next();
536 542
537 new_cached_subsequences_.Swap(current_cached_subsequences_); 543 new_cached_subsequences_.Swap(current_cached_subsequences_);
538 new_cached_subsequences_.Clear(); 544 new_cached_subsequences_.Clear();
545 last_cached_subsequence_end_ = 0;
539 for (auto& item : current_cached_subsequences_) { 546 for (auto& item : current_cached_subsequences_) {
540 item.key->SetDisplayItemsCached(current_cache_generation_); 547 item.key->SetDisplayItemsCached(current_cache_generation_);
541 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 548 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
542 DisplayItemClient::EndShouldKeepAliveAllClients(item.key); 549 DisplayItemClient::EndShouldKeepAliveAllClients(item.key);
543 #endif 550 #endif
544 } 551 }
545 552
546 Vector<const DisplayItemClient*> skipped_cache_clients; 553 Vector<const DisplayItemClient*> skipped_cache_clients;
547 for (const auto& item : new_display_item_list_) { 554 for (const auto& item : new_display_item_list_) {
548 // No reason to continue the analysis once we have a veto. 555 // No reason to continue the analysis once we have a veto.
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 show_paint_records 931 show_paint_records
925 ? (DisplayItemList::JsonOptions::kShowPaintRecords | 932 ? (DisplayItemList::JsonOptions::kShowPaintRecords |
926 DisplayItemList::JsonOptions::kShowClientDebugName) 933 DisplayItemList::JsonOptions::kShowClientDebugName)
927 : DisplayItemList::JsonOptions::kShowClientDebugName) 934 : DisplayItemList::JsonOptions::kShowClientDebugName)
928 ->ToPrettyJSONString() 935 ->ToPrettyJSONString()
929 .Utf8() 936 .Utf8()
930 .Data()); 937 .Data());
931 } 938 }
932 939
933 } // namespace blink 940 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698