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

Commit c162604

Browse files
committed
wip
1 parent a316f62 commit c162604

15 files changed

+429
-536
lines changed

flow/scene_update_context.cc

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ void SetMaterialColor(scenic::Material& material,
6868
SceneUpdateContext::SceneUpdateContext(std::string debug_label,
6969
fuchsia::ui::views::ViewToken view_token,
7070
scenic::ViewRefPair view_ref_pair,
71-
SessionWrapper& session,
71+
scenic::Session* session,
7272
bool intercept_all_input)
7373
: session_(session),
74-
root_view_(session_.get(),
74+
root_view_(session_,
7575
std::move(view_token),
7676
std::move(view_ref_pair.control_ref),
7777
std::move(view_ref_pair.view_ref),
7878
debug_label),
79-
metrics_node_(session.get()),
80-
layer_tree_node_(session_.get()) {
79+
metrics_node_(session_),
80+
layer_tree_node_(session_) {
8181
layer_tree_node_.SetLabel("Flutter::LayerTree");
8282
metrics_node_.SetLabel("Flutter::MetricsWatcher");
8383
metrics_node_.SetEventMask(fuchsia::ui::gfx::kMetricsEventMask);
@@ -88,16 +88,14 @@ SceneUpdateContext::SceneUpdateContext(std::string debug_label,
8888
// will capture all input, and any unwanted input will be reinjected into
8989
// embedded views.
9090
if (intercept_all_input) {
91-
input_interceptor_node_.emplace(session_.get());
91+
input_interceptor_node_.emplace(session_);
9292
input_interceptor_node_->SetLabel("Flutter::InputInterceptor");
9393
input_interceptor_node_->SetHitTestBehavior(
9494
fuchsia::ui::gfx::HitTestBehavior::kDefault);
9595
input_interceptor_node_->SetSemanticVisibility(false);
9696

9797
metrics_node_.AddChild(input_interceptor_node_.value());
9898
}
99-
100-
session_.Present();
10199
}
102100

103101
std::vector<SceneUpdateContext::PaintTask> SceneUpdateContext::GetPaintTasks() {
@@ -109,7 +107,7 @@ std::vector<SceneUpdateContext::PaintTask> SceneUpdateContext::GetPaintTasks() {
109107
}
110108

111109
void SceneUpdateContext::EnableWireframe(bool enable) {
112-
session_.get()->Enqueue(
110+
session_->Enqueue(
113111
scenic::NewSetEnableDebugViewBoundsCmd(root_view_.id(), enable));
114112
}
115113

@@ -132,8 +130,8 @@ void SceneUpdateContext::Reset(const SkISize& frame_size,
132130
// TODO(fxb/): Don't hardcode elevation.
133131
input_interceptor_node_->SetTranslation(frame_size.width() * 0.5f,
134132
frame_size.height() * 0.5f, -100.f);
135-
input_interceptor_node_->SetShape(scenic::Rectangle(
136-
session_.get(), frame_size.width(), frame_size.height()));
133+
input_interceptor_node_->SetShape(
134+
scenic::Rectangle(session_, frame_size.width(), frame_size.height()));
137135
}
138136

139137
// We are going to be sending down a fresh node hierarchy every frame. So just
@@ -156,8 +154,8 @@ void SceneUpdateContext::CreateFrame(scenic::EntityNode& entity_node,
156154
SetEntityNodeClipPlanes(entity_node, shape_bounds);
157155

158156
// TODO(SCN-137): Need to be able to express the radii as vectors.
159-
scenic::ShapeNode shape_node(session_.get());
160-
scenic::Rectangle shape(session_.get(), rrect.width(), rrect.height());
157+
scenic::ShapeNode shape_node(session_);
158+
scenic::Rectangle shape(session_, rrect.width(), rrect.height());
161159
shape_node.SetShape(shape);
162160
shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(),
163161
shape_bounds.height() * 0.5f + shape_bounds.top(),
@@ -167,7 +165,7 @@ void SceneUpdateContext::CreateFrame(scenic::EntityNode& entity_node,
167165
if (paint_bounds.isEmpty() || !paint_bounds.intersects(shape_bounds))
168166
paint_layers.clear();
169167

170-
scenic::Material material(session_.get());
168+
scenic::Material material(session_);
171169
shape_node.SetMaterial(material);
172170
entity_node.AddChild(shape_node);
173171

@@ -214,9 +212,8 @@ void SceneUpdateContext::UpdateView(int64_t view_id,
214212
bool hit_testable = override_hit_testable.has_value()
215213
? *override_hit_testable
216214
: view_holder->hit_testable();
217-
view_holder->UpdateScene(session_.get(), top_entity_->embedder_node(), offset,
218-
size, SkScalarRoundToInt(alphaf() * 255),
219-
hit_testable);
215+
view_holder->UpdateScene(session_, top_entity_->embedder_node(), offset, size,
216+
SkScalarRoundToInt(alphaf() * 255), hit_testable);
220217

221218
// Assume embedded views are 10 "layers" wide.
222219
next_elevation_ += 10 * kScenicZElevationBetweenLayers;
@@ -257,7 +254,7 @@ void SceneUpdateContext::DestroyView(int64_t view_id) {
257254
SceneUpdateContext::Entity::Entity(std::shared_ptr<SceneUpdateContext> context)
258255
: context_(context),
259256
previous_entity_(context->top_entity_),
260-
entity_node_(context->session_.get()) {
257+
entity_node_(context->session_) {
261258
context->top_entity_ = this;
262259
}
263260

@@ -338,7 +335,7 @@ SceneUpdateContext::Frame::Frame(std::shared_ptr<SceneUpdateContext> context,
338335
rrect_(rrect),
339336
color_(color),
340337
opacity_(opacity),
341-
opacity_node_(context->session_.get()),
338+
opacity_node_(context->session_),
342339
paint_bounds_(SkRect::MakeEmpty()) {
343340
// Increment elevation trackers before calculating any local elevation.
344341
// |UpdateView| can modify context->next_elevation_, which is why it is

flow/scene_update_context.h

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#include <set>
1616
#include <vector>
1717

18-
#include "flutter/flow/embedded_views.h"
1918
#include "flutter/fml/logging.h"
2019
#include "flutter/fml/macros.h"
20+
#include "third_party/skia/include/core/SkRRect.h"
2121
#include "third_party/skia/include/core/SkRect.h"
2222
#include "third_party/skia/include/core/SkSurface.h"
2323

@@ -34,15 +34,7 @@ constexpr float kOneMinusEpsilon = 1 - FLT_EPSILON;
3434
// How much layers are separated in Scenic z elevation.
3535
constexpr float kScenicZElevationBetweenLayers = 10.f;
3636

37-
class SessionWrapper {
38-
public:
39-
virtual ~SessionWrapper() {}
40-
41-
virtual scenic::Session* get() = 0;
42-
virtual void Present() = 0;
43-
};
44-
45-
class SceneUpdateContext : public flutter::ExternalViewEmbedder {
37+
class SceneUpdateContext {
4638
public:
4739
class Entity {
4840
public:
@@ -122,7 +114,7 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder {
122114
SceneUpdateContext(std::string debug_label,
123115
fuchsia::ui::views::ViewToken view_token,
124116
scenic::ViewRefPair view_ref_pair,
125-
SessionWrapper& session,
117+
scenic::Session* session,
126118
bool intercept_all_input = false);
127119
~SceneUpdateContext() = default;
128120

@@ -139,34 +131,7 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder {
139131
// Reset state for a new frame.
140132
void Reset(const SkISize& frame_size, float device_pixel_ratio);
141133

142-
// |ExternalViewEmbedder|
143-
SkCanvas* GetRootCanvas() override { return nullptr; }
144-
145-
// |ExternalViewEmbedder|
146-
void CancelFrame() override {}
147-
148-
// |ExternalViewEmbedder|
149-
void BeginFrame(
150-
SkISize frame_size,
151-
GrDirectContext* context,
152-
double device_pixel_ratio,
153-
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) override {}
154-
155-
// |ExternalViewEmbedder|
156-
void PrerollCompositeEmbeddedView(
157-
int view_id,
158-
std::unique_ptr<EmbeddedViewParams> params) override {}
159-
160-
// |ExternalViewEmbedder|
161-
std::vector<SkCanvas*> GetCurrentCanvases() override {
162-
return std::vector<SkCanvas*>();
163-
}
164-
165-
// |ExternalViewEmbedder|
166-
virtual SkCanvas* CompositeEmbeddedView(int view_id) override {
167-
return nullptr;
168-
}
169-
134+
// View manipulation.
170135
void CreateView(int64_t view_id, bool hit_testable, bool focusable);
171136
void UpdateView(int64_t view_id, bool hit_testable, bool focusable);
172137
void DestroyView(int64_t view_id);
@@ -183,7 +148,7 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder {
183148
const SkRect& paint_bounds,
184149
std::vector<Layer*> paint_layers);
185150

186-
SessionWrapper& session_;
151+
scenic::Session* session_;
187152

188153
scenic::View root_view_;
189154
scenic::EntityNode metrics_node_;

shell/platform/fuchsia/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ group("fuchsia") {
8787
group("tests") {
8888
testonly = true
8989

90-
deps = [ "flutter:tests" ]
90+
#deps = [ "flutter:tests" ]
9191
}

shell/platform/fuchsia/flutter/BUILD.gn

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ template("runner_sources") {
4949

5050
source_set(target_name) {
5151
sources = [
52-
"accessibility_bridge.cc",
53-
"accessibility_bridge.h",
54-
"component.cc",
55-
"component.h",
56-
"engine.cc",
57-
"engine.h",
52+
#"accessibility_bridge.cc",
53+
#"accessibility_bridge.h",
54+
#"component.cc",
55+
#"component.h",
56+
#"engine.cc",
57+
#"engine.h",
5858
"flutter_runner_product_configuration.cc",
5959
"flutter_runner_product_configuration.h",
6060
"fuchsia_external_view_embedder.cc",
@@ -68,10 +68,10 @@ template("runner_sources") {
6868
"logging.h",
6969
"loop.cc",
7070
"loop.h",
71-
"platform_view.cc",
72-
"platform_view.h",
73-
"runner.cc",
74-
"runner.h",
71+
#"platform_view.cc",
72+
#"platform_view.h",
73+
#"runner.cc",
74+
#"runner.h",
7575
"session_connection.cc",
7676
"session_connection.h",
7777
"surface.cc",

0 commit comments

Comments
 (0)