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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 if (begin_display_item.IsBegin() && !begin_display_item.DrawsContent()) | 280 if (begin_display_item.IsBegin() && !begin_display_item.DrawsContent()) |
| 281 DCHECK(!display_item.IsEndAndPairedWith(begin_display_item.GetType())); | 281 DCHECK(!display_item.IsEndAndPairedWith(begin_display_item.GetType())); |
| 282 } | 282 } |
| 283 | 283 |
| 284 size_t index = FindMatchingItemFromIndex(display_item.GetId(), | 284 size_t index = FindMatchingItemFromIndex(display_item.GetId(), |
| 285 new_display_item_indices_by_client_, | 285 new_display_item_indices_by_client_, |
| 286 new_display_item_list_); | 286 new_display_item_list_); |
| 287 if (index != kNotFound) { | 287 if (index != kNotFound) { |
| 288 #ifndef NDEBUG | 288 #ifndef NDEBUG |
| 289 ShowDebugData(); | 289 ShowDebugData(); |
| 290 WTFLogAlways( | 290 LOG(INFO) << "\n" |
|
tkent
2017/06/14 23:27:11
Does DisplayItem::AsDebugString() produces multi-l
| |
| 291 "DisplayItem %s has duplicated id with previous %s (index=%zu)\n", | 291 << "DisplayItem " << display_item.AsDebugString().Utf8().data() |
|
tkent
2017/06/14 23:27:11
probably we should change DisplayItem::AsDebugStri
| |
| 292 display_item.AsDebugString().Utf8().data(), | 292 << " has duplicated id with previous " |
| 293 new_display_item_list_[index].AsDebugString().Utf8().data(), index); | 293 << new_display_item_list_[index].AsDebugString().Utf8().data() |
| 294 << " (index=" << index << ")\n"; | |
|
tkent
2017/06/14 23:27:11
The trailing \n is unnecessary.
| |
| 294 #endif | 295 #endif |
| 295 NOTREACHED(); | 296 NOTREACHED(); |
| 296 } | 297 } |
| 297 AddItemToIndexIfNeeded(display_item, new_display_item_list_.size() - 1, | 298 AddItemToIndexIfNeeded(display_item, new_display_item_list_.size() - 1, |
| 298 new_display_item_indices_by_client_); | 299 new_display_item_indices_by_client_); |
| 299 #endif // DCHECK_IS_ON() | 300 #endif // DCHECK_IS_ON() |
| 300 | 301 |
| 301 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) | 302 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) |
| 302 CheckUnderInvalidation(); | 303 CheckUnderInvalidation(); |
| 303 | 304 |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 954 // non-under-invalidation-checking path to empty the original cached slot, | 955 // non-under-invalidation-checking path to empty the original cached slot, |
| 955 // leaving only disappeared or invalidated display items in the old list after | 956 // leaving only disappeared or invalidated display items in the old list after |
| 956 // painting. | 957 // painting. |
| 957 new_display_item_list_.RemoveLast(); | 958 new_display_item_list_.RemoveLast(); |
| 958 MoveItemFromCurrentListToNewList(old_item_index); | 959 MoveItemFromCurrentListToNewList(old_item_index); |
| 959 | 960 |
| 960 ++under_invalidation_checking_begin_; | 961 ++under_invalidation_checking_begin_; |
| 961 } | 962 } |
| 962 | 963 |
| 963 void PaintController::ShowDebugDataInternal(bool show_paint_records) const { | 964 void PaintController::ShowDebugDataInternal(bool show_paint_records) const { |
| 964 WTFLogAlways("current display item list: [%s]\n", | 965 LOG(INFO) << "\n" |
| 965 current_paint_artifact_.GetDisplayItemList() | 966 << "current display item list: [" |
| 967 << current_paint_artifact_.GetDisplayItemList() | |
| 966 .SubsequenceAsJSON( | 968 .SubsequenceAsJSON( |
| 967 0, current_paint_artifact_.GetDisplayItemList().size(), | 969 0, current_paint_artifact_.GetDisplayItemList().size(), |
| 968 show_paint_records | 970 show_paint_records |
| 969 ? DisplayItemList::JsonOptions::kShowPaintRecords | 971 ? DisplayItemList::JsonOptions::kShowPaintRecords |
| 970 : DisplayItemList::JsonOptions::kDefault) | 972 : DisplayItemList::JsonOptions::kDefault) |
| 971 ->ToPrettyJSONString() | 973 ->ToPrettyJSONString() |
| 972 .Utf8() | 974 .Utf8() |
| 973 .data()); | 975 .data() |
| 976 << "]\n"; | |
|
tkent
2017/06/14 23:27:11
The trailing \n is unnecessary.
| |
| 974 // debugName() and clientCacheIsValid() can only be called on a live | 977 // debugName() and clientCacheIsValid() can only be called on a live |
| 975 // client, so only output it for m_newDisplayItemList, in which we are | 978 // client, so only output it for m_newDisplayItemList, in which we are |
| 976 // sure the clients are all alive. | 979 // sure the clients are all alive. |
| 977 WTFLogAlways( | 980 LOG(INFO) |
| 978 "new display item list: [%s]\n", | 981 << "\n" |
| 979 new_display_item_list_ | 982 << "new display item list: [" |
| 980 .SubsequenceAsJSON( | 983 << new_display_item_list_ |
| 981 0, new_display_item_list_.size(), | 984 .SubsequenceAsJSON( |
| 982 show_paint_records | 985 0, new_display_item_list_.size(), |
| 983 ? (DisplayItemList::JsonOptions::kShowPaintRecords | | 986 show_paint_records |
| 984 DisplayItemList::JsonOptions::kShowClientDebugName) | 987 ? (DisplayItemList::JsonOptions::kShowPaintRecords | |
| 985 : DisplayItemList::JsonOptions::kShowClientDebugName) | 988 DisplayItemList::JsonOptions::kShowClientDebugName) |
| 986 ->ToPrettyJSONString() | 989 : DisplayItemList::JsonOptions::kShowClientDebugName) |
| 987 .Utf8() | 990 ->ToPrettyJSONString() |
| 988 .data()); | 991 .Utf8() |
| 992 .data() | |
| 993 << "]\n"; | |
|
tkent
2017/06/14 23:27:11
The trailing \n is unnecessary.
| |
| 989 } | 994 } |
| 990 | 995 |
| 991 void PaintController::SetFirstPainted() { | 996 void PaintController::SetFirstPainted() { |
| 992 frame_first_paints_.back().first_painted = true; | 997 frame_first_paints_.back().first_painted = true; |
| 993 } | 998 } |
| 994 | 999 |
| 995 void PaintController::SetTextPainted() { | 1000 void PaintController::SetTextPainted() { |
| 996 frame_first_paints_.back().text_painted = true; | 1001 frame_first_paints_.back().text_painted = true; |
| 997 } | 1002 } |
| 998 | 1003 |
| 999 void PaintController::SetImagePainted() { | 1004 void PaintController::SetImagePainted() { |
| 1000 frame_first_paints_.back().image_painted = true; | 1005 frame_first_paints_.back().image_painted = true; |
| 1001 } | 1006 } |
| 1002 | 1007 |
| 1003 void PaintController::BeginFrame(const void* frame) { | 1008 void PaintController::BeginFrame(const void* frame) { |
| 1004 frame_first_paints_.push_back(FrameFirstPaint(frame)); | 1009 frame_first_paints_.push_back(FrameFirstPaint(frame)); |
| 1005 } | 1010 } |
| 1006 | 1011 |
| 1007 FrameFirstPaint PaintController::EndFrame(const void* frame) { | 1012 FrameFirstPaint PaintController::EndFrame(const void* frame) { |
| 1008 FrameFirstPaint result = frame_first_paints_.back(); | 1013 FrameFirstPaint result = frame_first_paints_.back(); |
| 1009 DCHECK(result.frame == frame); | 1014 DCHECK(result.frame == frame); |
| 1010 frame_first_paints_.pop_back(); | 1015 frame_first_paints_.pop_back(); |
| 1011 return result; | 1016 return result; |
| 1012 } | 1017 } |
| 1013 | 1018 |
| 1014 } // namespace blink | 1019 } // namespace blink |
| OLD | NEW |