Skip to content

Commit

Permalink
Expose the number of top-level PaintOps held in a PaintRecorder.
Browse files Browse the repository at this point in the history
Bug: 973801
Change-Id: I90c5eb4f4bd84e0ac822ae0d15b3d730e769306e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199178
Commit-Queue: Caleb Raitto <caraitto@chromium.org>
Reviewed-by: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768626}
  • Loading branch information
caraitto authored and Commit Bot committed May 14, 2020
1 parent a8574e2 commit af17a19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cc/paint/display_item_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ class CC_PAINT_EXPORT DisplayItemList
std::string ToString() const;
bool has_draw_ops() const { return paint_op_buffer_.has_draw_ops(); }

// Ops with nested paint ops are considered as a single op.
size_t num_paint_ops() const { return paint_op_buffer_.size(); }

private:
friend class DisplayItemListTest;
friend gpu::raster::RasterImplementation;
Expand Down
4 changes: 4 additions & 0 deletions cc/paint/paint_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ bool PaintRecorder::ListHasDrawOps() const {
return display_item_list_->has_draw_ops();
}

size_t PaintRecorder::num_paint_ops() const {
return display_item_list_->num_paint_ops();
}

} // namespace cc
3 changes: 3 additions & 0 deletions cc/paint/paint_recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class CC_PAINT_EXPORT PaintRecorder {

bool ListHasDrawOps() const;

// Ops with nested paint ops are considered as a single op.
size_t num_paint_ops() const;

protected:
virtual std::unique_ptr<RecordPaintCanvas> CreateCanvas(DisplayItemList* list,
const SkRect& bounds);
Expand Down

0 comments on commit af17a19

Please sign in to comment.