未验证 提交 9b752790 编写于 作者: R Ren You 提交者: GitHub

Revert "[fuchsia] External view embedder will be shared with platform view (#21850)" (#21924)

This reverts commit 1bc025d6.
上级 787b9c53
...@@ -26,10 +26,10 @@ void ChildSceneLayer::Paint(PaintContext& context) const { ...@@ -26,10 +26,10 @@ void ChildSceneLayer::Paint(PaintContext& context) const {
FML_NOTREACHED(); FML_NOTREACHED();
} }
void ChildSceneLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ChildSceneLayer::UpdateScene"); TRACE_EVENT0("flutter", "ChildSceneLayer::UpdateScene");
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
context->UpdateView(layer_id_, offset_, size_, hit_testable_); context.UpdateView(layer_id_, offset_, size_, hit_testable_);
} }
} // namespace flutter } // namespace flutter
...@@ -26,7 +26,7 @@ class ChildSceneLayer : public Layer { ...@@ -26,7 +26,7 @@ class ChildSceneLayer : public Layer {
void Paint(PaintContext& context) const override; void Paint(PaintContext& context) const override;
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
private: private:
zx_koid_t layer_id_ = ZX_KOID_INVALID; zx_koid_t layer_id_ = ZX_KOID_INVALID;
......
...@@ -41,7 +41,7 @@ void ClipPathLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { ...@@ -41,7 +41,7 @@ void ClipPathLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void ClipPathLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void ClipPathLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ClipPathLayer::UpdateScene"); TRACE_EVENT0("flutter", "ClipPathLayer::UpdateScene");
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
......
...@@ -22,7 +22,7 @@ class ClipPathLayer : public ContainerLayer { ...@@ -22,7 +22,7 @@ class ClipPathLayer : public ContainerLayer {
} }
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
#endif #endif
private: private:
......
...@@ -36,7 +36,7 @@ void ClipRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { ...@@ -36,7 +36,7 @@ void ClipRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void ClipRectLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void ClipRectLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ClipRectLayer::UpdateScene"); TRACE_EVENT0("flutter", "ClipRectLayer::UpdateScene");
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
......
...@@ -21,7 +21,7 @@ class ClipRectLayer : public ContainerLayer { ...@@ -21,7 +21,7 @@ class ClipRectLayer : public ContainerLayer {
} }
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
#endif #endif
private: private:
......
...@@ -37,7 +37,7 @@ void ClipRRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { ...@@ -37,7 +37,7 @@ void ClipRRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void ClipRRectLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void ClipRRectLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ClipRRectLayer::UpdateScene"); TRACE_EVENT0("flutter", "ClipRRectLayer::UpdateScene");
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
......
...@@ -22,7 +22,7 @@ class ClipRRectLayer : public ContainerLayer { ...@@ -22,7 +22,7 @@ class ClipRRectLayer : public ContainerLayer {
} }
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
#endif #endif
private: private:
......
...@@ -98,19 +98,18 @@ void ContainerLayer::CheckForChildLayerBelow(PrerollContext* context) { ...@@ -98,19 +98,18 @@ void ContainerLayer::CheckForChildLayerBelow(PrerollContext* context) {
// All ContainerLayers make the check in PrerollChildren. // All ContainerLayers make the check in PrerollChildren.
} }
void ContainerLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void ContainerLayer::UpdateScene(SceneUpdateContext& context) {
UpdateSceneChildren(context); UpdateSceneChildren(context);
} }
void ContainerLayer::UpdateSceneChildren( void ContainerLayer::UpdateSceneChildren(SceneUpdateContext& context) {
std::shared_ptr<SceneUpdateContext> context) {
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
std::optional<SceneUpdateContext::Frame> frame; std::optional<SceneUpdateContext::Frame> frame;
if (child_layer_exists_below_) { if (child_layer_exists_below_) {
frame.emplace( frame.emplace(
context, SkRRect::MakeRect(paint_bounds()), SK_ColorTRANSPARENT, context, SkRRect::MakeRect(paint_bounds()), SK_ColorTRANSPARENT,
SkScalarRoundToInt(context->alphaf() * 255), "flutter::ContainerLayer"); SkScalarRoundToInt(context.alphaf() * 255), "flutter::ContainerLayer");
frame->AddPaintLayer(this); frame->AddPaintLayer(this);
} }
......
...@@ -21,7 +21,7 @@ class ContainerLayer : public Layer { ...@@ -21,7 +21,7 @@ class ContainerLayer : public Layer {
void Paint(PaintContext& context) const override; void Paint(PaintContext& context) const override;
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void CheckForChildLayerBelow(PrerollContext* context) override; void CheckForChildLayerBelow(PrerollContext* context) override;
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
#endif #endif
const std::vector<std::shared_ptr<Layer>>& layers() const { return layers_; } const std::vector<std::shared_ptr<Layer>>& layers() const { return layers_; }
...@@ -33,7 +33,7 @@ class ContainerLayer : public Layer { ...@@ -33,7 +33,7 @@ class ContainerLayer : public Layer {
void PaintChildren(PaintContext& context) const; void PaintChildren(PaintContext& context) const;
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateSceneChildren(std::shared_ptr<SceneUpdateContext> context); void UpdateSceneChildren(SceneUpdateContext& context);
#endif #endif
// Try to prepare the raster cache for a given layer. // Try to prepare the raster cache for a given layer.
......
...@@ -261,7 +261,7 @@ struct TestContext { ...@@ -261,7 +261,7 @@ struct TestContext {
std::unique_ptr<MockSessionWrapper> mock_session_wrapper; std::unique_ptr<MockSessionWrapper> mock_session_wrapper;
// SceneUpdateContext. // SceneUpdateContext.
std::shared_ptr<SceneUpdateContext> scene_update_context; std::unique_ptr<SceneUpdateContext> scene_update_context;
// PrerollContext. // PrerollContext.
MutatorsStack unused_stack; MutatorsStack unused_stack;
...@@ -286,7 +286,7 @@ std::unique_ptr<TestContext> InitTest() { ...@@ -286,7 +286,7 @@ std::unique_ptr<TestContext> InitTest() {
std::make_unique<MockSessionWrapper>(std::move(session_ptr)); std::make_unique<MockSessionWrapper>(std::move(session_ptr));
// Init SceneUpdateContext. // Init SceneUpdateContext.
context->scene_update_context = std::make_shared<SceneUpdateContext>( context->scene_update_context = std::make_unique<SceneUpdateContext>(
"fuchsia_layer_unittest", fuchsia::ui::views::ViewToken(), "fuchsia_layer_unittest", fuchsia::ui::views::ViewToken(),
scenic::ViewRefPair::New(), *(context->mock_session_wrapper)); scenic::ViewRefPair::New(), *(context->mock_session_wrapper));
...@@ -410,7 +410,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_PhysicalShapeLayersAndChildSceneLayers) { ...@@ -410,7 +410,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_PhysicalShapeLayersAndChildSceneLayers) {
// Create another frame to be the "real" root. Required because // Create another frame to be the "real" root. Required because
// UpdateScene() traversal expects there to already be a top node. // UpdateScene() traversal expects there to already be a top node.
SceneUpdateContext::Frame frame(test_context->scene_update_context, SceneUpdateContext::Frame frame(*(test_context->scene_update_context),
SkRRect::MakeRect(SkRect::MakeWH(100, 100)), SkRRect::MakeRect(SkRect::MakeWH(100, 100)),
SK_ColorTRANSPARENT, SK_AlphaOPAQUE, SK_ColorTRANSPARENT, SK_AlphaOPAQUE,
"fuchsia test root"); "fuchsia test root");
...@@ -555,7 +555,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_PhysicalShapeLayersAndChildSceneLayers) { ...@@ -555,7 +555,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_PhysicalShapeLayersAndChildSceneLayers) {
// Finally, UpdateScene(). The MockSession will check the emitted commands // Finally, UpdateScene(). The MockSession will check the emitted commands
// against the list above. // against the list above.
root->UpdateScene(test_context->scene_update_context); root->UpdateScene(*(test_context->scene_update_context));
test_context->mock_session_wrapper->Present(); test_context->mock_session_wrapper->Present();
...@@ -626,7 +626,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_OpacityAndTransformLayer) { ...@@ -626,7 +626,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_OpacityAndTransformLayer) {
// Create another frame to be the "real" root. Required because // Create another frame to be the "real" root. Required because
// UpdateScene() traversal expects there to already be a top node. // UpdateScene() traversal expects there to already be a top node.
SceneUpdateContext::Frame frame(test_context->scene_update_context, SceneUpdateContext::Frame frame(*(test_context->scene_update_context),
SkRRect::MakeRect(SkRect::MakeWH(100, 100)), SkRRect::MakeRect(SkRect::MakeWH(100, 100)),
SK_ColorTRANSPARENT, SK_AlphaOPAQUE, SK_ColorTRANSPARENT, SK_AlphaOPAQUE,
"fuchsia test root"); "fuchsia test root");
...@@ -737,7 +737,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_OpacityAndTransformLayer) { ...@@ -737,7 +737,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_OpacityAndTransformLayer) {
// Finally, UpdateScene(). The MockSession will check the emitted // Finally, UpdateScene(). The MockSession will check the emitted
// commands against the list above. // commands against the list above.
root->UpdateScene(test_context->scene_update_context); root->UpdateScene(*(test_context->scene_update_context));
test_context->mock_session_wrapper->Present(); test_context->mock_session_wrapper->Present();
......
...@@ -67,13 +67,13 @@ void Layer::CheckForChildLayerBelow(PrerollContext* context) { ...@@ -67,13 +67,13 @@ void Layer::CheckForChildLayerBelow(PrerollContext* context) {
} }
} }
void Layer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void Layer::UpdateScene(SceneUpdateContext& context) {
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
FML_DCHECK(child_layer_exists_below_); FML_DCHECK(child_layer_exists_below_);
SceneUpdateContext::Frame frame( SceneUpdateContext::Frame frame(
context, SkRRect::MakeRect(paint_bounds()), SK_ColorTRANSPARENT, context, SkRRect::MakeRect(paint_bounds()), SK_ColorTRANSPARENT,
SkScalarRoundToInt(context->alphaf() * 255), "flutter::Layer"); SkScalarRoundToInt(context.alphaf() * 255), "flutter::Layer");
frame.AddPaintLayer(this); frame.AddPaintLayer(this);
} }
......
...@@ -154,7 +154,7 @@ class Layer { ...@@ -154,7 +154,7 @@ class Layer {
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
// Updates the system composited scene. // Updates the system composited scene.
virtual void UpdateScene(std::shared_ptr<SceneUpdateContext> context); virtual void UpdateScene(SceneUpdateContext& context);
virtual void CheckForChildLayerBelow(PrerollContext* context); virtual void CheckForChildLayerBelow(PrerollContext* context);
#endif #endif
......
...@@ -62,11 +62,11 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame, ...@@ -62,11 +62,11 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
} }
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void LayerTree::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void LayerTree::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "LayerTree::UpdateScene"); TRACE_EVENT0("flutter", "LayerTree::UpdateScene");
// Reset for a new Scene. // Reset for a new Scene.
context->Reset(); context.Reset();
const float inv_dpr = 1.0f / device_pixel_ratio_; const float inv_dpr = 1.0f / device_pixel_ratio_;
SceneUpdateContext::Transform transform(context, inv_dpr, inv_dpr, 1.0f); SceneUpdateContext::Transform transform(context, inv_dpr, inv_dpr, 1.0f);
...@@ -82,7 +82,7 @@ void LayerTree::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { ...@@ -82,7 +82,7 @@ void LayerTree::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
if (root_layer_->needs_painting()) { if (root_layer_->needs_painting()) {
frame.AddPaintLayer(root_layer_.get()); frame.AddPaintLayer(root_layer_.get());
} }
context->root_node().AddChild(transform.entity_node()); context.root_node().AddChild(transform.entity_node());
} }
#endif #endif
......
...@@ -32,7 +32,7 @@ class LayerTree { ...@@ -32,7 +32,7 @@ class LayerTree {
bool ignore_raster_cache = false); bool ignore_raster_cache = false);
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context); void UpdateScene(SceneUpdateContext& context);
#endif #endif
void Paint(CompositorContext::ScopedFrame& frame, void Paint(CompositorContext::ScopedFrame& frame,
......
...@@ -85,11 +85,11 @@ void OpacityLayer::Paint(PaintContext& context) const { ...@@ -85,11 +85,11 @@ void OpacityLayer::Paint(PaintContext& context) const {
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void OpacityLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void OpacityLayer::UpdateScene(SceneUpdateContext& context) {
float saved_alpha = context->alphaf(); float saved_alpha = context.alphaf();
context->set_alphaf(context->alphaf() * (alpha_ / 255.f)); context.set_alphaf(context.alphaf() * (alpha_ / 255.f));
ContainerLayer::UpdateScene(context); ContainerLayer::UpdateScene(context);
context->set_alphaf(saved_alpha); context.set_alphaf(saved_alpha);
} }
#endif #endif
......
...@@ -32,7 +32,7 @@ class OpacityLayer : public MergedContainerLayer { ...@@ -32,7 +32,7 @@ class OpacityLayer : public MergedContainerLayer {
void Paint(PaintContext& context) const override; void Paint(PaintContext& context) const override;
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
#endif #endif
private: private:
......
...@@ -47,11 +47,10 @@ void PlatformViewLayer::Paint(PaintContext& context) const { ...@@ -47,11 +47,10 @@ void PlatformViewLayer::Paint(PaintContext& context) const {
} }
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void PlatformViewLayer::UpdateScene( void PlatformViewLayer::UpdateScene(SceneUpdateContext& context) {
std::shared_ptr<SceneUpdateContext> context) {
TRACE_EVENT0("flutter", "PlatformViewLayer::UpdateScene"); TRACE_EVENT0("flutter", "PlatformViewLayer::UpdateScene");
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
context->UpdateView(view_id_, offset_, size_); context.UpdateView(view_id_, offset_, size_);
} }
#endif #endif
......
...@@ -19,7 +19,7 @@ class PlatformViewLayer : public Layer { ...@@ -19,7 +19,7 @@ class PlatformViewLayer : public Layer {
void Paint(PaintContext& context) const override; void Paint(PaintContext& context) const override;
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
// Updates the system composited scene. // Updates the system composited scene.
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
#endif #endif
private: private:
......
...@@ -54,7 +54,7 @@ void TransformLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { ...@@ -54,7 +54,7 @@ void TransformLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void TransformLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) { void TransformLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "TransformLayer::UpdateScene"); TRACE_EVENT0("flutter", "TransformLayer::UpdateScene");
FML_DCHECK(needs_system_composite()); FML_DCHECK(needs_system_composite());
......
...@@ -20,7 +20,7 @@ class TransformLayer : public ContainerLayer { ...@@ -20,7 +20,7 @@ class TransformLayer : public ContainerLayer {
void Paint(PaintContext& context) const override; void Paint(PaintContext& context) const override;
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override; void UpdateScene(SceneUpdateContext& context) override;
#endif #endif
private: private:
......
...@@ -215,30 +215,29 @@ void SceneUpdateContext::DestroyView(int64_t view_id) { ...@@ -215,30 +215,29 @@ void SceneUpdateContext::DestroyView(int64_t view_id) {
ViewHolder::Destroy(view_id); ViewHolder::Destroy(view_id);
} }
SceneUpdateContext::Entity::Entity(std::shared_ptr<SceneUpdateContext> context) SceneUpdateContext::Entity::Entity(SceneUpdateContext& context)
: context_(context), : context_(context),
previous_entity_(context->top_entity_), previous_entity_(context.top_entity_),
entity_node_(context->session_.get()) { entity_node_(context.session_.get()) {
context->top_entity_ = this; context.top_entity_ = this;
} }
SceneUpdateContext::Entity::~Entity() { SceneUpdateContext::Entity::~Entity() {
if (previous_entity_) { if (previous_entity_) {
previous_entity_->embedder_node().AddChild(entity_node_); previous_entity_->embedder_node().AddChild(entity_node_);
} else { } else {
context_->root_node_.AddChild(entity_node_); context_.root_node_.AddChild(entity_node_);
} }
FML_DCHECK(context_->top_entity_ == this); FML_DCHECK(context_.top_entity_ == this);
context_->top_entity_ = previous_entity_; context_.top_entity_ = previous_entity_;
} }
SceneUpdateContext::Transform::Transform( SceneUpdateContext::Transform::Transform(SceneUpdateContext& context,
std::shared_ptr<SceneUpdateContext> context, const SkMatrix& transform)
const SkMatrix& transform)
: Entity(context), : Entity(context),
previous_scale_x_(context->top_scale_x_), previous_scale_x_(context.top_scale_x_),
previous_scale_y_(context->top_scale_y_) { previous_scale_y_(context.top_scale_y_) {
entity_node().SetLabel("flutter::Transform"); entity_node().SetLabel("flutter::Transform");
if (!transform.isIdentity()) { if (!transform.isIdentity()) {
// TODO(SCN-192): The perspective and shear components in the matrix // TODO(SCN-192): The perspective and shear components in the matrix
...@@ -256,8 +255,8 @@ SceneUpdateContext::Transform::Transform( ...@@ -256,8 +255,8 @@ SceneUpdateContext::Transform::Transform(
decomposition.scale().y, // decomposition.scale().y, //
1.f // 1.f //
); );
context->top_scale_x_ *= decomposition.scale().x; context.top_scale_x_ *= decomposition.scale().x;
context->top_scale_y_ *= decomposition.scale().y; context.top_scale_y_ *= decomposition.scale().y;
entity_node().SetRotation(decomposition.rotation().x, // entity_node().SetRotation(decomposition.rotation().x, //
decomposition.rotation().y, // decomposition.rotation().y, //
...@@ -268,46 +267,45 @@ SceneUpdateContext::Transform::Transform( ...@@ -268,46 +267,45 @@ SceneUpdateContext::Transform::Transform(
} }
} }
SceneUpdateContext::Transform::Transform( SceneUpdateContext::Transform::Transform(SceneUpdateContext& context,
std::shared_ptr<SceneUpdateContext> context, float scale_x,
float scale_x, float scale_y,
float scale_y, float scale_z)
float scale_z)
: Entity(context), : Entity(context),
previous_scale_x_(context->top_scale_x_), previous_scale_x_(context.top_scale_x_),
previous_scale_y_(context->top_scale_y_) { previous_scale_y_(context.top_scale_y_) {
entity_node().SetLabel("flutter::Transform"); entity_node().SetLabel("flutter::Transform");
if (scale_x != 1.f || scale_y != 1.f || scale_z != 1.f) { if (scale_x != 1.f || scale_y != 1.f || scale_z != 1.f) {
entity_node().SetScale(scale_x, scale_y, scale_z); entity_node().SetScale(scale_x, scale_y, scale_z);
context->top_scale_x_ *= scale_x; context.top_scale_x_ *= scale_x;
context->top_scale_y_ *= scale_y; context.top_scale_y_ *= scale_y;
} }
} }
SceneUpdateContext::Transform::~Transform() { SceneUpdateContext::Transform::~Transform() {
context()->top_scale_x_ = previous_scale_x_; context().top_scale_x_ = previous_scale_x_;
context()->top_scale_y_ = previous_scale_y_; context().top_scale_y_ = previous_scale_y_;
} }
SceneUpdateContext::Frame::Frame(std::shared_ptr<SceneUpdateContext> context, SceneUpdateContext::Frame::Frame(SceneUpdateContext& context,
const SkRRect& rrect, const SkRRect& rrect,
SkColor color, SkColor color,
SkAlpha opacity, SkAlpha opacity,
std::string label) std::string label)
: Entity(context), : Entity(context),
previous_elevation_(context->top_elevation_), previous_elevation_(context.top_elevation_),
rrect_(rrect), rrect_(rrect),
color_(color), color_(color),
opacity_(opacity), opacity_(opacity),
opacity_node_(context->session_.get()), opacity_node_(context.session_.get()),
paint_bounds_(SkRect::MakeEmpty()) { paint_bounds_(SkRect::MakeEmpty()) {
// Increment elevation trackers before calculating any local elevation. // Increment elevation trackers before calculating any local elevation.
// |UpdateView| can modify context->next_elevation_, which is why it is // |UpdateView| can modify context.next_elevation_, which is why it is
// neccesary to track this addtional state. // neccesary to track this addtional state.
context->top_elevation_ += kScenicZElevationBetweenLayers; context.top_elevation_ += kScenicZElevationBetweenLayers;
context->next_elevation_ += kScenicZElevationBetweenLayers; context.next_elevation_ += kScenicZElevationBetweenLayers;
float local_elevation = context->next_elevation_ - previous_elevation_; float local_elevation = context.next_elevation_ - previous_elevation_;
entity_node().SetTranslation(0.f, 0.f, -local_elevation); entity_node().SetTranslation(0.f, 0.f, -local_elevation);
entity_node().SetLabel(label); entity_node().SetLabel(label);
entity_node().AddChild(opacity_node_); entity_node().AddChild(opacity_node_);
...@@ -320,11 +318,11 @@ SceneUpdateContext::Frame::Frame(std::shared_ptr<SceneUpdateContext> context, ...@@ -320,11 +318,11 @@ SceneUpdateContext::Frame::Frame(std::shared_ptr<SceneUpdateContext> context,
} }
SceneUpdateContext::Frame::~Frame() { SceneUpdateContext::Frame::~Frame() {
context()->top_elevation_ = previous_elevation_; context().top_elevation_ = previous_elevation_;
// Add a part which represents the frame's geometry for clipping purposes // Add a part which represents the frame's geometry for clipping purposes
context()->CreateFrame(entity_node(), rrect_, color_, opacity_, paint_bounds_, context().CreateFrame(entity_node(), rrect_, color_, opacity_, paint_bounds_,
std::move(paint_layers_)); std::move(paint_layers_));
} }
void SceneUpdateContext::Frame::AddPaintLayer(Layer* layer) { void SceneUpdateContext::Frame::AddPaintLayer(Layer* layer) {
...@@ -333,7 +331,7 @@ void SceneUpdateContext::Frame::AddPaintLayer(Layer* layer) { ...@@ -333,7 +331,7 @@ void SceneUpdateContext::Frame::AddPaintLayer(Layer* layer) {
paint_bounds_.join(layer->paint_bounds()); paint_bounds_.join(layer->paint_bounds());
} }
SceneUpdateContext::Clip::Clip(std::shared_ptr<SceneUpdateContext> context, SceneUpdateContext::Clip::Clip(SceneUpdateContext& context,
const SkRect& shape_bounds) const SkRect& shape_bounds)
: Entity(context) { : Entity(context) {
entity_node().SetLabel("flutter::Clip"); entity_node().SetLabel("flutter::Clip");
......
...@@ -46,15 +46,15 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder { ...@@ -46,15 +46,15 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder {
public: public:
class Entity { class Entity {
public: public:
Entity(std::shared_ptr<SceneUpdateContext> context); Entity(SceneUpdateContext& context);
virtual ~Entity(); virtual ~Entity();
std::shared_ptr<SceneUpdateContext> context() { return context_; } SceneUpdateContext& context() { return context_; }
scenic::EntityNode& entity_node() { return entity_node_; } scenic::EntityNode& entity_node() { return entity_node_; }
virtual scenic::ContainerNode& embedder_node() { return entity_node_; } virtual scenic::ContainerNode& embedder_node() { return entity_node_; }
private: private:
std::shared_ptr<SceneUpdateContext> context_; SceneUpdateContext& context_;
Entity* const previous_entity_; Entity* const previous_entity_;
scenic::EntityNode entity_node_; scenic::EntityNode entity_node_;
...@@ -62,9 +62,8 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder { ...@@ -62,9 +62,8 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder {
class Transform : public Entity { class Transform : public Entity {
public: public:
Transform(std::shared_ptr<SceneUpdateContext> context, Transform(SceneUpdateContext& context, const SkMatrix& transform);
const SkMatrix& transform); Transform(SceneUpdateContext& context,
Transform(std::shared_ptr<SceneUpdateContext> context,
float scale_x, float scale_x,
float scale_y, float scale_y,
float scale_z); float scale_z);
...@@ -80,7 +79,7 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder { ...@@ -80,7 +79,7 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder {
// When layer is not nullptr, the frame is associated with a layer subtree // When layer is not nullptr, the frame is associated with a layer subtree
// rooted with that layer. The frame may then create a surface that will be // rooted with that layer. The frame may then create a surface that will be
// retained for that layer. // retained for that layer.
Frame(std::shared_ptr<SceneUpdateContext> context, Frame(SceneUpdateContext& context,
const SkRRect& rrect, const SkRRect& rrect,
SkColor color, SkColor color,
SkAlpha opacity, SkAlpha opacity,
...@@ -105,8 +104,7 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder { ...@@ -105,8 +104,7 @@ class SceneUpdateContext : public flutter::ExternalViewEmbedder {
class Clip : public Entity { class Clip : public Entity {
public: public:
Clip(std::shared_ptr<SceneUpdateContext> context, Clip(SceneUpdateContext& context, const SkRect& shape_bounds);
const SkRect& shape_bounds);
~Clip() = default; ~Clip() = default;
}; };
......
...@@ -23,7 +23,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame { ...@@ -23,7 +23,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger, fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger,
SessionConnection& session_connection, SessionConnection& session_connection,
VulkanSurfaceProducer& surface_producer, VulkanSurfaceProducer& surface_producer,
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context) flutter::SceneUpdateContext& scene_update_context)
: flutter::CompositorContext::ScopedFrame(context, : flutter::CompositorContext::ScopedFrame(context,
surface_producer.gr_context(), surface_producer.gr_context(),
canvas, canvas,
...@@ -39,7 +39,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame { ...@@ -39,7 +39,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
private: private:
SessionConnection& session_connection_; SessionConnection& session_connection_;
VulkanSurfaceProducer& surface_producer_; VulkanSurfaceProducer& surface_producer_;
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context_; flutter::SceneUpdateContext& scene_update_context_;
flutter::RasterStatus Raster(flutter::LayerTree& layer_tree, flutter::RasterStatus Raster(flutter::LayerTree& layer_tree,
bool ignore_raster_cache) override { bool ignore_raster_cache) override {
...@@ -64,7 +64,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame { ...@@ -64,7 +64,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
// Flush all pending session ops: create surfaces and enqueue session // Flush all pending session ops: create surfaces and enqueue session
// Image ops for the frame's paint tasks, then Present. // Image ops for the frame's paint tasks, then Present.
TRACE_EVENT0("flutter", "SessionPresent"); TRACE_EVENT0("flutter", "SessionPresent");
frame_paint_tasks = scene_update_context_->GetPaintTasks(); frame_paint_tasks = scene_update_context_.GetPaintTasks();
for (auto& task : frame_paint_tasks) { for (auto& task : frame_paint_tasks) {
SkISize physical_size = SkISize physical_size =
SkISize::Make(layer_tree.device_pixel_ratio() * task.scale_x * SkISize::Make(layer_tree.device_pixel_ratio() * task.scale_x *
...@@ -142,7 +142,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame { ...@@ -142,7 +142,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
CompositorContext::CompositorContext( CompositorContext::CompositorContext(
SessionConnection& session_connection, SessionConnection& session_connection,
VulkanSurfaceProducer& surface_producer, VulkanSurfaceProducer& surface_producer,
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context) flutter::SceneUpdateContext& scene_update_context)
: session_connection_(session_connection), : session_connection_(session_connection),
surface_producer_(surface_producer), surface_producer_(surface_producer),
scene_update_context_(scene_update_context) {} scene_update_context_(scene_update_context) {}
......
...@@ -21,17 +21,16 @@ namespace flutter_runner { ...@@ -21,17 +21,16 @@ namespace flutter_runner {
// Fuchsia. // Fuchsia.
class CompositorContext final : public flutter::CompositorContext { class CompositorContext final : public flutter::CompositorContext {
public: public:
CompositorContext( CompositorContext(SessionConnection& session_connection,
SessionConnection& session_connection, VulkanSurfaceProducer& surface_producer,
VulkanSurfaceProducer& surface_producer, flutter::SceneUpdateContext& scene_update_context);
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context);
~CompositorContext() override; ~CompositorContext() override;
private: private:
SessionConnection& session_connection_; SessionConnection& session_connection_;
VulkanSurfaceProducer& surface_producer_; VulkanSurfaceProducer& surface_producer_;
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context_; flutter::SceneUpdateContext& scene_update_context_;
// |flutter::CompositorContext| // |flutter::CompositorContext|
std::unique_ptr<ScopedFrame> AcquireFrame( std::unique_ptr<ScopedFrame> AcquireFrame(
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <zircon/status.h> #include <zircon/status.h>
#include "../runtime/dart/utils/files.h" #include "../runtime/dart/utils/files.h"
#include "flow/embedded_views.h"
#include "flutter/common/task_runners.h" #include "flutter/common/task_runners.h"
#include "flutter/fml/make_copyable.h" #include "flutter/fml/make_copyable.h"
#include "flutter/fml/synchronization/waitable_event.h" #include "flutter/fml/synchronization/waitable_event.h"
...@@ -139,18 +138,15 @@ Engine::Engine(Delegate& delegate, ...@@ -139,18 +138,15 @@ Engine::Engine(Delegate& delegate,
surface_producer_.emplace(session_connection_->get()); surface_producer_.emplace(session_connection_->get());
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
if (use_legacy_renderer_) { if (use_legacy_renderer_) {
legacy_external_view_embedder_ = legacy_external_view_embedder_.emplace(
std::make_shared<flutter::SceneUpdateContext>( thread_label_, std::move(view_token), std::move(view_ref_pair),
thread_label_, std::move(view_token), session_connection_.value());
std::move(view_ref_pair), session_connection_.value());
} else } else
#endif #endif
{ {
external_view_embedder_ = external_view_embedder_.emplace(
std::make_shared<FuchsiaExternalViewEmbedder>( thread_label_, std::move(view_token), std::move(view_ref_pair),
thread_label_, std::move(view_token), session_connection_.value(), surface_producer_.value());
std::move(view_ref_pair), session_connection_.value(),
surface_producer_.value());
} }
})); }));
...@@ -210,7 +206,6 @@ Engine::Engine(Delegate& delegate, ...@@ -210,7 +206,6 @@ Engine::Engine(Delegate& delegate,
on_update_view_callback = std::move(on_update_view_callback), on_update_view_callback = std::move(on_update_view_callback),
on_destroy_view_callback = std::move(on_destroy_view_callback), on_destroy_view_callback = std::move(on_destroy_view_callback),
on_create_surface_callback = std::move(on_create_surface_callback), on_create_surface_callback = std::move(on_create_surface_callback),
external_view_embedder = GetExternalViewEmbedder(),
vsync_offset = product_config.get_vsync_offset(), vsync_offset = product_config.get_vsync_offset(),
vsync_handle = vsync_event_.get()](flutter::Shell& shell) mutable { vsync_handle = vsync_event_.get()](flutter::Shell& shell) mutable {
return std::make_unique<flutter_runner::PlatformView>( return std::make_unique<flutter_runner::PlatformView>(
...@@ -228,7 +223,6 @@ Engine::Engine(Delegate& delegate, ...@@ -228,7 +223,6 @@ Engine::Engine(Delegate& delegate,
std::move(on_update_view_callback), std::move(on_update_view_callback),
std::move(on_destroy_view_callback), std::move(on_destroy_view_callback),
std::move(on_create_surface_callback), std::move(on_create_surface_callback),
external_view_embedder, // external view embedder
std::move(vsync_offset), // vsync offset std::move(vsync_offset), // vsync offset
vsync_handle); vsync_handle);
}); });
...@@ -245,7 +239,7 @@ Engine::Engine(Delegate& delegate, ...@@ -245,7 +239,7 @@ Engine::Engine(Delegate& delegate,
auto compositor_context = auto compositor_context =
std::make_unique<flutter_runner::CompositorContext>( std::make_unique<flutter_runner::CompositorContext>(
session_connection_.value(), surface_producer_.value(), session_connection_.value(), surface_producer_.value(),
legacy_external_view_embedder_); legacy_external_view_embedder_.value());
return std::make_unique<flutter::Rasterizer>( return std::make_unique<flutter::Rasterizer>(
shell, std::move(compositor_context)); shell, std::move(compositor_context));
} else { } else {
...@@ -584,28 +578,22 @@ void Engine::DestroyView(int64_t view_id) { ...@@ -584,28 +578,22 @@ void Engine::DestroyView(int64_t view_id) {
} }
std::unique_ptr<flutter::Surface> Engine::CreateSurface() { std::unique_ptr<flutter::Surface> Engine::CreateSurface() {
return std::make_unique<Surface>(thread_label_, GetExternalViewEmbedder(), flutter::ExternalViewEmbedder* external_view_embedder = nullptr;
surface_producer_->gr_context());
}
std::shared_ptr<flutter::ExternalViewEmbedder>
Engine::GetExternalViewEmbedder() {
std::shared_ptr<flutter::ExternalViewEmbedder> external_view_embedder =
nullptr;
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
if (use_legacy_renderer_) { if (use_legacy_renderer_) {
FML_CHECK(legacy_external_view_embedder_); FML_CHECK(legacy_external_view_embedder_);
external_view_embedder = legacy_external_view_embedder_; external_view_embedder = &legacy_external_view_embedder_.value();
} else } else
#endif #endif
{ {
FML_CHECK(external_view_embedder_); FML_CHECK(external_view_embedder_);
external_view_embedder = external_view_embedder_; external_view_embedder = &external_view_embedder_.value();
} }
FML_CHECK(external_view_embedder); FML_CHECK(external_view_embedder);
return external_view_embedder; return std::make_unique<Surface>(thread_label_, external_view_embedder,
surface_producer_->gr_context());
} }
#if !defined(DART_PRODUCT) #if !defined(DART_PRODUCT)
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <lib/ui/scenic/cpp/view_ref_pair.h> #include <lib/ui/scenic/cpp/view_ref_pair.h>
#include <lib/zx/event.h> #include <lib/zx/event.h>
#include "flow/embedded_views.h"
#include "flutter/flow/surface.h" #include "flutter/flow/surface.h"
#include "flutter/fml/macros.h" #include "flutter/fml/macros.h"
#include "flutter/shell/common/shell.h" #include "flutter/shell/common/shell.h"
...@@ -72,9 +71,9 @@ class Engine final { ...@@ -72,9 +71,9 @@ class Engine final {
std::optional<SessionConnection> session_connection_; std::optional<SessionConnection> session_connection_;
std::optional<VulkanSurfaceProducer> surface_producer_; std::optional<VulkanSurfaceProducer> surface_producer_;
std::shared_ptr<FuchsiaExternalViewEmbedder> external_view_embedder_; std::optional<FuchsiaExternalViewEmbedder> external_view_embedder_;
#if defined(LEGACY_FUCHSIA_EMBEDDER) #if defined(LEGACY_FUCHSIA_EMBEDDER)
std::shared_ptr<flutter::SceneUpdateContext> legacy_external_view_embedder_; std::optional<flutter::SceneUpdateContext> legacy_external_view_embedder_;
#endif #endif
std::unique_ptr<IsolateConfigurator> isolate_configurator_; std::unique_ptr<IsolateConfigurator> isolate_configurator_;
...@@ -100,7 +99,6 @@ class Engine final { ...@@ -100,7 +99,6 @@ class Engine final {
void CreateView(int64_t view_id, bool hit_testable, bool focusable); void CreateView(int64_t view_id, bool hit_testable, bool focusable);
void UpdateView(int64_t view_id, bool hit_testable, bool focusable); void UpdateView(int64_t view_id, bool hit_testable, bool focusable);
void DestroyView(int64_t view_id); void DestroyView(int64_t view_id);
std::shared_ptr<flutter::ExternalViewEmbedder> GetExternalViewEmbedder();
std::unique_ptr<flutter::Surface> CreateSurface(); std::unique_ptr<flutter::Surface> CreateSurface();
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "flow/embedded_views.h"
#define RAPIDJSON_HAS_STDSTRING 1 #define RAPIDJSON_HAS_STDSTRING 1
#include "platform_view.h" #include "platform_view.h"
...@@ -67,7 +66,6 @@ PlatformView::PlatformView( ...@@ -67,7 +66,6 @@ PlatformView::PlatformView(
OnUpdateView on_update_view_callback, OnUpdateView on_update_view_callback,
OnDestroyView on_destroy_view_callback, OnDestroyView on_destroy_view_callback,
OnCreateSurface on_create_surface_callback, OnCreateSurface on_create_surface_callback,
std::shared_ptr<flutter::ExternalViewEmbedder> external_view_embedder,
fml::TimeDelta vsync_offset, fml::TimeDelta vsync_offset,
zx_handle_t vsync_event_handle) zx_handle_t vsync_event_handle)
: flutter::PlatformView(delegate, std::move(task_runners)), : flutter::PlatformView(delegate, std::move(task_runners)),
...@@ -82,7 +80,6 @@ PlatformView::PlatformView( ...@@ -82,7 +80,6 @@ PlatformView::PlatformView(
on_update_view_callback_(std::move(on_update_view_callback)), on_update_view_callback_(std::move(on_update_view_callback)),
on_destroy_view_callback_(std::move(on_destroy_view_callback)), on_destroy_view_callback_(std::move(on_destroy_view_callback)),
on_create_surface_callback_(std::move(on_create_surface_callback)), on_create_surface_callback_(std::move(on_create_surface_callback)),
external_view_embedder_(external_view_embedder),
ime_client_(this), ime_client_(this),
vsync_offset_(std::move(vsync_offset)), vsync_offset_(std::move(vsync_offset)),
vsync_event_handle_(vsync_event_handle) { vsync_event_handle_(vsync_event_handle) {
......
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
#include <map> #include <map>
#include <set> #include <set>
#include "flow/embedded_views.h"
#include "flutter/fml/macros.h" #include "flutter/fml/macros.h"
#include "flutter/fml/time/time_delta.h" #include "flutter/fml/time/time_delta.h"
#include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/platform_view.h"
#include "accessibility_bridge.h" #include "accessibility_bridge.h"
#include "shell/platform/fuchsia/flutter/fuchsia_external_view_embedder.h"
namespace flutter_runner { namespace flutter_runner {
...@@ -63,7 +61,6 @@ class PlatformView final : public flutter::PlatformView, ...@@ -63,7 +61,6 @@ class PlatformView final : public flutter::PlatformView,
OnUpdateView on_update_view_callback, OnUpdateView on_update_view_callback,
OnDestroyView on_destroy_view_callback, OnDestroyView on_destroy_view_callback,
OnCreateSurface on_create_surface_callback, OnCreateSurface on_create_surface_callback,
std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder,
fml::TimeDelta vsync_offset, fml::TimeDelta vsync_offset,
zx_handle_t vsync_event_handle); zx_handle_t vsync_event_handle);
...@@ -172,7 +169,6 @@ class PlatformView final : public flutter::PlatformView, ...@@ -172,7 +169,6 @@ class PlatformView final : public flutter::PlatformView,
OnUpdateView on_update_view_callback_; OnUpdateView on_update_view_callback_;
OnDestroyView on_destroy_view_callback_; OnDestroyView on_destroy_view_callback_;
OnCreateSurface on_create_surface_callback_; OnCreateSurface on_create_surface_callback_;
std::shared_ptr<flutter::ExternalViewEmbedder> external_view_embedder_;
int current_text_input_client_ = 0; int current_text_input_client_ = 0;
fidl::Binding<fuchsia::ui::input::InputMethodEditorClient> ime_client_; fidl::Binding<fuchsia::ui::input::InputMethodEditorClient> ime_client_;
......
...@@ -184,11 +184,10 @@ TEST_F(PlatformViewTests, CreateSurfaceTest) { ...@@ -184,11 +184,10 @@ TEST_F(PlatformViewTests, CreateSurfaceTest) {
// Test create surface callback function. // Test create surface callback function.
sk_sp<GrDirectContext> gr_context = sk_sp<GrDirectContext> gr_context =
GrDirectContext::MakeMock(nullptr, GrContextOptions()); GrDirectContext::MakeMock(nullptr, GrContextOptions());
std::shared_ptr<MockExternalViewEmbedder> view_embedder = MockExternalViewEmbedder view_embedder;
std::make_shared<MockExternalViewEmbedder>();
auto CreateSurfaceCallback = [&view_embedder, gr_context]() { auto CreateSurfaceCallback = [&view_embedder, gr_context]() {
return std::make_unique<flutter_runner::Surface>( return std::make_unique<flutter_runner::Surface>(
"PlatformViewTest", view_embedder, gr_context.get()); "PlatformViewTest", &view_embedder, gr_context.get());
}; };
auto platform_view = flutter_runner::PlatformView( auto platform_view = flutter_runner::PlatformView(
...@@ -206,7 +205,6 @@ TEST_F(PlatformViewTests, CreateSurfaceTest) { ...@@ -206,7 +205,6 @@ TEST_F(PlatformViewTests, CreateSurfaceTest) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
CreateSurfaceCallback, // on_create_surface_callback, CreateSurfaceCallback, // on_create_surface_callback,
view_embedder, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -215,7 +213,7 @@ TEST_F(PlatformViewTests, CreateSurfaceTest) { ...@@ -215,7 +213,7 @@ TEST_F(PlatformViewTests, CreateSurfaceTest) {
RunLoopUntilIdle(); RunLoopUntilIdle();
EXPECT_EQ(gr_context.get(), delegate.surface()->GetContext()); EXPECT_EQ(gr_context.get(), delegate.surface()->GetContext());
EXPECT_EQ(view_embedder.get(), delegate.surface()->GetExternalViewEmbedder()); EXPECT_EQ(&view_embedder, delegate.surface()->GetExternalViewEmbedder());
} }
// This test makes sure that the PlatformView correctly registers Scenic // This test makes sure that the PlatformView correctly registers Scenic
...@@ -250,7 +248,6 @@ TEST_F(PlatformViewTests, SetViewportMetrics) { ...@@ -250,7 +248,6 @@ TEST_F(PlatformViewTests, SetViewportMetrics) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -383,7 +380,6 @@ TEST_F(PlatformViewTests, ChangesAccessibilitySettings) { ...@@ -383,7 +380,6 @@ TEST_F(PlatformViewTests, ChangesAccessibilitySettings) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -434,7 +430,6 @@ TEST_F(PlatformViewTests, EnableWireframeTest) { ...@@ -434,7 +430,6 @@ TEST_F(PlatformViewTests, EnableWireframeTest) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -496,7 +491,6 @@ TEST_F(PlatformViewTests, CreateViewTest) { ...@@ -496,7 +491,6 @@ TEST_F(PlatformViewTests, CreateViewTest) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -560,7 +554,6 @@ TEST_F(PlatformViewTests, UpdateViewTest) { ...@@ -560,7 +554,6 @@ TEST_F(PlatformViewTests, UpdateViewTest) {
UpdateViewCallback, // on_update_view_callback, UpdateViewCallback, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -624,7 +617,6 @@ TEST_F(PlatformViewTests, DestroyViewTest) { ...@@ -624,7 +617,6 @@ TEST_F(PlatformViewTests, DestroyViewTest) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
DestroyViewCallback, // on_destroy_view_callback, DestroyViewCallback, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -685,7 +677,6 @@ TEST_F(PlatformViewTests, ViewEventsTest) { ...@@ -685,7 +677,6 @@ TEST_F(PlatformViewTests, ViewEventsTest) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -768,7 +759,6 @@ TEST_F(PlatformViewTests, RequestFocusTest) { ...@@ -768,7 +759,6 @@ TEST_F(PlatformViewTests, RequestFocusTest) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
...@@ -845,7 +835,6 @@ TEST_F(PlatformViewTests, RequestFocusFailTest) { ...@@ -845,7 +835,6 @@ TEST_F(PlatformViewTests, RequestFocusFailTest) {
nullptr, // on_update_view_callback, nullptr, // on_update_view_callback,
nullptr, // on_destroy_view_callback, nullptr, // on_destroy_view_callback,
nullptr, // on_create_surface_callback, nullptr, // on_create_surface_callback,
nullptr, // external_view_embedder,
fml::TimeDelta::Zero(), // vsync_offset fml::TimeDelta::Zero(), // vsync_offset
ZX_HANDLE_INVALID // vsync_event_handle ZX_HANDLE_INVALID // vsync_event_handle
); );
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace flutter_runner { namespace flutter_runner {
Surface::Surface(std::string debug_label, Surface::Surface(std::string debug_label,
std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder, flutter::ExternalViewEmbedder* view_embedder,
GrDirectContext* gr_context) GrDirectContext* gr_context)
: debug_label_(std::move(debug_label)), : debug_label_(std::move(debug_label)),
view_embedder_(view_embedder), view_embedder_(view_embedder),
...@@ -53,7 +53,7 @@ SkMatrix Surface::GetRootTransformation() const { ...@@ -53,7 +53,7 @@ SkMatrix Surface::GetRootTransformation() const {
// |flutter::GetViewEmbedder| // |flutter::GetViewEmbedder|
flutter::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() { flutter::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
return view_embedder_.get(); return view_embedder_;
} }
} // namespace flutter_runner } // namespace flutter_runner
...@@ -16,14 +16,14 @@ namespace flutter_runner { ...@@ -16,14 +16,14 @@ namespace flutter_runner {
class Surface final : public flutter::Surface { class Surface final : public flutter::Surface {
public: public:
Surface(std::string debug_label, Surface(std::string debug_label,
std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder, flutter::ExternalViewEmbedder* view_embedder,
GrDirectContext* gr_context); GrDirectContext* gr_context);
~Surface() override; ~Surface() override;
private: private:
const std::string debug_label_; const std::string debug_label_;
std::shared_ptr<flutter::ExternalViewEmbedder> view_embedder_; flutter::ExternalViewEmbedder* view_embedder_;
GrDirectContext* gr_context_; GrDirectContext* gr_context_;
// |flutter::Surface| // |flutter::Surface|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册