Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 288dfdb

Browse files
committed
rename Dispatcher interface and reduce its visibility
1 parent 54b9893 commit 288dfdb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2032
-1919
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,6 @@ ORIGIN: ../../../flutter/display_list/display_list_complexity_gl.h + ../../../fl
729729
ORIGIN: ../../../flutter/display_list/display_list_complexity_helper.h + ../../../flutter/LICENSE
730730
ORIGIN: ../../../flutter/display_list/display_list_complexity_metal.cc + ../../../flutter/LICENSE
731731
ORIGIN: ../../../flutter/display_list/display_list_complexity_metal.h + ../../../flutter/LICENSE
732-
ORIGIN: ../../../flutter/display_list/display_list_dispatcher.cc + ../../../flutter/LICENSE
733-
ORIGIN: ../../../flutter/display_list/display_list_dispatcher.h + ../../../flutter/LICENSE
734732
ORIGIN: ../../../flutter/display_list/display_list_flags.cc + ../../../flutter/LICENSE
735733
ORIGIN: ../../../flutter/display_list/display_list_flags.h + ../../../flutter/LICENSE
736734
ORIGIN: ../../../flutter/display_list/display_list_image.cc + ../../../flutter/LICENSE
@@ -760,6 +758,8 @@ ORIGIN: ../../../flutter/display_list/display_list_utils.h + ../../../flutter/LI
760758
ORIGIN: ../../../flutter/display_list/display_list_vertices.cc + ../../../flutter/LICENSE
761759
ORIGIN: ../../../flutter/display_list/display_list_vertices.h + ../../../flutter/LICENSE
762760
ORIGIN: ../../../flutter/display_list/dl_canvas.h + ../../../flutter/LICENSE
761+
ORIGIN: ../../../flutter/display_list/dl_op_receiver.cc + ../../../flutter/LICENSE
762+
ORIGIN: ../../../flutter/display_list/dl_op_receiver.h + ../../../flutter/LICENSE
763763
ORIGIN: ../../../flutter/display_list/skia/dl_sk_canvas.cc + ../../../flutter/LICENSE
764764
ORIGIN: ../../../flutter/display_list/skia/dl_sk_canvas.h + ../../../flutter/LICENSE
765765
ORIGIN: ../../../flutter/display_list/types.h + ../../../flutter/LICENSE
@@ -3256,8 +3256,6 @@ FILE: ../../../flutter/display_list/display_list_complexity_gl.h
32563256
FILE: ../../../flutter/display_list/display_list_complexity_helper.h
32573257
FILE: ../../../flutter/display_list/display_list_complexity_metal.cc
32583258
FILE: ../../../flutter/display_list/display_list_complexity_metal.h
3259-
FILE: ../../../flutter/display_list/display_list_dispatcher.cc
3260-
FILE: ../../../flutter/display_list/display_list_dispatcher.h
32613259
FILE: ../../../flutter/display_list/display_list_flags.cc
32623260
FILE: ../../../flutter/display_list/display_list_flags.h
32633261
FILE: ../../../flutter/display_list/display_list_image.cc
@@ -3287,6 +3285,8 @@ FILE: ../../../flutter/display_list/display_list_utils.h
32873285
FILE: ../../../flutter/display_list/display_list_vertices.cc
32883286
FILE: ../../../flutter/display_list/display_list_vertices.h
32893287
FILE: ../../../flutter/display_list/dl_canvas.h
3288+
FILE: ../../../flutter/display_list/dl_op_receiver.cc
3289+
FILE: ../../../flutter/display_list/dl_op_receiver.h
32903290
FILE: ../../../flutter/display_list/skia/dl_sk_canvas.cc
32913291
FILE: ../../../flutter/display_list/skia/dl_sk_canvas.h
32923292
FILE: ../../../flutter/display_list/types.h

display_list/BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ source_set("display_list") {
2929
"display_list_complexity_gl.h",
3030
"display_list_complexity_metal.cc",
3131
"display_list_complexity_metal.h",
32-
"display_list_dispatcher.cc",
33-
"display_list_dispatcher.h",
3432
"display_list_flags.cc",
3533
"display_list_flags.h",
3634
"display_list_image.cc",
@@ -60,6 +58,8 @@ source_set("display_list") {
6058
"display_list_vertices.cc",
6159
"display_list_vertices.h",
6260
"dl_canvas.h",
61+
"dl_op_receiver.cc",
62+
"dl_op_receiver.h",
6363
"skia/dl_sk_canvas.cc",
6464
"skia/dl_sk_canvas.h",
6565
"types.h",

display_list/display_list.cc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,38 +134,39 @@ class VectorCuller final : public Culler {
134134
std::vector<int>::const_iterator end_;
135135
};
136136

137-
void DisplayList::Dispatch(Dispatcher& ctx) const {
137+
void DisplayList::Dispatch(DlOpReceiver& receiver) const {
138138
uint8_t* ptr = storage_.get();
139-
Dispatch(ctx, ptr, ptr + byte_count_, NopCuller::instance);
139+
Dispatch(receiver, ptr, ptr + byte_count_, NopCuller::instance);
140140
}
141-
void DisplayList::Dispatch(Dispatcher& ctx, const SkRect& cull_rect) const {
141+
void DisplayList::Dispatch(DlOpReceiver& receiver,
142+
const SkRect& cull_rect) const {
142143
if (cull_rect.isEmpty()) {
143144
return;
144145
}
145146
if (cull_rect.contains(bounds())) {
146-
Dispatch(ctx);
147+
Dispatch(receiver);
147148
return;
148149
}
149150
const DlRTree* rtree = this->rtree().get();
150151
FML_DCHECK(rtree != nullptr);
151152
if (rtree == nullptr) {
152153
FML_LOG(ERROR) << "dispatched with culling rect on DL with no rtree";
153-
Dispatch(ctx);
154+
Dispatch(receiver);
154155
return;
155156
}
156157
uint8_t* ptr = storage_.get();
157158
std::vector<int> rect_indices;
158159
rtree->search(cull_rect, &rect_indices);
159160
VectorCuller culler(rtree, rect_indices);
160-
Dispatch(ctx, ptr, ptr + byte_count_, culler);
161+
Dispatch(receiver, ptr, ptr + byte_count_, culler);
161162
}
162163

163-
void DisplayList::Dispatch(Dispatcher& dispatcher,
164+
void DisplayList::Dispatch(DlOpReceiver& receiver,
164165
uint8_t* ptr,
165166
uint8_t* end,
166167
Culler& culler) const {
167168
DispatchContext context = {
168-
.dispatcher = dispatcher,
169+
.receiver = receiver,
169170
.cur_index = 0,
170171
// next_render_index will be initialized by culler.init()
171172
.next_restore_index = std::numeric_limits<int>::max(),
@@ -299,9 +300,9 @@ void DisplayList::RenderTo(DisplayListBuilder* builder) const {
299300
return;
300301
}
301302
if (has_rtree()) {
302-
Dispatch(builder->asDispatcher(), builder->GetLocalClipBounds());
303+
Dispatch(builder->asReceiver(), builder->GetLocalClipBounds());
303304
} else {
304-
Dispatch(builder->asDispatcher());
305+
Dispatch(builder->asReceiver());
305306
}
306307
}
307308

display_list/display_list.h

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,35 @@
1818
//
1919
// This file contains the definitions for:
2020
// DisplayList: the base class that holds the information about the
21-
// sequence of operations and can dispatch them to a Dispatcher
22-
// Dispatcher: a pure virtual interface which can be implemented to field
23-
// the requests for purposes such as sending them to an SkCanvas
24-
// or detecting various rendering optimization scenarios
25-
// DisplayListBuilder: a class for constructing a DisplayList from the same
26-
// calls defined in the Dispatcher
21+
// sequence of operations and can dispatch them to a DlOpReceiver
22+
// DlOpReceiver: a pure virtual interface which can be implemented to field
23+
// the requests for purposes such as sending them to an SkCanvas
24+
// or detecting various rendering optimization scenarios
25+
// DisplayListBuilder: a class for constructing a DisplayList from DlCanvas
26+
// method calls and which can act as a DlOpReceiver as well
2727
//
2828
// Other files include various class definitions for dealing with display
2929
// lists, such as:
3030
// display_list_canvas.h: classes to interact between SkCanvas and DisplayList
3131
// (SkCanvas->DisplayList adapter and vice versa)
3232
//
3333
// display_list_utils.h: various utility classes to ease implementing
34-
// a Dispatcher, including NOP implementations of
34+
// a DlOpReceiver, including NOP implementations of
3535
// the attribute, clip, and transform methods,
3636
// classes to track attributes, clips, and transforms
3737
// and a class to compute the bounds of a DisplayList
38-
// Any class implementing Dispatcher can inherit from
38+
// Any class implementing DlOpReceiver can inherit from
3939
// these utility classes to simplify its creation
4040
//
4141
// The Flutter DisplayList mechanism is used in a similar manner to the Skia
42-
// SkPicture mechanism. The primary means of communication into and out
43-
// of the DisplayList is through the Dispatcher virtual class which
44-
// provides a nearly 1:1 translation between the records of the DisplayList
45-
// to method calls.
42+
// SkPicture mechanism.
4643
//
47-
// A DisplayList must be created using a DisplayListBuilder using either its
48-
// stateful methods inherited from Dispatcher, or from its stateless methods
49-
// inherited from DlCanvas.
44+
// A DisplayList must be created using a DisplayListBuilder using its stateless
45+
// methods inherited from DlCanvas.
5046
//
51-
// A DisplayList can be read back by implementing the Dispatcher virtual
47+
// A DisplayList can be read back by implementing the DlOpReceiver virtual
5248
// methods (with help from some of the classes in the utils file) and
53-
// passing an instance to the dispatch() method, or it can be rendered
49+
// passing an instance to the Dispatch() method, or it can be rendered
5450
// to Skia using a DisplayListCanvasDispatcher or simply by passing an
5551
// SkCanvas pointer to its renderTo() method.
5652
//
@@ -155,7 +151,7 @@ enum class DisplayListOpType {
155151
};
156152
#undef DL_OP_TO_ENUM_VALUE
157153

158-
class Dispatcher;
154+
class DlOpReceiver;
159155
class DisplayListBuilder;
160156

161157
class SaveLayerOptions {
@@ -231,16 +227,16 @@ class DisplayListStorage {
231227
class Culler;
232228

233229
// The base class that contains a sequence of rendering operations
234-
// for dispatch to a Dispatcher. These objects must be instantiated
230+
// for dispatch to a DlOpReceiver. These objects must be instantiated
235231
// through an instance of DisplayListBuilder::build().
236232
class DisplayList : public SkRefCnt {
237233
public:
238234
DisplayList();
239235

240236
~DisplayList();
241237

242-
void Dispatch(Dispatcher& ctx) const;
243-
void Dispatch(Dispatcher& ctx, const SkRect& cull_rect) const;
238+
void Dispatch(DlOpReceiver& ctx) const;
239+
void Dispatch(DlOpReceiver& ctx, const SkRect& cull_rect) const;
244240

245241
void RenderTo(DisplayListBuilder* builder) const;
246242

@@ -300,7 +296,7 @@ class DisplayList : public SkRefCnt {
300296
const bool can_apply_group_opacity_;
301297
const sk_sp<const DlRTree> rtree_;
302298

303-
void Dispatch(Dispatcher& ctx,
299+
void Dispatch(DlOpReceiver& ctx,
304300
uint8_t* ptr,
305301
uint8_t* end,
306302
Culler& culler) const;

display_list/display_list_attributes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace flutter {
5656
// compared using a |memcmp| when performing a |DisplayList::Equals|.
5757
//
5858
// - Passed by Pointer:
59-
// The data shared via the |Dispatcher::set<Attribute>| calls are stored
59+
// The data shared via the |DlOpReceiver::set<Attribute>| calls are stored
6060
// in the buffer itself and so their lifetime is controlled by the
6161
// DisplayList. That memory cannot be shared as by a |shared_ptr|
6262
// because the memory may be freed outside the control of the shared
@@ -70,7 +70,7 @@ namespace flutter {
7070
// - Shared_Ptr-able:
7171
// The classes support a method to return a |std::shared_ptr| version of
7272
// themselves, safely instantiating a new copy of the object into a
73-
// shared_ptr using |std::make_shared|. For those dispatcher objects
73+
// shared_ptr using |std::make_shared|. For those receiver objects
7474
// that may want to hold on to the contents of the object (typically
7575
// in a |current_attribute_| field), they can obtain a shared_ptr
7676
// copy safely and easily using the |shared| method.

0 commit comments

Comments
 (0)