Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
18 changes: 3 additions & 15 deletions shell/platform/android/android_surface_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,23 @@

namespace shell {

static fml::RefPtr<AndroidContextGL> GlobalResourceLoadingContext() {
// AndroidSurfaceGL instances are only ever created on the platform thread. So
// there is no need to lock here.

static fml::RefPtr<AndroidContextGL> global_context;

if (global_context) {
return global_context;
}

static fml::RefPtr<AndroidContextGL> CreateResourceLoadingContext() {
auto environment = fml::MakeRefCounted<AndroidEnvironmentGL>();

if (!environment->IsValid()) {
return nullptr;
}

auto context = fml::MakeRefCounted<AndroidContextGL>(environment);

if (!context->IsValid()) {
return nullptr;
}

global_context = context;
return global_context;
return context;
}

AndroidSurfaceGL::AndroidSurfaceGL() {
// Acquire the offscreen context.
offscreen_context_ = GlobalResourceLoadingContext();
offscreen_context_ = CreateResourceLoadingContext();

if (!offscreen_context_ || !offscreen_context_->IsValid()) {
offscreen_context_ = nullptr;
Expand Down