5#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_
8#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h"
10#include <Metal/Metal.h>
12#include "flutter/flow/surface.h"
13#include "flutter/fml/memory/weak_ptr.h"
14#include "flutter/fml/platform/darwin/scoped_nsobject.h"
15#include "flutter/fml/trace_event.h"
16#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
17#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h"
18#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewResponder.h"
19#import "flutter/shell/platform/darwin/ios/ios_context.h"
33- (instancetype)
initWithFrame:(CGRect)frame screenScale:(CGFloat)screenScale;
66- (instancetype)initWithCapacity:(NSInteger)capacity;
84@property(nonatomic, readonly) CGRect
frame;
113 blurRadius:(CGFloat)blurRadius
114 visualEffectView:(UIVisualEffectView*)visualEffectView NS_DESIGNATED_INITIALIZER;
147 std::unique_ptr<IOSSurface> ios_surface,
148 std::unique_ptr<Surface>
surface);
175 std::shared_ptr<FlutterPlatformViewLayer> GetLayer(
GrDirectContext* gr_context,
176 const std::shared_ptr<IOSContext>& ios_context,
177 MTLPixelFormat pixel_format);
181 std::vector<std::shared_ptr<FlutterPlatformViewLayer>> GetUnusedLayers();
184 void RecycleLayers();
199 size_t available_layer_index_ = 0;
200 std::vector<std::shared_ptr<FlutterPlatformViewLayer>> layers_;
213 void SetFlutterView(UIView* flutter_view)
__attribute__((cf_audited_transfer));
215 void SetFlutterViewController(UIViewController<FlutterViewResponder>* flutter_view_controller)
218 UIViewController<FlutterViewResponder>* getFlutterViewController()
221 void RegisterViewFactory(
228 void BeginFrame(
SkISize frame_size);
234 void PrerollCompositeEmbeddedView(int64_t view_id,
237 size_t EmbeddedViewCount();
244 UIView* GetPlatformViewByID(int64_t view_id);
254 const
fml::RefPtr<
fml::RasterThreadMerger>& raster_thread_merger);
256 void EndFrame(
bool should_resubmit_frame,
257 const
fml::RefPtr<
fml::RasterThreadMerger>& raster_thread_merger);
259 DlCanvas* CompositeEmbeddedView(int64_t view_id);
263 SkRect GetPlatformViewRect(int64_t view_id);
277 long FindFirstResponderPlatformViewId();
280 void PushFilterToVisitedPlatformViews(const
std::shared_ptr<const
DlImageFilter>& filter,
281 const
SkRect& filter_rect);
284 void PushVisitedPlatformView(int64_t view_id) { visited_platform_views_.push_back(view_id); }
287 static const size_t kMaxLayerAllocations = 2;
289 using LayersMap = std::map<int64_t, std::vector<std::shared_ptr<FlutterPlatformViewLayer>>>;
306 bool HasPlatformViewThisOrNextFrame();
311 void ClipViewSetMaskView(UIView* clipView)
__attribute__((cf_audited_transfer));
323 UIView* embedded_view,
330 std::shared_ptr<FlutterPlatformViewLayer> GetLayer(
GrDirectContext* gr_context,
331 const std::shared_ptr<IOSContext>& ios_context,
336 MTLPixelFormat pixel_format);
339 void RemoveUnusedLayers();
342 void BringLayersIntoView(LayersMap layer_map);
346 void BeginCATransaction();
349 void CommitCATransactionIfNeeded();
352 void ResetFrameState();
355 std::unique_ptr<FlutterPlatformViewLayerPool> layer_pool_;
361 std::map<int64_t, std::unique_ptr<EmbedderViewSlice>> slices_;
367 std::map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>> factories_;
368 std::map<int64_t, fml::scoped_nsobject<NSObject<FlutterPlatformView>>> views_;
369 std::map<int64_t, fml::scoped_nsobject<FlutterTouchInterceptingView>> touch_interceptors_;
375 std::map<int64_t, fml::scoped_nsobject<UIView>> root_views_;
377 std::map<int64_t, EmbeddedViewParams> current_composition_params_;
380 std::map<int64_t, int64_t> clip_count_;
388 static const int kDefaultMergedLeaseDuration = 10;
392 std::unordered_set<int64_t> views_to_dispose_;
396 std::vector<int64_t> composition_order_;
399 std::vector<int64_t> visited_platform_views_;
402 std::vector<int64_t> active_composition_order_;
405 std::unordered_set<int64_t> views_to_recomposite_;
408 std::map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
409 gesture_recognizers_blocking_policies_;
411 bool catransaction_added_ =
false;
414 std::unique_ptr<fml::WeakPtrFactory<FlutterPlatformViewsController>> weak_factory_;
416#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
420 std::unordered_set<int64_t> non_zero_origin_views_;
434- (instancetype)initWithEmbeddedView:(UIView*)embeddedView
435 platformViewsController:
437 gestureRecognizersBlockingPolicy:
455@property(nonatomic, readonly)
BOOL flt_hasFirstResponderInViewHierarchySubtree;
void(^ FlutterResult)(id _Nullable result)
FlutterPlatformViewGestureRecognizersBlockingPolicy
id flutterAccessibilityContainer
Developer-facing API for rendering anything within the engine.
Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts ar...
const EmbeddedViewParams * params
HWND(* FlutterPlatformViewFactory)(const FlutterPlatformViewCreationParameters *)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
NSMutableArray * backdropFilterSubviews()
instancetype initWithFrame
__attribute__((visibility("default"))) int RunBenchmarks(int argc
clipRRect(r.rrect, r.opAA.op(), r.opAA.aa())) DRAW(ClipRect
unsigned useCenter Optional< SkMatrix > matrix
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
clipPath(r.path, r.opAA.op(), r.opAA.aa())) DRAW(ClipRRect
sk_sp< SkBlender > blender SkRect rect
auto WeakPtr(std::shared_ptr< T > pointer)
BOOL BlurRadiusEqualToBlurRadius(CGFloat radius1, CGFloat radius2)
void ResetAnchor(CALayer *layer)
CATransform3D GetCATransform3DFromSkMatrix(const SkMatrix &matrix)
CGRect GetCGRectFromSkRect(const SkRect &clipSkRect)