Skip to content

Commit 20180f2

Browse files
committed
Discard the resubmitted layer tree of the wrong size instead of rendering it (flutter#28474)
1 parent 67b9165 commit 20180f2

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

shell/common/rasterizer.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void Rasterizer::DrawLastLayerTree(
150150
RasterStatus Rasterizer::Draw(
151151
std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder,
152152
std::shared_ptr<Pipeline<flutter::LayerTree>> pipeline,
153-
LayerTreeDiscardCallback discardCallback) {
153+
LayerTreeDiscardCallback discard_callback) {
154154
TRACE_EVENT_WITH_FRAME_NUMBER(frame_timings_recorder, "flutter",
155155
"GPURasterizer::Draw");
156156
if (raster_thread_merger_ &&
@@ -169,7 +169,7 @@ RasterStatus Rasterizer::Draw(
169169
RasterStatus raster_status = RasterStatus::kFailed;
170170
Pipeline<flutter::LayerTree>::Consumer consumer =
171171
[&](std::unique_ptr<LayerTree> layer_tree) {
172-
if (discardCallback(*layer_tree.get())) {
172+
if (discard_callback(*layer_tree.get())) {
173173
raster_status = RasterStatus::kDiscarded;
174174
} else {
175175
raster_status =
@@ -207,9 +207,11 @@ RasterStatus Rasterizer::Draw(
207207
delegate_.GetTaskRunners().GetRasterTaskRunner()->PostTask(
208208
fml::MakeCopyable(
209209
[weak_this = weak_factory_.GetWeakPtr(), pipeline,
210-
resubmit_recorder = std::move(resubmit_recorder)]() mutable {
210+
resubmit_recorder = std::move(resubmit_recorder),
211+
discard_callback = std::move(discard_callback)]() mutable {
211212
if (weak_this) {
212-
weak_this->Draw(std::move(resubmit_recorder), pipeline);
213+
weak_this->Draw(std::move(resubmit_recorder), pipeline,
214+
std::move(discard_callback));
213215
}
214216
}));
215217
break;

shell/common/rasterizer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ class Rasterizer final : public SnapshotDelegate {
226226
///
227227
/// @param[in] pipeline The layer tree pipeline to take the next layer tree
228228
/// to render from.
229-
/// @param[in] discardCallback if specified and returns true, the layer tree
229+
/// @param[in] discard_callback if specified and returns true, the layer tree
230230
/// is discarded instead of being rendered
231231
///
232232
RasterStatus Draw(
233233
std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder,
234234
std::shared_ptr<Pipeline<flutter::LayerTree>> pipeline,
235-
LayerTreeDiscardCallback discardCallback = NoDiscard);
235+
LayerTreeDiscardCallback discard_callback = NoDiscard);
236236

237237
//----------------------------------------------------------------------------
238238
/// @brief The type of the screenshot to obtain of the previously

0 commit comments

Comments
 (0)