diff --git a/ui/ozone/platform/starboard/gl_ozone_egl_starboard.cc b/ui/ozone/platform/starboard/gl_ozone_egl_starboard.cc index 783fa653608..66e8b37069e 100644 --- a/ui/ozone/platform/starboard/gl_ozone_egl_starboard.cc +++ b/ui/ozone/platform/starboard/gl_ozone_egl_starboard.cc @@ -32,7 +32,11 @@ namespace ui { GLOzoneEGLStarboard::GLOzoneEGLStarboard() = default; -GLOzoneEGLStarboard::~GLOzoneEGLStarboard() = default; +GLOzoneEGLStarboard::~GLOzoneEGLStarboard() { + if (sb_window_) { + SbWindowDestroy(sb_window_); + } +} scoped_refptr GLOzoneEGLStarboard::CreateViewGLSurface( gl::GLDisplay* display, @@ -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 diff --git a/ui/ozone/platform/starboard/gl_ozone_egl_starboard.h b/ui/ozone/platform/starboard/gl_ozone_egl_starboard.h index 56301082f66..f39126359e6 100644 --- a/ui/ozone/platform/starboard/gl_ozone_egl_starboard.h +++ b/ui/ozone/platform/starboard/gl_ozone_egl_starboard.h @@ -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; }; diff --git a/ui/ozone/platform/starboard/test/surface_factory_starboard_unittest.cc b/ui/ozone/platform/starboard/test/surface_factory_starboard_unittest.cc index 252f376a8f0..575b8ec0c39 100644 --- a/ui/ozone/platform/starboard/test/surface_factory_starboard_unittest.cc +++ b/ui/ozone/platform/starboard/test/surface_factory_starboard_unittest.cc @@ -18,18 +18,6 @@ namespace ui { -namespace { -static const std::map - 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> { @@ -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