mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove GetExternalViewEmbedder from surface (flutter/engine#22272)
This decouples surfaces from view embedders.
This commit is contained in:
parent
417c869d6b
commit
9dffddd08d
@ -667,7 +667,6 @@ FILE: ../../../flutter/shell/common/vsync_waiter_fallback.cc
|
||||
FILE: ../../../flutter/shell/common/vsync_waiter_fallback.h
|
||||
FILE: ../../../flutter/shell/common/vsync_waiters_test.cc
|
||||
FILE: ../../../flutter/shell/common/vsync_waiters_test.h
|
||||
FILE: ../../../flutter/shell/gpu/gpu_surface_delegate.h
|
||||
FILE: ../../../flutter/shell/gpu/gpu_surface_gl.cc
|
||||
FILE: ../../../flutter/shell/gpu/gpu_surface_gl.h
|
||||
FILE: ../../../flutter/shell/gpu/gpu_surface_gl_delegate.cc
|
||||
|
||||
@ -10,10 +10,6 @@ Surface::Surface() = default;
|
||||
|
||||
Surface::~Surface() = default;
|
||||
|
||||
flutter::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<GLContextResult> Surface::MakeRenderContextCurrent() {
|
||||
return std::make_unique<GLContextDefaultResult>(true);
|
||||
}
|
||||
|
||||
@ -29,8 +29,6 @@ class Surface {
|
||||
|
||||
virtual GrDirectContext* GetContext() = 0;
|
||||
|
||||
virtual flutter::ExternalViewEmbedder* GetExternalViewEmbedder();
|
||||
|
||||
virtual std::unique_ptr<GLContextResult> MakeRenderContextCurrent();
|
||||
|
||||
virtual bool ClearRenderContext();
|
||||
|
||||
@ -79,10 +79,5 @@ ShellTestPlatformViewGL::GetGLProcResolver() const {
|
||||
};
|
||||
}
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* ShellTestPlatformViewGL::GetExternalViewEmbedder() {
|
||||
return shell_test_external_view_embedder_.get();
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@ -64,9 +64,6 @@ class ShellTestPlatformViewGL : public ShellTestPlatformView,
|
||||
// |GPUSurfaceGLDelegate|
|
||||
GLProcResolver GetGLProcResolver() const override;
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformViewGL);
|
||||
};
|
||||
|
||||
|
||||
@ -198,10 +198,5 @@ SkMatrix ShellTestPlatformViewVulkan::OffScreenSurface::GetRootTransformation()
|
||||
return matrix;
|
||||
}
|
||||
|
||||
flutter::ExternalViewEmbedder*
|
||||
ShellTestPlatformViewVulkan::OffScreenSurface::GetExternalViewEmbedder() {
|
||||
return shell_test_external_view_embedder_.get();
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@ -47,8 +47,6 @@ class ShellTestPlatformViewVulkan : public ShellTestPlatformView {
|
||||
// |Surface|
|
||||
GrDirectContext* GetContext() override;
|
||||
|
||||
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
private:
|
||||
bool valid_;
|
||||
fml::RefPtr<vulkan::VulkanProcTable> vk_;
|
||||
|
||||
@ -16,7 +16,6 @@ gpu_common_deps = [
|
||||
|
||||
source_set("gpu_surface_software") {
|
||||
sources = [
|
||||
"gpu_surface_delegate.h",
|
||||
"gpu_surface_software.cc",
|
||||
"gpu_surface_software.h",
|
||||
"gpu_surface_software_delegate.cc",
|
||||
@ -28,7 +27,6 @@ source_set("gpu_surface_software") {
|
||||
|
||||
source_set("gpu_surface_gl") {
|
||||
sources = [
|
||||
"gpu_surface_delegate.h",
|
||||
"gpu_surface_gl.cc",
|
||||
"gpu_surface_gl.h",
|
||||
"gpu_surface_gl_delegate.cc",
|
||||
@ -40,7 +38,6 @@ source_set("gpu_surface_gl") {
|
||||
|
||||
source_set("gpu_surface_vulkan") {
|
||||
sources = [
|
||||
"gpu_surface_delegate.h",
|
||||
"gpu_surface_vulkan.cc",
|
||||
"gpu_surface_vulkan.h",
|
||||
"gpu_surface_vulkan_delegate.cc",
|
||||
@ -52,7 +49,6 @@ source_set("gpu_surface_vulkan") {
|
||||
|
||||
source_set("gpu_surface_metal") {
|
||||
sources = [
|
||||
"gpu_surface_delegate.h",
|
||||
"gpu_surface_metal.h",
|
||||
"gpu_surface_metal.mm",
|
||||
]
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_DELEGATE_H_
|
||||
#define FLUTTER_SHELL_GPU_GPU_SURFACE_DELEGATE_H_
|
||||
|
||||
#include "flutter/flow/embedded_views.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
class GPUSurfaceDelegate {
|
||||
public:
|
||||
virtual ~GPUSurfaceDelegate() {}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Gets the view embedder that controls how the Flutter layer
|
||||
/// hierarchy split into multiple chunks should be composited back
|
||||
/// on-screen. This field is optional and the Flutter rasterizer
|
||||
/// will render into a single on-screen surface if this call
|
||||
/// returns a null external view embedder. This happens on the GPU
|
||||
/// thread.
|
||||
///
|
||||
/// @return The external view embedder, or, null if Flutter is rendering
|
||||
/// into a single on-screen surface.
|
||||
///
|
||||
virtual ExternalViewEmbedder* GetExternalViewEmbedder() = 0;
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_DELEGATE_H_
|
||||
@ -333,11 +333,6 @@ GrDirectContext* GPUSurfaceGL::GetContext() {
|
||||
return context_.get();
|
||||
}
|
||||
|
||||
// |Surface|
|
||||
flutter::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() {
|
||||
return delegate_->GetExternalViewEmbedder();
|
||||
}
|
||||
|
||||
// |Surface|
|
||||
std::unique_ptr<GLContextResult> GPUSurfaceGL::MakeRenderContextCurrent() {
|
||||
return delegate_->GLContextMakeCurrent();
|
||||
|
||||
@ -42,9 +42,6 @@ class GPUSurfaceGL : public Surface {
|
||||
// |Surface|
|
||||
GrDirectContext* GetContext() override;
|
||||
|
||||
// |Surface|
|
||||
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
// |Surface|
|
||||
std::unique_ptr<GLContextResult> MakeRenderContextCurrent() override;
|
||||
|
||||
|
||||
@ -99,8 +99,4 @@ GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface() {
|
||||
return CreateGLInterface(nullptr);
|
||||
}
|
||||
|
||||
ExternalViewEmbedder* GPUSurfaceGLDelegate::GetExternalViewEmbedder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
#include "flutter/common/graphics/gl_context_switch.h"
|
||||
#include "flutter/flow/embedded_views.h"
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_delegate.h"
|
||||
#include "third_party/skia/include/core/SkMatrix.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
|
||||
|
||||
@ -21,12 +20,9 @@ struct GLFrameInfo {
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
class GPUSurfaceGLDelegate : public GPUSurfaceDelegate {
|
||||
class GPUSurfaceGLDelegate {
|
||||
public:
|
||||
~GPUSurfaceGLDelegate() override;
|
||||
|
||||
// |GPUSurfaceDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
~GPUSurfaceGLDelegate();
|
||||
|
||||
// Called to make the main GL context current on the current thread.
|
||||
virtual std::unique_ptr<GLContextResult> GLContextMakeCurrent() = 0;
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
#include "flutter/flow/surface.h"
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_delegate.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/mtl/GrMtlTypes.h"
|
||||
|
||||
@ -20,16 +19,14 @@ namespace flutter {
|
||||
|
||||
class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetal : public Surface {
|
||||
public:
|
||||
GPUSurfaceMetal(GPUSurfaceDelegate* delegate,
|
||||
fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
GPUSurfaceMetal(fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
sk_sp<GrDirectContext> context,
|
||||
fml::scoped_nsprotocol<id<MTLCommandQueue>> command_queue);
|
||||
|
||||
// |Surface|
|
||||
~GPUSurfaceMetal() override;
|
||||
~GPUSurfaceMetal();
|
||||
|
||||
private:
|
||||
GPUSurfaceDelegate* delegate_;
|
||||
fml::scoped_nsobject<CAMetalLayer> layer_;
|
||||
sk_sp<GrDirectContext> context_;
|
||||
fml::scoped_nsprotocol<id<MTLCommandQueue>> command_queue_;
|
||||
@ -47,9 +44,6 @@ class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetal : public Surface {
|
||||
// |Surface|
|
||||
GrDirectContext* GetContext() override;
|
||||
|
||||
// |Surface|
|
||||
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
// |Surface|
|
||||
std::unique_ptr<GLContextResult> MakeRenderContextCurrent() override;
|
||||
|
||||
|
||||
@ -15,12 +15,10 @@ static_assert(!__has_feature(objc_arc), "ARC must be disabled.");
|
||||
|
||||
namespace flutter {
|
||||
|
||||
GPUSurfaceMetal::GPUSurfaceMetal(GPUSurfaceDelegate* delegate,
|
||||
fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
GPUSurfaceMetal::GPUSurfaceMetal(fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
sk_sp<GrDirectContext> context,
|
||||
fml::scoped_nsprotocol<id<MTLCommandQueue>> command_queue)
|
||||
: delegate_(delegate),
|
||||
layer_(std::move(layer)),
|
||||
: layer_(std::move(layer)),
|
||||
context_(std::move(context)),
|
||||
command_queue_(std::move(command_queue)) {
|
||||
layer_.get().pixelFormat = MTLPixelFormatBGRA8Unorm;
|
||||
@ -121,11 +119,6 @@ GrDirectContext* GPUSurfaceMetal::GetContext() {
|
||||
return context_.get();
|
||||
}
|
||||
|
||||
// |Surface|
|
||||
flutter::ExternalViewEmbedder* GPUSurfaceMetal::GetExternalViewEmbedder() {
|
||||
return delegate_->GetExternalViewEmbedder();
|
||||
}
|
||||
|
||||
// |Surface|
|
||||
std::unique_ptr<GLContextResult> GPUSurfaceMetal::MakeRenderContextCurrent() {
|
||||
// This backend has no such concept.
|
||||
|
||||
@ -87,9 +87,4 @@ GrDirectContext* GPUSurfaceSoftware::GetContext() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// |Surface|
|
||||
flutter::ExternalViewEmbedder* GPUSurfaceSoftware::GetExternalViewEmbedder() {
|
||||
return delegate_->GetExternalViewEmbedder();
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -31,9 +31,6 @@ class GPUSurfaceSoftware : public Surface {
|
||||
// |Surface|
|
||||
GrDirectContext* GetContext() override;
|
||||
|
||||
// |Surface|
|
||||
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
private:
|
||||
GPUSurfaceSoftwareDelegate* delegate_;
|
||||
// TODO(38466): Refactor GPU surface APIs take into account the fact that an
|
||||
|
||||
@ -8,8 +8,4 @@ namespace flutter {
|
||||
|
||||
GPUSurfaceSoftwareDelegate::~GPUSurfaceSoftwareDelegate() = default;
|
||||
|
||||
ExternalViewEmbedder* GPUSurfaceSoftwareDelegate::GetExternalViewEmbedder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
|
||||
#include "flutter/flow/embedded_views.h"
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_delegate.h"
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
|
||||
namespace flutter {
|
||||
@ -25,12 +24,9 @@ namespace flutter {
|
||||
/// @see |IOSurfaceSoftware|, |AndroidSurfaceSoftware|,
|
||||
/// |EmbedderSurfaceSoftware|.
|
||||
///
|
||||
class GPUSurfaceSoftwareDelegate : public GPUSurfaceDelegate {
|
||||
class GPUSurfaceSoftwareDelegate {
|
||||
public:
|
||||
~GPUSurfaceSoftwareDelegate() override;
|
||||
|
||||
// |GPUSurfaceDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
~GPUSurfaceSoftwareDelegate();
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Called when the GPU surface needs a new buffer to render a new
|
||||
|
||||
@ -13,7 +13,6 @@ GPUSurfaceVulkan::GPUSurfaceVulkan(
|
||||
std::unique_ptr<vulkan::VulkanNativeSurface> native_surface,
|
||||
bool render_to_surface)
|
||||
: window_(delegate->vk(), std::move(native_surface), render_to_surface),
|
||||
delegate_(delegate),
|
||||
render_to_surface_(render_to_surface),
|
||||
weak_factory_(this) {}
|
||||
|
||||
@ -67,8 +66,4 @@ GrDirectContext* GPUSurfaceVulkan::GetContext() {
|
||||
return window_.GetSkiaGrContext();
|
||||
}
|
||||
|
||||
flutter::ExternalViewEmbedder* GPUSurfaceVulkan::GetExternalViewEmbedder() {
|
||||
return delegate_->GetExternalViewEmbedder();
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -36,12 +36,8 @@ class GPUSurfaceVulkan : public Surface {
|
||||
// |Surface|
|
||||
GrDirectContext* GetContext() override;
|
||||
|
||||
// |Surface|
|
||||
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
private:
|
||||
vulkan::VulkanWindow window_;
|
||||
GPUSurfaceVulkanDelegate* delegate_;
|
||||
const bool render_to_surface_;
|
||||
|
||||
fml::WeakPtrFactory<GPUSurfaceVulkan> weak_factory_;
|
||||
|
||||
@ -8,8 +8,4 @@ namespace flutter {
|
||||
|
||||
GPUSurfaceVulkanDelegate::~GPUSurfaceVulkanDelegate() = default;
|
||||
|
||||
ExternalViewEmbedder* GPUSurfaceVulkanDelegate::GetExternalViewEmbedder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -6,17 +6,13 @@
|
||||
#define FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_DELEGATE_H_
|
||||
|
||||
#include "flutter/fml/memory/ref_ptr.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_delegate.h"
|
||||
#include "flutter/vulkan/vulkan_proc_table.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
class GPUSurfaceVulkanDelegate : public GPUSurfaceDelegate {
|
||||
class GPUSurfaceVulkanDelegate {
|
||||
public:
|
||||
~GPUSurfaceVulkanDelegate() override;
|
||||
|
||||
// |GPUSurfaceDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
~GPUSurfaceVulkanDelegate();
|
||||
|
||||
// Obtain a reference to the Vulkan implementation's proc table.
|
||||
virtual fml::RefPtr<vulkan::VulkanProcTable> vk() = 0;
|
||||
|
||||
@ -132,11 +132,6 @@ intptr_t AndroidSurfaceGL::GLContextFBO(GLFrameInfo frame_info) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* AndroidSurfaceGL::GetExternalViewEmbedder() {
|
||||
return external_view_embedder_.get();
|
||||
}
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
sk_sp<const GrGLInterface> AndroidSurfaceGL::GetGLInterface() const {
|
||||
// This is a workaround for a bug in the Android emulator EGL/GLES
|
||||
|
||||
@ -63,9 +63,6 @@ class AndroidSurfaceGL final : public GPUSurfaceGLDelegate,
|
||||
// |GPUSurfaceGLDelegate|
|
||||
intptr_t GLContextFBO(GLFrameInfo frame_info) const override;
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
sk_sp<const GrGLInterface> GetGLInterface() const override;
|
||||
|
||||
|
||||
@ -141,11 +141,6 @@ bool AndroidSurfaceSoftware::PresentBackingStore(
|
||||
return true;
|
||||
}
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
ExternalViewEmbedder* AndroidSurfaceSoftware::GetExternalViewEmbedder() {
|
||||
return external_view_embedder_.get();
|
||||
}
|
||||
|
||||
void AndroidSurfaceSoftware::TeardownOnScreenContext() {}
|
||||
|
||||
bool AndroidSurfaceSoftware::OnScreenSurfaceResize(const SkISize& size) {
|
||||
|
||||
@ -53,9 +53,6 @@ class AndroidSurfaceSoftware final : public AndroidSurface,
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<AndroidExternalViewEmbedder> external_view_embedder_;
|
||||
|
||||
|
||||
@ -77,10 +77,6 @@ bool AndroidSurfaceVulkan::SetNativeWindow(
|
||||
return native_window_ && native_window_->IsValid();
|
||||
}
|
||||
|
||||
ExternalViewEmbedder* AndroidSurfaceVulkan::GetExternalViewEmbedder() {
|
||||
return external_view_embedder_.get();
|
||||
}
|
||||
|
||||
fml::RefPtr<vulkan::VulkanProcTable> AndroidSurfaceVulkan::vk() {
|
||||
return proc_table_;
|
||||
}
|
||||
|
||||
@ -50,9 +50,6 @@ class AndroidSurfaceVulkan : public AndroidSurface,
|
||||
// |AndroidSurface|
|
||||
bool SetNativeWindow(fml::RefPtr<AndroidNativeWindow> window) override;
|
||||
|
||||
// |GPUSurfaceVulkanDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
// |GPUSurfaceVulkanDelegate|
|
||||
fml::RefPtr<vulkan::VulkanProcTable> vk() override;
|
||||
|
||||
|
||||
@ -52,11 +52,6 @@ class SurfaceMock : public Surface {
|
||||
|
||||
MOCK_METHOD(GrDirectContext*, GetContext, (), (override));
|
||||
|
||||
MOCK_METHOD(flutter::ExternalViewEmbedder*,
|
||||
GetExternalViewEmbedder,
|
||||
(),
|
||||
(override));
|
||||
|
||||
MOCK_METHOD(std::unique_ptr<GLContextResult>,
|
||||
MakeRenderContextCurrent,
|
||||
(),
|
||||
|
||||
@ -22,8 +22,4 @@ intptr_t AndroidSurfaceMock::GLContextFBO(GLFrameInfo frame_info) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExternalViewEmbedder* AndroidSurfaceMock::GetExternalViewEmbedder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -49,9 +49,6 @@ class AndroidSurfaceMock final : public GPUSurfaceGLDelegate,
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
intptr_t GLContextFBO(GLFrameInfo frame_info) const override;
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -48,9 +48,6 @@ class IOSSurfaceGL final : public IOSSurface, public GPUSurfaceGLDelegate {
|
||||
// |GPUSurfaceGLDelegate|
|
||||
bool SurfaceSupportsReadback() const override;
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<IOSRenderTargetGL> render_target_;
|
||||
|
||||
|
||||
@ -82,9 +82,4 @@ bool IOSSurfaceGL::GLContextPresent(uint32_t fbo_id) {
|
||||
return IsValid() && render_target_->PresentRenderBuffer();
|
||||
}
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* IOSSurfaceGL::GetExternalViewEmbedder() {
|
||||
return GetSurfaceExternalViewEmbedder().get();
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_H_
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_delegate.h"
|
||||
#import "flutter/shell/platform/darwin/ios/ios_surface.h"
|
||||
#include "third_party/skia/include/gpu/mtl/GrMtlTypes.h"
|
||||
|
||||
@ -14,15 +13,14 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetal final : public IOSSurface,
|
||||
public GPUSurfaceDelegate {
|
||||
class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetal final : public IOSSurface {
|
||||
public:
|
||||
IOSSurfaceMetal(fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
std::shared_ptr<IOSContext> context,
|
||||
const std::shared_ptr<IOSExternalViewEmbedder>& external_view_embedder);
|
||||
|
||||
// |IOSSurface|
|
||||
~IOSSurfaceMetal() override;
|
||||
~IOSSurfaceMetal();
|
||||
|
||||
private:
|
||||
fml::scoped_nsobject<CAMetalLayer> layer_;
|
||||
@ -37,9 +35,6 @@ class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetal final : public IOSSurface,
|
||||
// |IOSSurface|
|
||||
std::unique_ptr<Surface> CreateGPUSurface(GrDirectContext* gr_context) override;
|
||||
|
||||
// |GPUSurfaceDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceMetal);
|
||||
};
|
||||
|
||||
|
||||
@ -47,16 +47,10 @@ void IOSSurfaceMetal::UpdateStorageSizeIfNecessary() {
|
||||
std::unique_ptr<Surface> IOSSurfaceMetal::CreateGPUSurface(GrDirectContext* /* unused */) {
|
||||
auto metal_context = CastToMetalContext(GetContext());
|
||||
|
||||
return std::make_unique<GPUSurfaceMetal>(this, // Metal surface delegate
|
||||
layer_, // layer
|
||||
return std::make_unique<GPUSurfaceMetal>(layer_, // layer
|
||||
metal_context->GetMainContext(), // context
|
||||
metal_context->GetMainCommandQueue() // command queue
|
||||
);
|
||||
}
|
||||
|
||||
// |GPUSurfaceDelegate|
|
||||
ExternalViewEmbedder* IOSSurfaceMetal::GetExternalViewEmbedder() {
|
||||
return GetSurfaceExternalViewEmbedder().get();
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -39,9 +39,6 @@ class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDel
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
private:
|
||||
fml::scoped_nsobject<CALayer> layer_;
|
||||
sk_sp<SkSurface> sk_surface_;
|
||||
|
||||
@ -123,9 +123,4 @@ bool IOSSurfaceSoftware::PresentBackingStore(sk_sp<SkSurface> backing_store) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
ExternalViewEmbedder* IOSSurfaceSoftware::GetExternalViewEmbedder() {
|
||||
return GetSurfaceExternalViewEmbedder().get();
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -70,11 +70,6 @@ SkMatrix EmbedderSurfaceGL::GLContextSurfaceTransformation() const {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* EmbedderSurfaceGL::GetExternalViewEmbedder() {
|
||||
return external_view_embedder_.get();
|
||||
}
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
EmbedderSurfaceGL::GLProcResolver EmbedderSurfaceGL::GetGLProcResolver() const {
|
||||
return gl_dispatch_table_.gl_proc_resolver;
|
||||
|
||||
@ -67,9 +67,6 @@ class EmbedderSurfaceGL final : public EmbedderSurface,
|
||||
// |GPUSurfaceGLDelegate|
|
||||
SkMatrix GLContextSurfaceTransformation() const override;
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
// |GPUSurfaceGLDelegate|
|
||||
GLProcResolver GetGLProcResolver() const override;
|
||||
|
||||
|
||||
@ -106,9 +106,4 @@ bool EmbedderSurfaceSoftware::PresentBackingStore(
|
||||
);
|
||||
}
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
ExternalViewEmbedder* EmbedderSurfaceSoftware::GetExternalViewEmbedder() {
|
||||
return external_view_embedder_.get();
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -47,9 +47,6 @@ class EmbedderSurfaceSoftware final : public EmbedderSurface,
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceSoftware);
|
||||
};
|
||||
|
||||
|
||||
@ -80,6 +80,10 @@ class PlatformView final : public flutter::PlatformView,
|
||||
// |PlatformView|
|
||||
flutter::PointerDataDispatcherMaker GetDispatcherMaker() override;
|
||||
|
||||
// |flutter::PlatformView|
|
||||
std::shared_ptr<flutter::ExternalViewEmbedder> CreateExternalViewEmbedder()
|
||||
override;
|
||||
|
||||
private:
|
||||
void RegisterPlatformMessageHandlers();
|
||||
|
||||
@ -121,10 +125,6 @@ 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;
|
||||
|
||||
@ -215,7 +215,8 @@ TEST_F(PlatformViewTests, CreateSurfaceTest) {
|
||||
RunLoopUntilIdle();
|
||||
|
||||
EXPECT_EQ(gr_context.get(), delegate.surface()->GetContext());
|
||||
EXPECT_EQ(view_embedder.get(), delegate.surface()->GetExternalViewEmbedder());
|
||||
EXPECT_EQ(view_embedder.get(),
|
||||
platform_view.CreateExternalViewEmbedder().get());
|
||||
}
|
||||
|
||||
// This test makes sure that the PlatformView correctly registers Scenic
|
||||
|
||||
@ -51,9 +51,4 @@ SkMatrix Surface::GetRootTransformation() const {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
// |flutter::GetViewEmbedder|
|
||||
flutter::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
|
||||
return view_embedder_.get();
|
||||
}
|
||||
|
||||
} // namespace flutter_runner
|
||||
|
||||
@ -39,9 +39,6 @@ class Surface final : public flutter::Surface {
|
||||
// |flutter::Surface|
|
||||
SkMatrix GetRootTransformation() const override;
|
||||
|
||||
// |flutter::Surface|
|
||||
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(Surface);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user