Skip to content

Commit

Permalink
Platform views have CreateExternalViewEmbedder (flutter#22214)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Nov 6, 2020
1 parent d5b4f64 commit 6e95e00
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 0 deletions.
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_;
}

// |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

0 comments on commit 6e95e00

Please sign in to comment.