Skip to content

Commit 9c92eb3

Browse files
committed
[webview_flutter] Optimize tbm allocation
Signed-off-by: MuHong Byun <[email protected]>
1 parent c5a8930 commit 9c92eb3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/webview_flutter/tizen/src/webview.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,17 +719,20 @@ void WebView::InitWebView() {
719719
0, 0, width_, height_, scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul",
720720
[this]() -> LWE::WebContainer::ExternalImageInfo {
721721
LWE::WebContainer::ExternalImageInfo result;
722-
tbmSurface_ = tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
722+
if (!tbmSurface_) {
723+
tbmSurface_ =
724+
tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
725+
}
723726
result.imageAddress = (void*)tbmSurface_;
724727
return result;
725728
},
726729
[this](LWE::WebContainer* c, bool isRendered) {
727730
if (isRendered) {
728731
FlutterMarkExternalTextureFrameAvailable(textureRegistrar_,
729732
GetTextureId(), tbmSurface_);
733+
tbm_surface_destroy(tbmSurface_);
734+
tbmSurface_ = nullptr;
730735
}
731-
tbm_surface_destroy(tbmSurface_);
732-
tbmSurface_ = nullptr;
733736
});
734737
#ifndef TV_PROFILE
735738
auto settings = webViewInstance_->GetSettings();

0 commit comments

Comments
 (0)