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

Commit 3b25c43

Browse files
committed
fuchsia: Remove dead code / break dependencies
The fuchsia code around metrics and sizing was just sending this information through a side-channel, when the engine already had the information available. So, delete all of it to make future CLs simpler. Additionally, the SceneUpdateContext has many unneccesary dependencies re: metrics and PaintTasks. Break those to make future CLs simpler. Tested: Ran all unittests and ran workstation on Fuchsia BUG: 53062, 53063
1 parent a974b78 commit 3b25c43

File tree

81 files changed

+432
-783
lines changed

Some content is hidden

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

81 files changed

+432
-783
lines changed

flow/compositor_context.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "flutter/flow/compositor_context.h"
66

77
#include "flutter/flow/layers/layer_tree.h"
8+
#include "flutter/fml/trace_event.h"
89
#include "third_party/skia/include/core/SkCanvas.h"
910

1011
namespace flutter {

flow/gl_context_switch.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/flow/gl_context_switch.h"
66

7+
#include "flutter/fml/logging.h"
8+
79
namespace flutter {
810

911
SwitchableGLContext::SwitchableGLContext() = default;

flow/gl_context_switch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <memory>
1010
#include <vector>
1111

12-
#include "flutter/fml/logging.h"
1312
#include "flutter/fml/macros.h"
1413

1514
namespace flutter {

flow/layers/backdrop_filter_layer.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#include "flutter/flow/layers/backdrop_filter_layer.h"
66

7+
#include "flutter/fml/logging.h"
8+
#include "flutter/fml/trace_event.h"
9+
710
namespace flutter {
811

912
BackdropFilterLayer::BackdropFilterLayer(sk_sp<SkImageFilter> filter)

flow/layers/backdrop_filter_layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define FLUTTER_FLOW_LAYERS_BACKDROP_FILTER_LAYER_H_
77

88
#include "flutter/flow/layers/container_layer.h"
9-
9+
#include "flutter/fml/macros.h"
1010
#include "third_party/skia/include/core/SkImageFilter.h"
1111

1212
namespace flutter {

flow/layers/backdrop_filter_layer_unittests.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ TEST_F(BackdropFilterLayerTest, PaintingEmptyLayerDies) {
2323
layer->Preroll(preroll_context(), SkMatrix());
2424
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
2525
EXPECT_FALSE(layer->needs_painting());
26-
EXPECT_FALSE(layer->needs_system_composite());
2726

2827
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
2928
"needs_painting\\(\\)");
@@ -206,7 +205,7 @@ TEST_F(BackdropFilterLayerTest, Readback) {
206205

207206
// BDF with no filter blocks child with readback
208207
auto mock_layer =
209-
std::make_shared<MockLayer>(SkPath(), SkPaint(), false, false, true);
208+
std::make_shared<MockLayer>(SkPath(), SkPaint(), false, true);
210209
layer2->Add(mock_layer);
211210
preroll_context()->surface_needs_readback = false;
212211
layer2->Preroll(preroll_context(), initial_transform);

flow/layers/child_scene_layer.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "flutter/flow/layers/child_scene_layer.h"
66

77
#include "flutter/flow/view_holder.h"
8+
#include "flutter/fml/trace_event.h"
89

910
namespace flutter {
1011

@@ -19,16 +20,21 @@ ChildSceneLayer::ChildSceneLayer(zx_koid_t layer_id,
1920

2021
void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
2122
TRACE_EVENT0("flutter", "ChildSceneLayer::Preroll");
22-
set_needs_system_composite(true);
2323

24+
context->has_platform_view = true;
25+
context->platform_view_exists_below = true;
2426
CheckForChildLayerBelow(context);
2527

26-
context->child_scene_layer_exists_below = true;
27-
2828
// An alpha "hole punch" is required if the frame behind us is not opaque.
29-
if (!context->is_opaque) {
30-
set_paint_bounds(
31-
SkRect::MakeXYWH(offset_.fX, offset_.fY, size_.fWidth, size_.fHeight));
29+
for (auto i = context->mutators_stack.Bottom();
30+
i != context->mutators_stack.Top(); ++i) {
31+
const auto& mutator = *i;
32+
if (mutator->GetType() == MutatorType::opacity &&
33+
mutator->GetAlpha() < 255) {
34+
set_paint_bounds(SkRect::MakeXYWH(offset_.fX, offset_.fY, size_.fWidth,
35+
size_.fHeight));
36+
break;
37+
}
3238
}
3339
}
3440

flow/layers/child_scene_layer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
#ifndef FLUTTER_FLOW_LAYERS_CHILD_SCENE_LAYER_H_
66
#define FLUTTER_FLOW_LAYERS_CHILD_SCENE_LAYER_H_
77

8+
#include "flutter/flow/layers/layer.h"
9+
#include "flutter/flow/scene_update_context.h"
810
#include "third_party/skia/include/core/SkMatrix.h"
911
#include "third_party/skia/include/core/SkPoint.h"
1012
#include "third_party/skia/include/core/SkSize.h"
1113

12-
#include "flutter/flow/layers/layer.h"
13-
#include "flutter/flow/scene_update_context.h"
14-
1514
namespace flutter {
1615

1716
// Layer that represents an embedded child.

flow/layers/clip_path_layer.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
#include "flutter/flow/layers/clip_path_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
79
#if defined(LEGACY_FUCHSIA_EMBEDDER)
810

9-
#include "lib/ui/scenic/cpp/commands.h"
11+
#include "flutter/flow/scene_update_context.h" //nogncheck
1012

1113
#endif
1214

@@ -48,7 +50,7 @@ void ClipPathLayer::UpdateScene(SceneUpdateContext& context) {
4850

4951
// TODO(liyuqian): respect clip_behavior_
5052
SceneUpdateContext::Clip clip(context, clip_path_.getBounds());
51-
UpdateSceneChildren(context);
53+
ContainerLayer::UpdateScene(context);
5254
}
5355

5456
#endif

flow/layers/clip_path_layer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include "flutter/flow/layers/container_layer.h"
99

10+
#include "flutter/fml/macros.h"
11+
#include "third_party/skia/include/core/SkPath.h"
12+
1013
namespace flutter {
1114

1215
class ClipPathLayer : public ContainerLayer {

flow/layers/clip_path_layer_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ TEST_F(ClipPathLayerTest, Readback) {
218218
const Clip save_layer = Clip::antiAliasWithSaveLayer;
219219

220220
std::shared_ptr<MockLayer> nochild;
221-
auto reader = std::make_shared<MockLayer>(path, paint, false, false, true);
221+
auto reader = std::make_shared<MockLayer>(path, paint, false, true);
222222
auto nonreader = std::make_shared<MockLayer>(path, paint);
223223

224224
// No children, no prior readback -> no readback after

flow/layers/clip_rect_layer.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
#include "flutter/flow/layers/clip_rect_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
9+
#if defined(LEGACY_FUCHSIA_EMBEDDER)
10+
11+
#include "flutter/flow/scene_update_context.h" //nogncheck
12+
13+
#endif
14+
715
namespace flutter {
816

917
ClipRectLayer::ClipRectLayer(const SkRect& clip_rect, Clip clip_behavior)
@@ -41,7 +49,7 @@ void ClipRectLayer::UpdateScene(SceneUpdateContext& context) {
4149

4250
// TODO(liyuqian): respect clip_behavior_
4351
SceneUpdateContext::Clip clip(context, clip_rect_);
44-
UpdateSceneChildren(context);
52+
ContainerLayer::UpdateScene(context);
4553
}
4654

4755
#endif

flow/layers/clip_rect_layer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include "flutter/flow/layers/container_layer.h"
99

10+
#include "flutter/fml/macros.h"
11+
#include "third_party/skia/include/core/SkRect.h"
12+
1013
namespace flutter {
1114

1215
class ClipRectLayer : public ContainerLayer {

flow/layers/clip_rect_layer_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ TEST_F(ClipRectLayerTest, Readback) {
215215
const Clip save_layer = Clip::antiAliasWithSaveLayer;
216216

217217
std::shared_ptr<MockLayer> nochild;
218-
auto reader = std::make_shared<MockLayer>(path, paint, false, false, true);
218+
auto reader = std::make_shared<MockLayer>(path, paint, false, true);
219219
auto nonreader = std::make_shared<MockLayer>(path, paint);
220220

221221
// No children, no prior readback -> no readback after

flow/layers/clip_rrect_layer.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
#include "flutter/flow/layers/clip_rrect_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
9+
#if defined(LEGACY_FUCHSIA_EMBEDDER)
10+
11+
#include "flutter/flow/scene_update_context.h" //nogncheck
12+
13+
#endif
14+
715
namespace flutter {
816

917
ClipRRectLayer::ClipRRectLayer(const SkRRect& clip_rrect, Clip clip_behavior)
@@ -42,7 +50,7 @@ void ClipRRectLayer::UpdateScene(SceneUpdateContext& context) {
4250

4351
// TODO(liyuqian): respect clip_behavior_
4452
SceneUpdateContext::Clip clip(context, clip_rrect_.getBounds());
45-
UpdateSceneChildren(context);
53+
ContainerLayer::UpdateScene(context);
4654
}
4755

4856
#endif

flow/layers/clip_rrect_layer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define FLUTTER_FLOW_LAYERS_CLIP_RRECT_LAYER_H_
77

88
#include "flutter/flow/layers/container_layer.h"
9+
#include "flutter/fml/macros.h"
10+
#include "third_party/skia/include/core/SkRRect.h"
911

1012
namespace flutter {
1113

flow/layers/clip_rrect_layer_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ TEST_F(ClipRRectLayerTest, Readback) {
221221
const Clip save_layer = Clip::antiAliasWithSaveLayer;
222222

223223
std::shared_ptr<MockLayer> nochild;
224-
auto reader = std::make_shared<MockLayer>(path, paint, false, false, true);
224+
auto reader = std::make_shared<MockLayer>(path, paint, false, true);
225225
auto nonreader = std::make_shared<MockLayer>(path, paint);
226226

227227
// No children, no prior readback -> no readback after

flow/layers/color_filter_layer.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/flow/layers/color_filter_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
79
namespace flutter {
810

911
ColorFilterLayer::ColorFilterLayer(sk_sp<SkColorFilter> filter)

flow/layers/color_filter_layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define FLUTTER_FLOW_LAYERS_COLOR_FILTER_LAYER_H_
77

88
#include "flutter/flow/layers/container_layer.h"
9-
9+
#include "flutter/fml/macros.h"
1010
#include "third_party/skia/include/core/SkColorFilter.h"
1111

1212
namespace flutter {

flow/layers/color_filter_layer_unittests.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ TEST_F(ColorFilterLayerTest, PaintingEmptyLayerDies) {
2323
layer->Preroll(preroll_context(), SkMatrix());
2424
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
2525
EXPECT_FALSE(layer->needs_painting());
26-
EXPECT_FALSE(layer->needs_system_composite());
2726

2827
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
2928
"needs_painting\\(\\)");
@@ -207,7 +206,7 @@ TEST_F(ColorFilterLayerTest, Readback) {
207206

208207
// ColorFilterLayer blocks child with readback
209208
auto mock_layer =
210-
std::make_shared<MockLayer>(SkPath(), SkPaint(), false, false, true);
209+
std::make_shared<MockLayer>(SkPath(), SkPaint(), false, true);
211210
layer->Add(mock_layer);
212211
preroll_context()->surface_needs_readback = false;
213212
layer->Preroll(preroll_context(), initial_transform);

flow/layers/container_layer.cc

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
#include "flutter/flow/layers/container_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
9+
#if defined(LEGACY_FUCHSIA_EMBEDDER)
10+
11+
#include "flutter/flow/scene_update_context.h" //nogncheck
12+
13+
#endif
14+
715
namespace flutter {
816

917
ContainerLayer::ContainerLayer() {}
@@ -30,8 +38,8 @@ void ContainerLayer::PrerollChildren(PrerollContext* context,
3038
const SkMatrix& child_matrix,
3139
SkRect* child_paint_bounds) {
3240
#if defined(LEGACY_FUCHSIA_EMBEDDER)
33-
child_layer_exists_below_ = context->child_scene_layer_exists_below;
34-
context->child_scene_layer_exists_below = false;
41+
set_platform_view_exists_below(context->platform_view_exists_below);
42+
context->platform_view_exists_below = false;
3543
#endif
3644

3745
// Platform views have no children, so context->has_platform_view should
@@ -46,23 +54,24 @@ void ContainerLayer::PrerollChildren(PrerollContext* context,
4654

4755
layer->Preroll(context, child_matrix);
4856

57+
#if defined(LEGACY_FUCHSIA_EMBEDDER)
4958
if (layer->needs_system_composite()) {
5059
set_needs_system_composite(true);
5160
}
61+
#endif
5262
child_paint_bounds->join(layer->paint_bounds());
5363

5464
child_has_platform_view =
5565
child_has_platform_view || context->has_platform_view;
5666
}
5767

5868
context->has_platform_view = child_has_platform_view;
59-
6069
#if defined(LEGACY_FUCHSIA_EMBEDDER)
61-
if (child_layer_exists_below_) {
70+
if (platform_view_exists_below()) {
6271
set_needs_system_composite(true);
6372
}
64-
context->child_scene_layer_exists_below =
65-
context->child_scene_layer_exists_below || child_layer_exists_below_;
73+
context->platform_view_exists_below =
74+
context->platform_view_exists_below || platform_view_exists_below();
6675
#endif
6776
}
6877

@@ -94,10 +103,6 @@ void ContainerLayer::CheckForChildLayerBelow(PrerollContext* context) {
94103
}
95104

96105
void ContainerLayer::UpdateScene(SceneUpdateContext& context) {
97-
UpdateSceneChildren(context);
98-
}
99-
100-
void ContainerLayer::UpdateSceneChildren(SceneUpdateContext& context) {
101106
auto update_scene_layers = [&] {
102107
// Paint all of the layers which need to be drawn into the container.
103108
// These may be flattened down to a containing Scenic Frame.
@@ -113,7 +118,7 @@ void ContainerLayer::UpdateSceneChildren(SceneUpdateContext& context) {
113118
// If there is embedded Fuchsia content in the scene (a ChildSceneLayer),
114119
// PhysicalShapeLayers that appear above the embedded content will be turned
115120
// into their own Scenic layers.
116-
if (child_layer_exists_below_) {
121+
if (platform_view_exists_below()) {
117122
float global_scenic_elevation =
118123
context.GetGlobalElevationForNextScenicLayer();
119124
float local_scenic_elevation =
@@ -146,8 +151,8 @@ void ContainerLayer::UpdateSceneChildren(SceneUpdateContext& context) {
146151

147152
frame.AddPaintLayer(this);
148153

149-
// Node: UpdateSceneChildren needs to be called here so that |frame| is
150-
// still in scope (and therefore alive) while UpdateSceneChildren is being
154+
// Node: update_scene_layers needs to be called here so that |frame| is
155+
// still in scope (and therefore alive) while update_scene_layers is being
151156
// called.
152157
float scenic_elevation = context.scenic_elevation();
153158
context.set_scenic_elevation(scenic_elevation + local_scenic_elevation);

flow/layers/container_layer.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#define FLUTTER_FLOW_LAYERS_CONTAINER_LAYER_H_
77

88
#include <vector>
9+
910
#include "flutter/flow/layers/layer.h"
11+
#include "flutter/fml/macros.h"
1012

1113
namespace flutter {
1214

@@ -31,10 +33,6 @@ class ContainerLayer : public Layer {
3133
SkRect* child_paint_bounds);
3234
void PaintChildren(PaintContext& context) const;
3335

34-
#if defined(LEGACY_FUCHSIA_EMBEDDER)
35-
void UpdateSceneChildren(SceneUpdateContext& context);
36-
#endif
37-
3836
// Try to prepare the raster cache for a given layer.
3937
//
4038
// The raster cache would fail if either of the followings is true:

0 commit comments

Comments
 (0)