Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "ui/ozone/starboard: introduce ScopedSbWindow (#4590)" #4654

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
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
19 changes: 7 additions & 12 deletions ui/ozone/platform/starboard/gl_ozone_egl_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ namespace ui {

GLOzoneEGLStarboard::GLOzoneEGLStarboard() = default;

GLOzoneEGLStarboard::~GLOzoneEGLStarboard() = default;
GLOzoneEGLStarboard::~GLOzoneEGLStarboard() {
if (sb_window_) {
SbWindowDestroy(sb_window_);
}
}

scoped_refptr<gl::GLSurface> GLOzoneEGLStarboard::CreateViewGLSurface(
gl::GLDisplay* display,
Expand Down Expand Up @@ -89,20 +93,11 @@ void GLOzoneEGLStarboard::CreateDisplayTypeAndWindowIfNeeded() {
SbWindowOptions options{};
SbWindowSetDefaultOptions(&options);

sb_window_ = ScopedSbWindow(SbWindowCreate(&options));
window_ = SbWindowGetPlatformHandle(sb_window_.get());
sb_window_ = SbWindowCreate(&options);
window_ = SbWindowGetPlatformHandle(sb_window_);
}

CHECK(window_);
}

GLOzoneEGLStarboard::ScopedSbWindow::ScopedSbWindow(SbWindow&& window)
: sb_window_(std::move(window)) {}

GLOzoneEGLStarboard::ScopedSbWindow::~ScopedSbWindow() {
if (sb_window_ != kSbWindowInvalid) {
SbWindowDestroy(sb_window_);
}
}

} // namespace ui
15 changes: 1 addition & 14 deletions ui/ozone/platform/starboard/gl_ozone_egl_starboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,11 @@ class GLOzoneEGLStarboard : public GLOzoneEGL {
const gl::GLImplementationParts& implementation) override;

private:
// Straightforward lifetime tracker of an SbWindow
class ScopedSbWindow {
public:
// Need default ctor for GLOzoneEGLStarboard to have a default ctor.
ScopedSbWindow() : sb_window_(kSbWindowInvalid) {}
explicit ScopedSbWindow(SbWindow&& window);
~ScopedSbWindow();

SbWindow get() { return sb_window_; }

private:
SbWindow sb_window_;
};
void CreateDisplayTypeAndWindowIfNeeded();

void* display_type_ = nullptr;
bool have_display_type_ = false;
ScopedSbWindow sb_window_;
SbWindow sb_window_;
void* window_ = nullptr;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@

namespace ui {

namespace {
static const std::map<gl::GLImplementation, std::string>
kGLImplementationToString = {
{gl::kGLImplementationNone, "none"},
{gl::kGLImplementationEGLGLES2, "eglgles2"},
{gl::kGLImplementationMockGL, "mockgl"},
{gl::kGLImplementationStubGL, "stubgl"},
{gl::kGLImplementationDisabled, "disabled"},
{gl::kGLImplementationEGLANGLE, "eglangle"},
};
}

class SurfaceFactoryStarboardSupportTest
: public testing::TestWithParam<
testing::tuple<gl::GLImplementation, bool>> {
Expand Down Expand Up @@ -61,9 +49,5 @@ INSTANTIATE_TEST_SUITE_P(
std::make_tuple(gl::kGLImplementationMockGL, false),
std::make_tuple(gl::kGLImplementationStubGL, false),
std::make_tuple(gl::kGLImplementationDisabled, false),
std::make_tuple(gl::kGLImplementationEGLANGLE, false)),
[](const testing::TestParamInfo<
SurfaceFactoryStarboardSupportTest::ParamType>& info) {
return kGLImplementationToString.at(testing::get<0>(info.param));
});
std::make_tuple(gl::kGLImplementationEGLANGLE, false)));
} // namespace ui
Loading