@@ -831,6 +831,53 @@ typedef struct {
831831 };
832832} FlutterRendererConfig ;
833833
834+ typedef struct {
835+ /// The size of this struct.
836+ /// Must be sizeof(FlutterRemoveViewResult).
837+ size_t struct_size ;
838+
839+ /// True if the remove view operation succeeded.
840+ bool removed ;
841+
842+ /// The |FlutterRemoveViewInfo.user_data|.
843+ void * user_data ;
844+ } FlutterRemoveViewResult ;
845+
846+ /// The callback invoked by the engine when the engine has attempted to remove
847+ /// a view.
848+ ///
849+ /// The |FlutterRemoveViewResult| will be deallocated once the callback returns.
850+ typedef void (* FlutterRemoveViewCallback )(
851+ const FlutterRemoveViewResult * /* result */ );
852+
853+ typedef struct {
854+ /// The size of this struct.
855+ /// Must be sizeof(FlutterRemoveViewInfo).
856+ size_t struct_size ;
857+
858+ /// The identifier for the view to remove.
859+ ///
860+ /// The implicit view cannot be removed if it is enabled.
861+ FlutterViewId view_id ;
862+
863+ /// A baton that is not interpreted by the engine in any way.
864+ /// It will be given back to the embedder in |remove_view_callback|.
865+ /// Embedder resources may be associated with this baton.
866+ void * user_data ;
867+
868+ /// Called once the engine has attempted to remove the view.
869+ /// This callback is required.
870+ ///
871+ /// The embedder must not destroy the underlying surface until the callback is
872+ /// invoked with a `removed` value of `true`.
873+ ///
874+ /// This callback is invoked on an internal engine managed thread.
875+ /// Embedders must re-thread if necessary.
876+ ///
877+ /// The |result| argument will be deallocated when the callback returns.
878+ FlutterRemoveViewCallback remove_view_callback ;
879+ } FlutterRemoveViewInfo ;
880+
834881/// Display refers to a graphics hardware system consisting of a framebuffer,
835882/// typically a monitor or a screen. This ID is unique per display and is
836883/// stable until the Flutter application restarts.
@@ -2458,6 +2505,25 @@ FLUTTER_EXPORT
24582505FlutterEngineResult FlutterEngineRunInitialized (
24592506 FLUTTER_API_SYMBOL (FlutterEngine ) engine );
24602507
2508+ //------------------------------------------------------------------------------
2509+ /// @brief Removes a view.
2510+ ///
2511+ /// This is an asynchronous operation. The view's resources must not
2512+ /// be cleaned up until the |remove_view_callback| is invoked with
2513+ /// a |removed| value of `true`.
2514+ ///
2515+ /// @param[in] engine A running engine instance.
2516+ /// @param[in] info The remove view arguments. This can be deallocated
2517+ /// once |FlutterEngineRemoveView| returns, before
2518+ /// |remove_view_callback| is invoked.
2519+ ///
2520+ /// @return The result of *starting* the asynchronous operation. If
2521+ /// `kSuccess`, the |remove_view_callback| will be invoked.
2522+ FLUTTER_EXPORT
2523+ FlutterEngineResult FlutterEngineRemoveView (FLUTTER_API_SYMBOL (FlutterEngine )
2524+ engine ,
2525+ const FlutterRemoveViewInfo * info );
2526+
24612527FLUTTER_EXPORT
24622528FlutterEngineResult FlutterEngineSendWindowMetricsEvent (
24632529 FLUTTER_API_SYMBOL (FlutterEngine ) engine ,
0 commit comments