Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8a113d3

Browse files
authored
[embedder] Expose metal surface from test context (#38133)
This is a minor cleanup that exposes the test metal surface to tests via EmbedderTestContextMeta::GetTestMetalSurface for parity with the GetTestMetalContext method which exposes the test metal context. This eliminates the need for the more specific GetTextureInfo method since the texture info is accessible via the test context. This is a test refactoring with no semantic differences to the engine. Issue: flutter/flutter#116381
1 parent 84abf21 commit 8a113d3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

shell/platform/embedder/tests/embedder_test_context_metal.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ TestMetalContext* EmbedderTestContextMetal::GetTestMetalContext() {
4747
return metal_context_.get();
4848
}
4949

50+
TestMetalSurface* EmbedderTestContextMetal::GetTestMetalSurface() {
51+
return metal_surface_.get();
52+
}
53+
5054
void EmbedderTestContextMetal::SetPresentCallback(
5155
PresentCallback present_callback) {
5256
present_callback_ = std::move(present_callback);
@@ -79,10 +83,6 @@ bool EmbedderTestContextMetal::PopulateExternalTexture(
7983
}
8084
}
8185

82-
TestMetalContext::TextureInfo EmbedderTestContextMetal::GetTextureInfo() {
83-
return metal_surface_->GetTextureInfo();
84-
}
85-
8686
void EmbedderTestContextMetal::SetNextDrawableCallback(
8787
NextDrawableCallback next_drawable_callback) {
8888
next_drawable_callback_ = std::move(next_drawable_callback);

shell/platform/embedder/tests/embedder_test_context_metal.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ class EmbedderTestContextMetal : public EmbedderTestContext {
5353

5454
TestMetalContext* GetTestMetalContext();
5555

56-
// Returns the TextureInfo for the test Metal surface.
57-
TestMetalContext::TextureInfo GetTextureInfo();
56+
TestMetalSurface* GetTestMetalSurface();
5857

5958
// Override the default handling for GetNextDrawable.
6059
void SetNextDrawableCallback(NextDrawableCallback next_drawable_callback);

shell/platform/embedder/tests/embedder_unittests_metal.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ GrBackendTexture backend_texture(texture_size.width(), texture_size.height(), Gr
242242

243243
auto collect_context = std::make_unique<CollectContext>();
244244
context.SetNextDrawableCallback([&context, &collect_context](const FlutterFrameInfo* frame_info) {
245-
auto texture_info = context.GetTextureInfo();
245+
auto texture_info = context.GetTestMetalSurface()->GetTextureInfo();
246+
246247
FlutterMetalTexture texture;
247248
texture.struct_size = sizeof(FlutterMetalTexture);
248249
texture.texture_id = texture_info.texture_id;

0 commit comments

Comments
 (0)