Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions shell/common/platform_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ std::unique_ptr<Surface> PlatformView::CreateRenderingSurface() {
return nullptr;
}

std::shared_ptr<ExternalViewEmbedder>
PlatformView::CreateExternalViewEmbedder() {
FML_DLOG(WARNING)
<< "This platform doesn't support embedding external views.";
return nullptr;
}

void PlatformView::SetNextFrameCallback(const fml::closure& closure) {
if (!closure) {
return;
Expand Down
3 changes: 3 additions & 0 deletions shell/common/platform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <memory>

#include "flow/embedded_views.h"
#include "flutter/common/task_runners.h"
#include "flutter/flow/surface.h"
#include "flutter/flow/texture.h"
Expand Down Expand Up @@ -593,6 +594,8 @@ class PlatformView {
// GPU task runner.
virtual std::unique_ptr<Surface> CreateRenderingSurface();

virtual std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder();

private:
FML_DISALLOW_COPY_AND_ASSIGN(PlatformView);
};
Expand Down
6 changes: 6 additions & 0 deletions shell/common/shell_test_platform_view_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ std::unique_ptr<Surface> ShellTestPlatformViewGL::CreateRenderingSurface() {
return std::make_unique<GPUSurfaceGL>(this, true);
}

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder>
ShellTestPlatformViewGL::CreateExternalViewEmbedder() {
return shell_test_external_view_embedder_;
}

// |PlatformView|
PointerDataDispatcherMaker ShellTestPlatformViewGL::GetDispatcherMaker() {
return [](DefaultPointerDataDispatcher::Delegate& delegate) {
Expand Down
3 changes: 3 additions & 0 deletions shell/common/shell_test_platform_view_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class ShellTestPlatformViewGL : public ShellTestPlatformView,
// |PlatformView|
std::unique_ptr<Surface> CreateRenderingSurface() override;

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder() override;

// |PlatformView|
std::unique_ptr<VsyncWaiter> CreateVSyncWaiter() override;

Expand Down
6 changes: 6 additions & 0 deletions shell/common/shell_test_platform_view_vulkan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ std::unique_ptr<Surface> ShellTestPlatformViewVulkan::CreateRenderingSurface() {
shell_test_external_view_embedder_);
}

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder>
ShellTestPlatformViewVulkan::CreateExternalViewEmbedder() {
return shell_test_external_view_embedder_;
}

// |PlatformView|
PointerDataDispatcherMaker ShellTestPlatformViewVulkan::GetDispatcherMaker() {
return [](DefaultPointerDataDispatcher::Delegate& delegate) {
Expand Down
3 changes: 3 additions & 0 deletions shell/common/shell_test_platform_view_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class ShellTestPlatformViewVulkan : public ShellTestPlatformView {
// |PlatformView|
std::unique_ptr<Surface> CreateRenderingSurface() override;

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder() override;

// |PlatformView|
std::unique_ptr<VsyncWaiter> CreateVSyncWaiter() override;

Expand Down
6 changes: 6 additions & 0 deletions shell/platform/android/platform_view_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ std::unique_ptr<Surface> PlatformViewAndroid::CreateRenderingSurface() {
return android_surface_->CreateGPUSurface();
}

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder>
PlatformViewAndroid::CreateExternalViewEmbedder() {
return external_view_embedder_;
}

Comment on lines +310 to +315
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this method is CreateExternalViewEmbedder, but this method is not creating one, it's just returning one that is already created. We should change the name of the method, or change the implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaaclarke I agree with this, please look at #22214 (comment). I will rename this method to GetExternalViewEmbedder once #22272 lands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: I agree with your #22214 (comment). Once we don't have to share the external view embedder with surfaces, I will make this a unique_ptr and make rasterizer the sole owner. CreateExternalViewEmbedder makes sense in that world for sure!

// |PlatformView|
sk_sp<GrDirectContext> PlatformViewAndroid::CreateResourceContext() const {
if (!android_surface_) {
Expand Down
3 changes: 3 additions & 0 deletions shell/platform/android/platform_view_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ class PlatformViewAndroid final : public PlatformView {
// |PlatformView|
std::unique_ptr<Surface> CreateRenderingSurface() override;

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder() override;

// |PlatformView|
sk_sp<GrDirectContext> CreateResourceContext() const override;

Expand Down
3 changes: 3 additions & 0 deletions shell/platform/darwin/ios/platform_view_ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ class PlatformViewIOS final : public PlatformView {
// |PlatformView|
std::unique_ptr<Surface> CreateRenderingSurface() override;

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder() override;

// |PlatformView|
sk_sp<GrDirectContext> CreateResourceContext() const override;

Expand Down
5 changes: 5 additions & 0 deletions shell/platform/darwin/ios/platform_view_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@
return ios_surface_->CreateGPUSurface();
}

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder> PlatformViewIOS::CreateExternalViewEmbedder() {
return ios_surface_factory_->GetExternalViewEmbedder();
}

// |PlatformView|
sk_sp<GrDirectContext> PlatformViewIOS::CreateResourceContext() const {
return ios_context_->CreateResourceContext();
Expand Down
6 changes: 6 additions & 0 deletions shell/platform/embedder/platform_view_embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ std::unique_ptr<Surface> PlatformViewEmbedder::CreateRenderingSurface() {
return embedder_surface_->CreateGPUSurface();
}

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder>
PlatformViewEmbedder::CreateExternalViewEmbedder() {
return external_view_embedder_;
}

// |PlatformView|
sk_sp<GrDirectContext> PlatformViewEmbedder::CreateResourceContext() const {
if (embedder_surface_ == nullptr) {
Expand Down
3 changes: 3 additions & 0 deletions shell/platform/embedder/platform_view_embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class PlatformViewEmbedder final : public PlatformView {
// |PlatformView|
std::unique_ptr<Surface> CreateRenderingSurface() override;

// |PlatformView|
std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder() override;

// |PlatformView|
sk_sp<GrDirectContext> CreateResourceContext() const override;

Expand Down
6 changes: 6 additions & 0 deletions shell/platform/fuchsia/flutter/platform_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,12 @@ std::unique_ptr<flutter::Surface> PlatformView::CreateRenderingSurface() {
return on_create_surface_callback_ ? on_create_surface_callback_() : nullptr;
}

// |flutter::PlatformView|
std::shared_ptr<flutter::ExternalViewEmbedder>
PlatformView::CreateExternalViewEmbedder() {
return external_view_embedder_;
}

// |flutter::PlatformView|
void PlatformView::HandlePlatformMessage(
fml::RefPtr<flutter::PlatformMessage> message) {
Expand Down
4 changes: 4 additions & 0 deletions shell/platform/fuchsia/flutter/platform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ class PlatformView final : public flutter::PlatformView,
// |flutter::PlatformView|
std::unique_ptr<flutter::Surface> CreateRenderingSurface() override;

// |flutter::PlatformView|
std::shared_ptr<flutter::ExternalViewEmbedder> CreateExternalViewEmbedder()
override;

// |flutter::PlatformView|
void HandlePlatformMessage(
fml::RefPtr<flutter::PlatformMessage> message) override;
Expand Down