Skip to content

Commit 2331edc

Browse files
committed
[webview_flutter] Optimize tbm allocation (flutter-tizen#42)
Signed-off-by: MuHong Byun <[email protected]>
1 parent 0728da6 commit 2331edc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/webview_flutter/tizen/src/webview.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -739,17 +739,20 @@ void WebView::InitWebView() {
739739
0, 0, width_, height_, scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul",
740740
[this]() -> LWE::WebContainer::ExternalImageInfo {
741741
LWE::WebContainer::ExternalImageInfo result;
742-
tbmSurface_ = tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
742+
if (!tbmSurface_) {
743+
tbmSurface_ =
744+
tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
745+
}
743746
result.imageAddress = (void*)tbmSurface_;
744747
return result;
745748
},
746749
[this](LWE::WebContainer* c, bool isRendered) {
747750
if (isRendered) {
748751
FlutterMarkExternalTextureFrameAvailable(textureRegistrar_,
749752
GetTextureId(), tbmSurface_);
753+
tbm_surface_destroy(tbmSurface_);
754+
tbmSurface_ = nullptr;
750755
}
751-
tbm_surface_destroy(tbmSurface_);
752-
tbmSurface_ = nullptr;
753756
});
754757
#ifndef TV_PROFILE
755758
auto settings = webViewInstance_->GetSettings();

0 commit comments

Comments
 (0)