diff --git a/engine/src/flutter/shell/platform/android/android_surface_gl.cc b/engine/src/flutter/shell/platform/android/android_surface_gl.cc index 224b2280d2..ca3e24e8cd 100644 --- a/engine/src/flutter/shell/platform/android/android_surface_gl.cc +++ b/engine/src/flutter/shell/platform/android/android_surface_gl.cc @@ -52,13 +52,7 @@ std::unique_ptr AndroidSurfaceGL::CreateGPUSurface( if (gr_context) { return std::make_unique(sk_ref_sp(gr_context), this, true); } else { - sk_sp main_skia_context = - GLContextPtr()->GetMainSkiaContext(); - if (!main_skia_context) { - main_skia_context = GPUSurfaceGL::MakeGLContext(this); - GLContextPtr()->SetMainSkiaContext(main_skia_context); - } - return std::make_unique(main_skia_context, this, true); + return std::make_unique(this, true); } } @@ -177,14 +171,7 @@ AndroidContextGL* AndroidSurfaceGL::GLContextPtr() const { std::unique_ptr AndroidSurfaceGL::CreatePbufferSurface() { onscreen_surface_ = GLContextPtr()->CreatePbufferSurface(); - sk_sp main_skia_context = - GLContextPtr()->GetMainSkiaContext(); - if (!main_skia_context) { - main_skia_context = GPUSurfaceGL::MakeGLContext(this); - GLContextPtr()->SetMainSkiaContext(main_skia_context); - } - - return std::make_unique(main_skia_context, this, true); + return std::make_unique(this, true); } } // namespace flutter diff --git a/engine/src/flutter/shell/platform/android/context/android_context.cc b/engine/src/flutter/shell/platform/android/context/android_context.cc index 1d4badf954..4ff6550c15 100644 --- a/engine/src/flutter/shell/platform/android/context/android_context.cc +++ b/engine/src/flutter/shell/platform/android/context/android_context.cc @@ -9,11 +9,7 @@ namespace flutter { AndroidContext::AndroidContext(AndroidRenderingAPI rendering_api) : rendering_api_(rendering_api) {} -AndroidContext::~AndroidContext() { - if (main_context_) { - main_context_->releaseResourcesAndAbandonContext(); - } -}; +AndroidContext::~AndroidContext() = default; AndroidRenderingAPI AndroidContext::RenderingApi() const { return rendering_api_; @@ -23,13 +19,4 @@ bool AndroidContext::IsValid() const { return true; } -void AndroidContext::SetMainSkiaContext( - const sk_sp& main_context) { - main_context_ = main_context; -} - -sk_sp AndroidContext::GetMainSkiaContext() const { - return main_context_; -} - } // namespace flutter diff --git a/engine/src/flutter/shell/platform/android/context/android_context.h b/engine/src/flutter/shell/platform/android/context/android_context.h index 61662c5c81..103340f7e5 100644 --- a/engine/src/flutter/shell/platform/android/context/android_context.h +++ b/engine/src/flutter/shell/platform/android/context/android_context.h @@ -28,37 +28,9 @@ class AndroidContext { virtual bool IsValid() const; - //---------------------------------------------------------------------------- - /// @brief Setter for the Skia context to be used by subsequent - /// AndroidSurfaces. - /// @details This is useful to reduce memory consumption when creating - /// multiple AndroidSurfaces for the same AndroidContext. - /// - /// The first AndroidSurface should set this for the - /// AndroidContext if the AndroidContext does not yet have a - /// Skia context to share via GetMainSkiaContext. - /// - void SetMainSkiaContext(const sk_sp& main_context); - - //---------------------------------------------------------------------------- - /// @brief Accessor for the Skia context associated with AndroidSurfaces - /// and the raster thread. - /// @details This context is created lazily by the AndroidSurface based - /// on their respective rendering backend and set on this - /// AndroidContext to share via SetMainSkiaContext. - /// @returns `nullptr` when no Skia context has been set yet by its - /// AndroidSurface via SetMainSkiaContext. - /// @attention The software context doesn't have a Skia context, so this - /// value will be nullptr. - /// - sk_sp GetMainSkiaContext() const; - private: const AndroidRenderingAPI rendering_api_; - // This is the Skia context used for on-screen rendering. - sk_sp main_context_; - FML_DISALLOW_COPY_AND_ASSIGN(AndroidContext); }; diff --git a/engine/src/flutter/shell/platform/android/platform_view_android.cc b/engine/src/flutter/shell/platform/android/platform_view_android.cc index 899870961c..5749191e84 100644 --- a/engine/src/flutter/shell/platform/android/platform_view_android.cc +++ b/engine/src/flutter/shell/platform/android/platform_view_android.cc @@ -293,8 +293,7 @@ std::unique_ptr PlatformViewAndroid::CreateRenderingSurface() { if (!android_surface_) { return nullptr; } - return android_surface_->CreateGPUSurface( - android_context_->GetMainSkiaContext().get()); + return android_surface_->CreateGPUSurface(); } // |PlatformView|