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 DLOG(INFO) << "DisplayItem " << display_item.AsDebugString().Utf8().data() |
| 291 "DisplayItem %s has duplicated id with previous %s (index=%zu)\n", | 291 << " has duplicated id with previous " |
| 292 display_item.AsDebugString().Utf8().data(), | 292 << new_display_item_list_[index].AsDebugString().Utf8().data() |
| 293 new_display_item_list_[index].AsDebugString().Utf8().data(), index); | 293 << " (index=" << index << ")"; |
|
Stephen Chennney
2017/08/02 13:23:45
Same issue with unnecessary .Utf8().data()
| |
| 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 | 303 |
| (...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, | 954 // non-under-invalidation-checking path to empty the original cached slot, |
| 955 // leaving only disappeared or invalidated display items in the old list after | 955 // leaving only disappeared or invalidated display items in the old list after |
| 956 // painting. | 956 // painting. |
| 957 new_display_item_list_.RemoveLast(); | 957 new_display_item_list_.RemoveLast(); |
| 958 MoveItemFromCurrentListToNewList(old_item_index); | 958 MoveItemFromCurrentListToNewList(old_item_index); |
| 959 | 959 |
| 960 ++under_invalidation_checking_begin_; | 960 ++under_invalidation_checking_begin_; |
| 961 } | 961 } |
| 962 | 962 |
| 963 void PaintController::ShowDebugDataInternal(bool show_paint_records) const { | 963 void PaintController::ShowDebugDataInternal(bool show_paint_records) const { |
| 964 WTFLogAlways("current display item list: [%s]\n", | 964 DLOG(INFO) << "\n" |
| 965 current_paint_artifact_.GetDisplayItemList() | 965 << "current display item list: [" |
| 966 .SubsequenceAsJSON( | 966 << current_paint_artifact_.GetDisplayItemList() |
| 967 0, current_paint_artifact_.GetDisplayItemList().size(), | 967 .SubsequenceAsJSON( |
| 968 show_paint_records | 968 0, current_paint_artifact_.GetDisplayItemList().size(), |
| 969 ? DisplayItemList::JsonOptions::kShowPaintRecords | 969 show_paint_records |
| 970 : DisplayItemList::JsonOptions::kDefault) | 970 ? DisplayItemList::JsonOptions::kShowPaintRecords |
| 971 ->ToPrettyJSONString() | 971 : DisplayItemList::JsonOptions::kDefault) |
| 972 .Utf8() | 972 ->ToPrettyJSONString() |
| 973 .data()); | 973 .Utf8() |
| 974 .data() | |
| 975 << "]"; | |
|
Stephen Chennney
2017/08/02 13:23:45
Ditto.
| |
| 974 // debugName() and clientCacheIsValid() can only be called on a live | 976 // debugName() and clientCacheIsValid() can only be called on a live |
| 975 // client, so only output it for m_newDisplayItemList, in which we are | 977 // client, so only output it for m_newDisplayItemList, in which we are |
| 976 // sure the clients are all alive. | 978 // sure the clients are all alive. |
| 977 WTFLogAlways( | 979 DLOG(INFO) |
| 978 "new display item list: [%s]\n", | 980 << "\n" |
| 979 new_display_item_list_ | 981 << "new display item list: [" |
| 980 .SubsequenceAsJSON( | 982 << new_display_item_list_ |
| 981 0, new_display_item_list_.size(), | 983 .SubsequenceAsJSON( |
| 982 show_paint_records | 984 0, new_display_item_list_.size(), |
| 983 ? (DisplayItemList::JsonOptions::kShowPaintRecords | | 985 show_paint_records |
| 984 DisplayItemList::JsonOptions::kShowClientDebugName) | 986 ? (DisplayItemList::JsonOptions::kShowPaintRecords | |
| 985 : DisplayItemList::JsonOptions::kShowClientDebugName) | 987 DisplayItemList::JsonOptions::kShowClientDebugName) |
| 986 ->ToPrettyJSONString() | 988 : DisplayItemList::JsonOptions::kShowClientDebugName) |
| 987 .Utf8() | 989 ->ToPrettyJSONString() |
| 988 .data()); | 990 .Utf8() |
| 991 .data() | |
| 992 << "]"; | |
|
Stephen Chennney
2017/08/02 13:23:45
Ditto.
| |
| 989 } | 993 } |
| 990 | 994 |
| 991 void PaintController::SetFirstPainted() { | 995 void PaintController::SetFirstPainted() { |
| 992 frame_first_paints_.back().first_painted = true; | 996 frame_first_paints_.back().first_painted = true; |
| 993 } | 997 } |
| 994 | 998 |
| 995 void PaintController::SetTextPainted() { | 999 void PaintController::SetTextPainted() { |
| 996 frame_first_paints_.back().text_painted = true; | 1000 frame_first_paints_.back().text_painted = true; |
| 997 } | 1001 } |
| 998 | 1002 |
| 999 void PaintController::SetImagePainted() { | 1003 void PaintController::SetImagePainted() { |
| 1000 frame_first_paints_.back().image_painted = true; | 1004 frame_first_paints_.back().image_painted = true; |
| 1001 } | 1005 } |
| 1002 | 1006 |
| 1003 void PaintController::BeginFrame(const void* frame) { | 1007 void PaintController::BeginFrame(const void* frame) { |
| 1004 frame_first_paints_.push_back(FrameFirstPaint(frame)); | 1008 frame_first_paints_.push_back(FrameFirstPaint(frame)); |
| 1005 } | 1009 } |
| 1006 | 1010 |
| 1007 FrameFirstPaint PaintController::EndFrame(const void* frame) { | 1011 FrameFirstPaint PaintController::EndFrame(const void* frame) { |
| 1008 FrameFirstPaint result = frame_first_paints_.back(); | 1012 FrameFirstPaint result = frame_first_paints_.back(); |
| 1009 DCHECK(result.frame == frame); | 1013 DCHECK(result.frame == frame); |
| 1010 frame_first_paints_.pop_back(); | 1014 frame_first_paints_.pop_back(); |
| 1011 return result; | 1015 return result; |
| 1012 } | 1016 } |
| 1013 | 1017 |
| 1014 } // namespace blink | 1018 } // namespace blink |
| OLD | NEW |