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

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

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: Rebase 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();
danakj 2017/05/31 18:03:38 reset it here?
81 } 77 }
82 78
83 size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const { 79 size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const {
84 return sizeof(*this) + display_item_list_.MemoryUsageInBytes() + 80 return sizeof(*this) + display_item_list_.MemoryUsageInBytes() +
85 paint_chunks_.capacity() * sizeof(paint_chunks_[0]); 81 paint_chunks_.capacity() * sizeof(paint_chunks_[0]);
86 } 82 }
87 83
88 void PaintArtifact::Replay(const FloatRect& bounds, 84 void PaintArtifact::Replay(const FloatRect& bounds,
89 GraphicsContext& graphics_context) const { 85 GraphicsContext& graphics_context) const {
90 TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay"); 86 TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay");
(...skipping 25 matching lines...) Expand all
116 112
117 DISABLE_CFI_PERF 113 DISABLE_CFI_PERF
118 void PaintArtifact::AppendToWebDisplayItemList(WebDisplayItemList* list) const { 114 void PaintArtifact::AppendToWebDisplayItemList(WebDisplayItemList* list) const {
119 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList"); 115 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList");
120 size_t visual_rect_index = 0; 116 size_t visual_rect_index = 0;
121 for (const DisplayItem& display_item : display_item_list_) { 117 for (const DisplayItem& display_item : display_item_list_) {
122 display_item.AppendToWebDisplayItemList( 118 display_item.AppendToWebDisplayItemList(
123 display_item_list_.VisualRect(visual_rect_index), list); 119 display_item_list_.VisualRect(visual_rect_index), list);
124 visual_rect_index++; 120 visual_rect_index++;
125 } 121 }
126 list->SetIsSuitableForGpuRasterization(IsSuitableForGpuRasterization()); 122 list->SetNumSlowPaths(num_slow_paths_);
127 } 123 }
128 124
129 } // namespace blink 125 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698