Flutter iOS Embedder
FlutterPlatformViews_Internal.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_
7 
8 #include <Metal/Metal.h>
9 #include "flutter/flow/embedded_views.h"
10 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
11 #include "flutter/shell/common/shell.h"
18 
20 
21 // A UIView that acts as a clipping mask for the |ChildClippingView|.
22 //
23 // On the [UIView drawRect:] method, this view performs a series of clipping operations and sets the
24 // alpha channel to the final resulting area to be 1; it also sets the "clipped out" area's alpha
25 // channel to be 0.
26 //
27 // When a UIView sets a |FlutterClippingMaskView| as its `maskView`, the alpha channel of the UIView
28 // is replaced with the alpha channel of the |FlutterClippingMaskView|.
29 @interface FlutterClippingMaskView : UIView
30 
31 - (instancetype)initWithFrame:(CGRect)frame screenScale:(CGFloat)screenScale;
32 
33 - (void)reset;
34 
35 // Adds a clip rect operation to the queue.
36 //
37 // The `clipSkRect` is transformed with the `matrix` before adding to the queue.
38 - (void)clipRect:(const SkRect&)clipSkRect matrix:(const SkMatrix&)matrix;
39 
40 // Adds a clip rrect operation to the queue.
41 //
42 // The `clipSkRRect` is transformed with the `matrix` before adding to the queue.
43 - (void)clipRRect:(const SkRRect&)clipSkRRect matrix:(const SkMatrix&)matrix;
44 
45 // Adds a clip path operation to the queue.
46 //
47 // The `path` is transformed with the `matrix` before adding to the queue.
48 - (void)clipPath:(const SkPath&)path matrix:(const SkMatrix&)matrix;
49 
50 @end
51 
52 // A pool that provides |FlutterClippingMaskView|s.
53 //
54 // The pool has a capacity that can be set in the initializer.
55 // When requesting a FlutterClippingMaskView, the pool will first try to reuse an available maskView
56 // in the pool. If there are none available, a new FlutterClippingMaskView is constructed. If the
57 // capacity is reached, the newly constructed FlutterClippingMaskView is not added to the pool.
58 //
59 // Call |insertViewToPoolIfNeeded:| to return a maskView to the pool.
60 @interface FlutterClippingMaskViewPool : NSObject
61 
62 // Initialize the pool with `capacity`. When the `capacity` is reached, a FlutterClippingMaskView is
63 // constructed when requested, and it is not added to the pool.
64 - (instancetype)initWithCapacity:(NSInteger)capacity;
65 
66 // Reuse a maskView from the pool, or allocate a new one.
67 - (FlutterClippingMaskView*)getMaskViewWithFrame:(CGRect)frame;
68 
69 // Insert the `maskView` into the pool.
70 - (void)insertViewToPoolIfNeeded:(FlutterClippingMaskView*)maskView;
71 
72 @end
73 
74 // An object represents a blur filter.
75 //
76 // This object produces a `backdropFilterView`.
77 // To blur a View, add `backdropFilterView` as a subView of the View.
78 @interface PlatformViewFilter : NSObject
79 
80 // Determines the rect of the blur effect in the coordinate system of `backdropFilterView`'s
81 // parentView.
82 @property(assign, nonatomic, readonly) CGRect frame;
83 
84 // Determines the blur intensity.
85 //
86 // It is set as the value of `inputRadius` of the `gaussianFilter` that is internally used.
87 @property(assign, nonatomic, readonly) CGFloat blurRadius;
88 
89 // This is the view to use to blur the PlatformView.
90 //
91 // It is a modified version of UIKit's `UIVisualEffectView`.
92 // The inputRadius can be customized and it doesn't add any color saturation to the blurred view.
93 @property(nonatomic, retain, readonly) UIVisualEffectView* backdropFilterView;
94 
95 // For testing only.
96 + (void)resetPreparation;
97 
98 - (instancetype)init NS_UNAVAILABLE;
99 
100 // Initialize the filter object.
101 //
102 // The `frame` determines the rect of the blur effect in the coordinate system of
103 // `backdropFilterView`'s parentView. The `blurRadius` determines the blur intensity. It is set as
104 // the value of `inputRadius` of the `gaussianFilter` that is internally used. The
105 // `UIVisualEffectView` is the view that is used to add the blur effects. It is modified to become
106 // `backdropFilterView`, which better supports the need of Flutter.
107 //
108 // Note: if the implementation of UIVisualEffectView changes in a way that affects the
109 // implementation in `PlatformViewFilter`, this method will return nil.
110 - (instancetype)initWithFrame:(CGRect)frame
111  blurRadius:(CGFloat)blurRadius
112  visualEffectView:(UIVisualEffectView*)visualEffectView NS_DESIGNATED_INITIALIZER;
113 
114 @end
115 
116 // The parent view handles clipping to its subViews.
117 @interface ChildClippingView : UIView
118 
119 // Applies blur backdrop filters to the ChildClippingView with blur values from
120 // filters.
121 - (void)applyBlurBackdropFilters:(NSArray<PlatformViewFilter*>*)filters;
122 
123 @end
124 
125 namespace flutter {
126 // Converts a SkMatrix to CATransform3D.
127 // Certain fields are ignored in CATransform3D since SkMatrix is 3x3 and CATransform3D is 4x4.
128 CATransform3D GetCATransform3DFromSkMatrix(const SkMatrix& matrix);
129 
130 // Reset the anchor of `layer` to match the transform operation from flow.
131 // The position of the `layer` should be unchanged after resetting the anchor.
132 void ResetAnchor(CALayer* layer);
133 
134 CGRect GetCGRectFromSkRect(const SkRect& clipSkRect);
135 BOOL BlurRadiusEqualToBlurRadius(CGFloat radius1, CGFloat radius2);
136 
137 class IOSContextGL;
138 class IOSSurface;
139 
141  FlutterPlatformViewLayer(const fml::scoped_nsobject<UIView>& overlay_view,
142  const fml::scoped_nsobject<UIView>& overlay_view_wrapper,
143  std::unique_ptr<IOSSurface> ios_surface,
144  std::unique_ptr<Surface> surface);
145 
147 
148  fml::scoped_nsobject<UIView> overlay_view;
149  fml::scoped_nsobject<UIView> overlay_view_wrapper;
150  std::unique_ptr<IOSSurface> ios_surface;
151  std::unique_ptr<Surface> surface;
152 
153  // Whether a frame for this layer was submitted.
155 
156  // The GrContext that is currently used by the overlay surfaces.
157  // We track this to know when the GrContext for the Flutter app has changed
158  // so we can update the overlay with the new context.
159  GrDirectContext* gr_context;
160 };
161 
162 // This class isn't thread safe.
164  public:
165  FlutterPlatformViewLayerPool() = default;
166 
167  ~FlutterPlatformViewLayerPool() = default;
168 
169  // Gets a layer from the pool if available, or allocates a new one.
170  // Finally, it marks the layer as used. That is, it increments `available_layer_index_`.
171  std::shared_ptr<FlutterPlatformViewLayer> GetLayer(GrDirectContext* gr_context,
172  const std::shared_ptr<IOSContext>& ios_context,
173  MTLPixelFormat pixel_format);
174 
175  // Gets the layers in the pool that aren't currently used.
176  // This method doesn't mark the layers as unused.
177  std::vector<std::shared_ptr<FlutterPlatformViewLayer>> GetUnusedLayers();
178 
179  // Marks the layers in the pool as available for reuse.
180  void RecycleLayers();
181 
182  private:
183  // The index of the entry in the layers_ vector that determines the beginning of the unused
184  // layers. For example, consider the following vector:
185  // _____
186  // | 0 |
187  /// |---|
188  /// | 1 | <-- available_layer_index_
189  /// |---|
190  /// | 2 |
191  /// |---|
192  ///
193  /// This indicates that entries starting from 1 can be reused meanwhile the entry at position 0
194  /// cannot be reused.
195  size_t available_layer_index_ = 0;
196  std::vector<std::shared_ptr<FlutterPlatformViewLayer>> layers_;
197 
198  FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformViewLayerPool);
199 };
200 
202  public:
204 
206 
207  fml::WeakPtr<flutter::FlutterPlatformViewsController> GetWeakPtr();
208 
209  void SetFlutterView(UIView* flutter_view);
210 
211  void SetFlutterViewController(UIViewController* flutter_view_controller);
212 
213  UIViewController* getFlutterViewController();
214 
215  void RegisterViewFactory(
216  NSObject<FlutterPlatformViewFactory>* factory,
217  NSString* factoryId,
218  FlutterPlatformViewGestureRecognizersBlockingPolicy gestureRecognizerBlockingPolicy);
219 
220  // Called at the beginning of each frame.
221  void BeginFrame(SkISize frame_size);
222 
223  // Indicates that we don't compisite any platform views or overlays during this frame.
224  // Also reverts the composition_order_ to its original state at the beginning of the frame.
225  void CancelFrame();
226 
227  void PrerollCompositeEmbeddedView(int64_t view_id,
228  std::unique_ptr<flutter::EmbeddedViewParams> params);
229 
230  size_t EmbeddedViewCount();
231 
232  // Returns the `FlutterPlatformView`'s `view` object associated with the view_id.
233  //
234  // If the `FlutterPlatformViewsController` does not contain any `FlutterPlatformView` object or
235  // a `FlutterPlatformView` object associated with the view_id cannot be found, the method
236  // returns nil.
237  UIView* GetPlatformViewByID(int64_t view_id);
238 
239  // Returns the `FlutterTouchInterceptingView` with the view_id.
240  //
241  // If the `FlutterPlatformViewsController` does not contain any `FlutterPlatformView` object or
242  // a `FlutterPlatformView` object associated with the view_id cannot be found, the method
243  // returns nil.
244  FlutterTouchInterceptingView* GetFlutterTouchInterceptingViewByID(int64_t view_id);
245 
246  PostPrerollResult PostPrerollAction(
247  const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger);
248 
249  void EndFrame(bool should_resubmit_frame,
250  const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger);
251 
252  DlCanvas* CompositeEmbeddedView(int64_t view_id);
253 
254  // The rect of the platform view at index view_id. This rect has been translated into the
255  // host view coordinate system. Units are device screen pixels.
256  SkRect GetPlatformViewRect(int64_t view_id);
257 
258  // Discards all platform views instances and auxiliary resources.
259  void Reset();
260 
261  bool SubmitFrame(GrDirectContext* gr_context,
262  const std::shared_ptr<IOSContext>& ios_context,
263  std::unique_ptr<SurfaceFrame> frame);
264 
265  void OnMethodCall(FlutterMethodCall* call, FlutterResult result);
266 
267  // Returns the platform view id if the platform view (or any of its descendant view) is the first
268  // responder. Returns -1 if no such platform view is found.
269  long FindFirstResponderPlatformViewId();
270 
271  // Pushes backdrop filter mutation to the mutator stack of each visited platform view.
272  void PushFilterToVisitedPlatformViews(const std::shared_ptr<const DlImageFilter>& filter,
273  const SkRect& filter_rect);
274 
275  // Pushes the view id of a visted platform view to the list of visied platform views.
276  void PushVisitedPlatformView(int64_t view_id) { visited_platform_views_.push_back(view_id); }
277 
278  private:
279  static const size_t kMaxLayerAllocations = 2;
280 
281  using LayersMap = std::map<int64_t, std::vector<std::shared_ptr<FlutterPlatformViewLayer>>>;
282 
283  void OnCreate(FlutterMethodCall* call, FlutterResult result);
284  void OnDispose(FlutterMethodCall* call, FlutterResult result);
285  void OnAcceptGesture(FlutterMethodCall* call, FlutterResult result);
286  void OnRejectGesture(FlutterMethodCall* call, FlutterResult result);
287  // Dispose the views in `views_to_dispose_`.
288  void DisposeViews();
289 
290  // Returns true if there are embedded views in the scene at current frame
291  // Or there will be embedded views in the next frame.
292  // TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474
293  // Make this method check if there are pending view operations instead.
294  // Also rename it to `HasPendingViewOperations`.
295  bool HasPlatformViewThisOrNextFrame();
296 
297  // Traverse the `mutators_stack` and return the number of clip operations.
298  int CountClips(const MutatorsStack& mutators_stack);
299 
300  void ClipViewSetMaskView(UIView* clipView);
301 
302  // Applies the mutators in the mutators_stack to the UIView chain that was constructed by
303  // `ReconstructClipViewsChain`
304  //
305  // Clips are applied to the `embedded_view`'s super view(|ChildClippingView|) using a
306  // |FlutterClippingMaskView|. Transforms are applied to `embedded_view`
307  //
308  // The `bounding_rect` is the final bounding rect of the PlatformView
309  // (EmbeddedViewParams::finalBoundingRect). If a clip mutator's rect contains the final bounding
310  // rect of the PlatformView, the clip mutator is not applied for performance optimization.
311  void ApplyMutators(const MutatorsStack& mutators_stack,
312  UIView* embedded_view,
313  const SkRect& bounding_rect);
314 
315  void CompositeWithParams(int64_t view_id, const EmbeddedViewParams& params);
316 
317  // Allocates a new FlutterPlatformViewLayer if needed, draws the pixels within the rect from
318  // the picture on the layer's canvas.
319  std::shared_ptr<FlutterPlatformViewLayer> GetLayer(GrDirectContext* gr_context,
320  const std::shared_ptr<IOSContext>& ios_context,
321  EmbedderViewSlice* slice,
322  SkIRect rect,
323  int64_t view_id,
324  int64_t overlay_id,
325  MTLPixelFormat pixel_format);
326  // Removes overlay views and platform views that aren't needed in the current frame.
327  // Must run on the platform thread.
328  void RemoveUnusedLayers();
329  // Appends the overlay views and platform view and sets their z index based on the composition
330  // order.
331  void BringLayersIntoView(LayersMap layer_map);
332 
333  // Begin a CATransaction.
334  // This transaction needs to be balanced with |CommitCATransactionIfNeeded|.
335  void BeginCATransaction();
336 
337  // Commit a CATransaction if |BeginCATransaction| has been called during the frame.
338  void CommitCATransactionIfNeeded();
339 
340  // Resets the state of the frame.
341  void ResetFrameState();
342 
343  // The pool of reusable view layers. The pool allows to recycle layer in each frame.
344  std::unique_ptr<FlutterPlatformViewLayerPool> layer_pool_;
345 
346  // The platform view's |EmbedderViewSlice| keyed off the view id, which contains any subsequent
347  // operation until the next platform view or the end of the last leaf node in the layer tree.
348  //
349  // The Slices are deleted by the FlutterPlatformViewsController.reset().
350  std::map<int64_t, std::unique_ptr<EmbedderViewSlice>> slices_;
351 
352  fml::scoped_nsobject<FlutterMethodChannel> channel_;
353  fml::scoped_nsobject<UIView> flutter_view_;
354  fml::scoped_nsobject<UIViewController> flutter_view_controller_;
355  fml::scoped_nsobject<FlutterClippingMaskViewPool> mask_view_pool_;
356  std::map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>> factories_;
357  std::map<int64_t, fml::scoped_nsobject<NSObject<FlutterPlatformView>>> views_;
358  std::map<int64_t, fml::scoped_nsobject<FlutterTouchInterceptingView>> touch_interceptors_;
359  // Mapping a platform view ID to the top most parent view (root_view) of a platform view. In
360  // |SubmitFrame|, root_views_ are added to flutter_view_ as child views.
361  //
362  // The platform view with the view ID is a child of the root view; If the platform view is not
363  // clipped, and no clipping view is added, the root view will be the intercepting view.
364  std::map<int64_t, fml::scoped_nsobject<UIView>> root_views_;
365  // Mapping a platform view ID to its latest composition params.
366  std::map<int64_t, EmbeddedViewParams> current_composition_params_;
367  // Mapping a platform view ID to the count of the clipping operations that were applied to the
368  // platform view last time it was composited.
369  std::map<int64_t, int64_t> clip_count_;
370  SkISize frame_size_;
371 
372  // The number of frames the rasterizer task runner will continue
373  // to run on the platform thread after no platform view is rendered.
374  //
375  // Note: this is an arbitrary number that attempts to account for cases
376  // where the platform view might be momentarily off the screen.
377  static const int kDefaultMergedLeaseDuration = 10;
378 
379  // Method channel `OnDispose` calls adds the views to be disposed to this set to be disposed on
380  // the next frame.
381  std::unordered_set<int64_t> views_to_dispose_;
382 
383  // A vector of embedded view IDs according to their composition order.
384  // The last ID in this vector belond to the that is composited on top of all others.
385  std::vector<int64_t> composition_order_;
386 
387  // A vector of visited platform view IDs.
388  std::vector<int64_t> visited_platform_views_;
389 
390  // The latest composition order that was presented in Present().
391  std::vector<int64_t> active_composition_order_;
392 
393  // Only compoiste platform views in this set.
394  std::unordered_set<int64_t> views_to_recomposite_;
395 
396  // The FlutterPlatformViewGestureRecognizersBlockingPolicy for each type of platform view.
397  std::map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
398  gesture_recognizers_blocking_policies_;
399 
400  bool catransaction_added_ = false;
401 
402  // WeakPtrFactory must be the last member.
403  std::unique_ptr<fml::WeakPtrFactory<FlutterPlatformViewsController>> weak_factory_;
404 
405 #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
406  // A set to keep track of embedded views that does not have (0, 0) origin.
407  // An insertion triggers a warning message about non-zero origin logged on the debug console.
408  // See https://github.com/flutter/flutter/issues/109700 for details.
409  std::unordered_set<int64_t> non_zero_origin_views_;
410 #endif
411 
412  FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformViewsController);
413 };
414 
415 } // namespace flutter
416 
417 // A UIView that is used as the parent for embedded UIViews.
418 //
419 // This view has 2 roles:
420 // 1. Delay or prevent touch events from arriving the embedded view.
421 // 2. Dispatching all events that are hittested to the embedded view to the FlutterView.
422 @interface FlutterTouchInterceptingView : UIView
423 - (instancetype)initWithEmbeddedView:(UIView*)embeddedView
424  platformViewsController:
425  (fml::WeakPtr<flutter::FlutterPlatformViewsController>)platformViewsController
426  gestureRecognizersBlockingPolicy:
428 
429 // Stop delaying any active touch sequence (and let it arrive the embedded view).
430 - (void)releaseGesture;
431 
432 // Prevent the touch sequence from ever arriving to the embedded view.
433 - (void)blockGesture;
434 
435 // Get embedded view
436 - (UIView*)embeddedView;
437 
438 // Sets flutterAccessibilityContainer as this view's accessibilityContainer.
439 - (void)setFlutterAccessibilityContainer:(NSObject*)flutterAccessibilityContainer;
440 @end
441 
442 @interface UIView (FirstResponder)
443 // Returns YES if a view or any of its descendant view is the first responder. Returns NO otherwise.
444 @property(nonatomic, readonly) BOOL flt_hasFirstResponderInViewHierarchySubtree;
445 @end
446 
447 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_
UIView(FirstResponder)::flt_hasFirstResponderInViewHierarchySubtree
BOOL flt_hasFirstResponderInViewHierarchySubtree
Definition: FlutterPlatformViews_Internal.h:444
FlutterPlatformViews.h
flutter::FlutterPlatformViewLayer::ios_surface
std::unique_ptr< IOSSurface > ios_surface
Definition: FlutterPlatformViews_Internal.h:150
-[FlutterTouchInterceptingView blockGesture]
void blockGesture()
Definition: FlutterPlatformViews.mm:1012
-[FlutterTouchInterceptingView releaseGesture]
void releaseGesture()
Definition: FlutterPlatformViews.mm:1008
PlatformViewFilter::frame
CGRect frame
Definition: FlutterPlatformViews_Internal.h:82
flutter::FlutterPlatformViewLayer::did_submit_last_frame
bool did_submit_last_frame
Definition: FlutterPlatformViews_Internal.h:154
flutter::BlurRadiusEqualToBlurRadius
BOOL BlurRadiusEqualToBlurRadius(CGFloat radius1, CGFloat radius2)
Definition: FlutterPlatformViews_Internal.mm:67
FlutterChannels.h
-[FlutterTouchInterceptingView embeddedView]
UIView * embeddedView()
Definition: FlutterPlatformViews.mm:1004
flutter::FlutterPlatformViewLayer::overlay_view_wrapper
fml::scoped_nsobject< UIView > overlay_view_wrapper
Definition: FlutterPlatformViews_Internal.h:149
initWithFrame
instancetype initWithFrame
Definition: FlutterTextInputPlugin.h:167
flutter::FlutterPlatformViewLayer::gr_context
GrDirectContext * gr_context
Definition: FlutterPlatformViews_Internal.h:159
flutter::ResetAnchor
void ResetAnchor(CALayer *layer)
Definition: FlutterPlatformViews_Internal.mm:56
FlutterPlugin.h
PlatformViewFilter::blurRadius
CGFloat blurRadius
Definition: FlutterPlatformViews_Internal.h:87
flutter::FlutterPlatformViewLayerPool
Definition: FlutterPlatformViews_Internal.h:163
flutter::FlutterPlatformViewLayer::overlay_view
fml::scoped_nsobject< UIView > overlay_view
Definition: FlutterPlatformViews_Internal.h:148
-[PlatformViewFilter NS_UNAVAILABLE]
instancetype NS_UNAVAILABLE()
FlutterMethodCall
Definition: FlutterCodecs.h:220
-[FlutterClippingMaskView reset]
void reset()
Definition: FlutterPlatformViews_Internal.mm:278
PlatformViewFilter::backdropFilterView
UIVisualEffectView * backdropFilterView
Definition: FlutterPlatformViews_Internal.h:93
flutter
Definition: accessibility_bridge.h:28
FlutterBinaryMessenger.h
flutter::FlutterPlatformViewLayer
Definition: FlutterPlatformViews_Internal.h:140
FlutterResult
void(^ FlutterResult)(id _Nullable result)
Definition: FlutterChannels.h:194
flutter::FlutterPlatformViewLayer::surface
std::unique_ptr< Surface > surface
Definition: FlutterPlatformViews_Internal.h:151
FlutterPlatformViewGestureRecognizersBlockingPolicy
FlutterPlatformViewGestureRecognizersBlockingPolicy
Definition: FlutterPlugin.h:252
FlutterClippingMaskViewPool
Definition: FlutterPlatformViews_Internal.h:60
UIView(FirstResponder)
Definition: FlutterPlatformViews.mm:22
ChildClippingView
Definition: FlutterPlatformViews_Internal.h:117
-[flutter::FlutterPlatformViewsController PushVisitedPlatformView]
void PushVisitedPlatformView(int64_t view_id)
Definition: FlutterPlatformViews_Internal.h:276
SemanticsObject.h
+[PlatformViewFilter resetPreparation]
void resetPreparation()
Definition: FlutterPlatformViews_Internal.mm:114
FlutterTouchInterceptingView
Definition: FlutterPlatformViews.mm:965
flutter::GetCATransform3DFromSkMatrix
CATransform3D GetCATransform3DFromSkMatrix(const SkMatrix &matrix)
Definition: FlutterPlatformViews_Internal.mm:41
flutter::GetCGRectFromSkRect
CGRect GetCGRectFromSkRect(const SkRect &clipSkRect)
Definition: FlutterPlatformViews_Internal.mm:62
PlatformViewFilter
Definition: FlutterPlatformViews_Internal.h:78
ios_context.h
flutter::FlutterPlatformViewsController
Definition: FlutterPlatformViews_Internal.h:201
FlutterClippingMaskView
Definition: FlutterPlatformViews_Internal.h:29