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

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

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: danakj review Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/PaintArtifact.h" 5 #include "platform/graphics/paint/PaintArtifact.h"
6 6
7 #include "cc/paint/display_item_list.h" 7 #include "cc/paint/display_item_list.h"
8 #include "platform/geometry/IntRect.h" 8 #include "platform/geometry/IntRect.h"
9 #include "platform/graphics/GraphicsLayer.h" 9 #include "platform/graphics/GraphicsLayer.h"
10 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" 10 #include "platform/graphics/compositing/PaintChunksToCcLayer.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 } 40 }
41 chunk.bounds = bounds; 41 chunk.bounds = bounds;
42 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds))) 42 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds)))
43 chunk.known_to_be_opaque = true; 43 chunk.known_to_be_opaque = true;
44 } 44 }
45 } 45 }
46 46
47 } // namespace 47 } // namespace
48 48
49 PaintArtifact::PaintArtifact() 49 PaintArtifact::PaintArtifact() : display_item_list_(0) {}
50 : display_item_list_(0), is_suitable_for_gpu_rasterization_(true) {}
51 50
52 PaintArtifact::PaintArtifact(DisplayItemList display_items, 51 PaintArtifact::PaintArtifact(DisplayItemList display_items,
53 Vector<PaintChunk> paint_chunks, 52 Vector<PaintChunk> paint_chunks,
54 bool is_suitable_for_gpu_rasterization_arg) 53 int num_slow_paths)
55 : display_item_list_(std::move(display_items)), 54 : display_item_list_(std::move(display_items)),
56 paint_chunks_(std::move(paint_chunks)), 55 paint_chunks_(std::move(paint_chunks)),
57 is_suitable_for_gpu_rasterization_( 56 num_slow_paths_(num_slow_paths) {
58 is_suitable_for_gpu_rasterization_arg) {
59 ComputeChunkBoundsAndOpaqueness(display_item_list_, paint_chunks_); 57 ComputeChunkBoundsAndOpaqueness(display_item_list_, paint_chunks_);
60 } 58 }
61 59
62 PaintArtifact::PaintArtifact(PaintArtifact&& source) 60 PaintArtifact::PaintArtifact(PaintArtifact&& source)
63 : display_item_list_(std::move(source.display_item_list_)), 61 : display_item_list_(std::move(source.display_item_list_)),
64 paint_chunks_(std::move(source.paint_chunks_)), 62 paint_chunks_(std::move(source.paint_chunks_)),
65 is_suitable_for_gpu_rasterization_( 63 num_slow_paths_(source.num_slow_paths_) {}
66 source.is_suitable_for_gpu_rasterization_) {}
67 64
68 PaintArtifact::~PaintArtifact() {} 65 PaintArtifact::~PaintArtifact() {}
69 66
70 PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) { 67 PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) {
71 display_item_list_ = std::move(source.display_item_list_); 68 display_item_list_ = std::move(source.display_item_list_);
72 paint_chunks_ = std::move(source.paint_chunks_); 69 paint_chunks_ = std::move(source.paint_chunks_);
73 is_suitable_for_gpu_rasterization_ = 70 num_slow_paths_ = source.num_slow_paths_;
74 source.is_suitable_for_gpu_rasterization_;
75 return *this; 71 return *this;
76 } 72 }
77 73
78 void PaintArtifact::Reset() { 74 void PaintArtifact::Reset() {
79 display_item_list_.Clear(); 75 display_item_list_.Clear();
80 paint_chunks_.clear(); 76 paint_chunks_.clear();
77 num_slow_paths_ = 0;
81 } 78 }
82 79
83 size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const { 80 size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const {
84 return sizeof(*this) + display_item_list_.MemoryUsageInBytes() + 81 return sizeof(*this) + display_item_list_.MemoryUsageInBytes() +
85 paint_chunks_.capacity() * sizeof(paint_chunks_[0]); 82 paint_chunks_.capacity() * sizeof(paint_chunks_[0]);
86 } 83 }
87 84
88 void PaintArtifact::Replay(const FloatRect& bounds, 85 void PaintArtifact::Replay(const FloatRect& bounds,
89 GraphicsContext& graphics_context) const { 86 GraphicsContext& graphics_context) const {
90 TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay"); 87 TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay");
(...skipping 23 matching lines...) Expand all
114 canvas.drawDisplayItemList(display_item_list); 111 canvas.drawDisplayItemList(display_item_list);
115 } 112 }
116 113
117 DISABLE_CFI_PERF 114 DISABLE_CFI_PERF
118 void PaintArtifact::AppendToWebDisplayItemList( 115 void PaintArtifact::AppendToWebDisplayItemList(
119 const LayoutSize& visual_rect_offset, 116 const LayoutSize& visual_rect_offset,
120 WebDisplayItemList* list) const { 117 WebDisplayItemList* list) const {
121 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList"); 118 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList");
122 for (const DisplayItem& item : display_item_list_) 119 for (const DisplayItem& item : display_item_list_)
123 item.AppendToWebDisplayItemList(visual_rect_offset, list); 120 item.AppendToWebDisplayItemList(visual_rect_offset, list);
124 list->SetIsSuitableForGpuRasterization(IsSuitableForGpuRasterization()); 121 list->SetNumSlowPaths(num_slow_paths_);
125 } 122 }
126 123
127 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698