Skip to content

Commit

Permalink
add virtual destructor to new virtual Culler class (flutter#38494)
Browse files Browse the repository at this point in the history
  • Loading branch information
flar authored and loic-sharma committed Jan 3, 2023
1 parent 1923d79 commit b94ec91
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions display_list/display_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ uint32_t DisplayList::next_unique_id() {

class Culler {
public:
virtual ~Culler() = default;
virtual bool init(DispatchContext& context) = 0;
virtual void update(DispatchContext& context) = 0;
};
class NopCuller : public Culler {
class NopCuller final : public Culler {
public:
static NopCuller instance;

~NopCuller() = default;

bool init(DispatchContext& context) override {
// Setting next_render_index to 0 means that
// all rendering ops will be at or after that
Expand All @@ -78,11 +81,13 @@ class NopCuller : public Culler {
void update(DispatchContext& context) override {}
};
NopCuller NopCuller::instance = NopCuller();
class VectorCuller : public Culler {
class VectorCuller final : public Culler {
public:
VectorCuller(const DlRTree* rtree, const std::vector<int>& rect_indices)
: rtree_(rtree), cur_(rect_indices.begin()), end_(rect_indices.end()) {}

~VectorCuller() = default;

bool init(DispatchContext& context) override {
if (cur_ < end_) {
context.next_render_index = rtree_->id(*cur_++);
Expand Down

0 comments on commit b94ec91

Please sign in to comment.