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

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

Issue 2885773002: Revert of Notify paint for each frame (Closed)
Patch Set: Created 3 years, 7 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 new_display_item_list_[index].AsDebugString().Utf8().data(), index); 293 new_display_item_list_[index].AsDebugString().Utf8().data(), index);
294 #endif 294 #endif
295 NOTREACHED(); 295 NOTREACHED();
296 } 296 }
297 AddItemToIndexIfNeeded(display_item, new_display_item_list_.size() - 1, 297 AddItemToIndexIfNeeded(display_item, new_display_item_list_.size() - 1,
298 new_display_item_indices_by_client_); 298 new_display_item_indices_by_client_);
299 #endif // DCHECK_IS_ON() 299 #endif // DCHECK_IS_ON()
300 300
301 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) 301 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled())
302 CheckUnderInvalidation(); 302 CheckUnderInvalidation();
303
304 if (!frame_first_paints_.back().first_painted && display_item.IsDrawing() &&
305 // Here we ignore all document-background paintings because we don't
306 // know if the background is default. ViewPainter should have called
307 // setFirstPainted() if this display item is for non-default
308 // background.
309 display_item.GetType() != DisplayItem::kDocumentBackground &&
310 display_item.DrawsContent()) {
311 SetFirstPainted();
312 }
313 } 303 }
314 304
315 DisplayItem& PaintController::MoveItemFromCurrentListToNewList(size_t index) { 305 DisplayItem& PaintController::MoveItemFromCurrentListToNewList(size_t index) {
316 items_moved_into_new_list_.resize( 306 items_moved_into_new_list_.resize(
317 current_paint_artifact_.GetDisplayItemList().size()); 307 current_paint_artifact_.GetDisplayItemList().size());
318 items_moved_into_new_list_[index] = new_display_item_list_.size(); 308 items_moved_into_new_list_[index] = new_display_item_list_.size();
319 return new_display_item_list_.AppendByMoving( 309 return new_display_item_list_.AppendByMoving(
320 current_paint_artifact_.GetDisplayItemList()[index]); 310 current_paint_artifact_.GetDisplayItemList()[index]);
321 } 311 }
322 312
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 if (item.IsCacheable()) { 585 if (item.IsCacheable()) {
596 item.Client().SetDisplayItemsCached(current_cache_generation_); 586 item.Client().SetDisplayItemsCached(current_cache_generation_);
597 } else { 587 } else {
598 if (item.Client().IsJustCreated()) 588 if (item.Client().IsJustCreated())
599 item.Client().ClearIsJustCreated(); 589 item.Client().ClearIsJustCreated();
600 if (item.SkippedCache()) 590 if (item.SkippedCache())
601 skipped_cache_clients.push_back(&item.Client()); 591 skipped_cache_clients.push_back(&item.Client());
602 } 592 }
603 } 593 }
604 594
595 if (!first_painted_) {
596 for (const auto& item : new_display_item_list_) {
597 if (item.IsDrawing() &&
598 // Here we ignore all document-background paintings because we don't
599 // know if the background is default. ViewPainter should have called
600 // setFirstPainted() if this display item is for non-default
601 // background.
602 item.GetType() != DisplayItem::kDocumentBackground &&
603 item.DrawsContent()) {
604 first_painted_ = true;
605 break;
606 }
607 }
608 }
609
605 for (auto* client : skipped_cache_clients) 610 for (auto* client : skipped_cache_clients)
606 client->SetDisplayItemsUncached(); 611 client->SetDisplayItemsUncached();
607 612
608 // The new list will not be appended to again so we can release unused memory. 613 // The new list will not be appended to again so we can release unused memory.
609 new_display_item_list_.ShrinkToFit(); 614 new_display_item_list_.ShrinkToFit();
610 615
611 if (raster_invalidation_tracking_info_) { 616 if (raster_invalidation_tracking_info_) {
612 for (const auto& chunk : current_paint_artifact_.PaintChunks()) 617 for (const auto& chunk : current_paint_artifact_.PaintChunks())
613 raster_invalidation_tracking_info_->map.Remove(&chunk); 618 raster_invalidation_tracking_info_->map.Remove(&chunk);
614 } 619 }
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 0, new_display_item_list_.size(), 977 0, new_display_item_list_.size(),
973 show_paint_records 978 show_paint_records
974 ? (DisplayItemList::JsonOptions::kShowPaintRecords | 979 ? (DisplayItemList::JsonOptions::kShowPaintRecords |
975 DisplayItemList::JsonOptions::kShowClientDebugName) 980 DisplayItemList::JsonOptions::kShowClientDebugName)
976 : DisplayItemList::JsonOptions::kShowClientDebugName) 981 : DisplayItemList::JsonOptions::kShowClientDebugName)
977 ->ToPrettyJSONString() 982 ->ToPrettyJSONString()
978 .Utf8() 983 .Utf8()
979 .data()); 984 .data());
980 } 985 }
981 986
982 void PaintController::SetFirstPainted() {
983 frame_first_paints_.back().first_painted = true;
984 }
985
986 void PaintController::SetTextPainted() {
987 frame_first_paints_.back().text_painted = true;
988 }
989
990 void PaintController::SetImagePainted() {
991 frame_first_paints_.back().image_painted = true;
992 }
993
994 void PaintController::BeginFrame(const void* frame) {
995 frame_first_paints_.push_back(FrameFirstPaint(frame));
996 }
997
998 FrameFirstPaint PaintController::EndFrame(const void* frame) {
999 FrameFirstPaint result = frame_first_paints_.back();
1000 DCHECK(result.frame == frame);
1001 frame_first_paints_.pop_back();
1002 return result;
1003 }
1004
1005 } // namespace blink 987 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698