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

Side by Side Diff: cc/paint/display_item_list.cc

Issue 2884563004: cc: Renamed approximate{BytesUsed,OpCount} in paint op buffer. (Closed)
Patch Set: winfix 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
« no previous file with comments | « cc/paint/display_item_list.h ('k') | cc/paint/display_item_list_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/paint/display_item_list.h" 5 #include "cc/paint/display_item_list.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const DrawingDisplayItem& draw_item, 172 const DrawingDisplayItem& draw_item,
173 SkCanvas* canvas) { 173 SkCanvas* canvas) {
174 if (save_item.color_filter) 174 if (save_item.color_filter)
175 return false; 175 return false;
176 if (save_item.xfermode != SkBlendMode::kSrcOver) 176 if (save_item.xfermode != SkBlendMode::kSrcOver)
177 return false; 177 return false;
178 // TODO(enne): I believe that lcd_text_requires_opaque_layer is not 178 // TODO(enne): I believe that lcd_text_requires_opaque_layer is not
179 // relevant here and that lcd text is preserved post merge, but I haven't 179 // relevant here and that lcd text is preserved post merge, but I haven't
180 // tested that. 180 // tested that.
181 const PaintRecord* record = draw_item.picture.get(); 181 const PaintRecord* record = draw_item.picture.get();
182 if (record->approximateOpCount() != 1) 182 if (record->size() != 1u)
183 return false; 183 return false;
184 184
185 const PaintOp* op = record->GetFirstOp(); 185 const PaintOp* op = record->GetFirstOp();
186 if (!op->IsDrawOp()) 186 if (!op->IsDrawOp())
187 return false; 187 return false;
188 188
189 op->RasterWithAlpha(canvas, save_item.alpha); 189 op->RasterWithAlpha(canvas, save_item.alpha);
190 return true; 190 return true;
191 } 191 }
192 192
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 249
250 bool DisplayItemList::IsSuitableForGpuRasterization() const { 250 bool DisplayItemList::IsSuitableForGpuRasterization() const {
251 // TODO(wkorman): This is more permissive than Picture's implementation, since 251 // TODO(wkorman): This is more permissive than Picture's implementation, since
252 // none of the items might individually trigger a veto even though they 252 // none of the items might individually trigger a veto even though they
253 // collectively have enough "bad" operations that a corresponding Picture 253 // collectively have enough "bad" operations that a corresponding Picture
254 // would get vetoed. See crbug.com/513016. 254 // would get vetoed. See crbug.com/513016.
255 return all_items_are_suitable_for_gpu_rasterization_; 255 return all_items_are_suitable_for_gpu_rasterization_;
256 } 256 }
257 257
258 int DisplayItemList::ApproximateOpCount() const { 258 size_t DisplayItemList::OpCount() const {
259 return approximate_op_count_; 259 return op_count_;
260 } 260 }
261 261
262 size_t DisplayItemList::ApproximateMemoryUsage() const { 262 size_t DisplayItemList::ApproximateMemoryUsage() const {
263 size_t memory_usage = sizeof(*this); 263 size_t memory_usage = sizeof(*this);
264 264
265 size_t external_memory_usage = 0; 265 size_t external_memory_usage = 0;
266 for (const auto& item : items_) { 266 for (const auto& item : items_) {
267 size_t bytes = 0; 267 size_t bytes = 0;
268 switch (item.type) { 268 switch (item.type) {
269 case DisplayItem::CLIP: 269 case DisplayItem::CLIP:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 memory_usage += items_.GetCapacityInBytes() + external_memory_usage; 308 memory_usage += items_.GetCapacityInBytes() + external_memory_usage;
309 309
310 // TODO(jbroman): Does anything else owned by this class substantially 310 // TODO(jbroman): Does anything else owned by this class substantially
311 // contribute to memory usage? 311 // contribute to memory usage?
312 // TODO(vmpstr): Probably DiscardableImageMap is worth counting here. 312 // TODO(vmpstr): Probably DiscardableImageMap is worth counting here.
313 313
314 return memory_usage; 314 return memory_usage;
315 } 315 }
316 316
317 bool DisplayItemList::ShouldBeAnalyzedForSolidColor() const { 317 bool DisplayItemList::ShouldBeAnalyzedForSolidColor() const {
318 return ApproximateOpCount() <= kOpCountThatIsOkToAnalyze; 318 return OpCount() <= kOpCountThatIsOkToAnalyze;
319 } 319 }
320 320
321 void DisplayItemList::EmitTraceSnapshot() const { 321 void DisplayItemList::EmitTraceSnapshot() const {
322 bool include_items; 322 bool include_items;
323 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 323 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
324 TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items"), &include_items); 324 TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items"), &include_items);
325 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 325 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
326 TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items") "," 326 TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items") ","
327 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," 327 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") ","
328 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"), 328 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"),
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 std::vector<DrawImage>* images) { 540 std::vector<DrawImage>* images) {
541 image_map_.GetDiscardableImagesInRect(rect, contents_scale, 541 image_map_.GetDiscardableImagesInRect(rect, contents_scale,
542 target_color_space, images); 542 target_color_space, images);
543 } 543 }
544 544
545 gfx::Rect DisplayItemList::GetRectForImage(ImageId image_id) const { 545 gfx::Rect DisplayItemList::GetRectForImage(ImageId image_id) const {
546 return image_map_.GetRectForImage(image_id); 546 return image_map_.GetRectForImage(image_id);
547 } 547 }
548 548
549 } // namespace cc 549 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/display_item_list.h ('k') | cc/paint/display_item_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698