@@ -98,9 +98,9 @@ typedef enum {
98
98
// A request that the node should be dismissed.
99
99
kFlutterSemanticsActionDismiss = 1 << 18 ,
100
100
// Move the cursor forward by one word.
101
- kFlutterSemanticsActionMoveCursorForwardByWordIndex = 1 << 19 ,
101
+ kFlutterSemanticsActionMoveCursorForwardByWord = 1 << 19 ,
102
102
// Move the cursor backward by one word.
103
- kFlutterSemanticsActionMoveCursorBackwardByWordIndex = 1 << 20 ,
103
+ kFlutterSemanticsActionMoveCursorBackwardByWord = 1 << 20 ,
104
104
} FlutterSemanticsAction ;
105
105
106
106
// The set of properties that may be associated with a semantics node.
@@ -277,6 +277,7 @@ typedef struct {
277
277
double pixel_ratio ;
278
278
} FlutterWindowMetricsEvent ;
279
279
280
+ // The phase of the pointer event.
280
281
typedef enum {
281
282
kCancel ,
282
283
kUp ,
@@ -287,6 +288,12 @@ typedef enum {
287
288
kHover ,
288
289
} FlutterPointerPhase ;
289
290
291
+ // The type of a pointer signal.
292
+ typedef enum {
293
+ kFlutterPointerSignalKindNone ,
294
+ kFlutterPointerSignalKindScroll ,
295
+ } FlutterPointerSignalKind ;
296
+
290
297
typedef struct {
291
298
// The size of this struct. Must be sizeof(FlutterPointerEvent).
292
299
size_t struct_size ;
@@ -297,6 +304,9 @@ typedef struct {
297
304
// An optional device identifier. If this is not specified, it is assumed that
298
305
// the embedder has no multitouch capability.
299
306
int32_t device ;
307
+ FlutterPointerSignalKind signal_kind ;
308
+ double scroll_delta_x ;
309
+ double scroll_delta_y ;
300
310
} FlutterPointerEvent ;
301
311
302
312
struct _FlutterPlatformMessageResponseHandle ;
@@ -333,7 +343,8 @@ typedef struct {
333
343
334
344
// |FlutterSemanticsNode| ID used as a sentinel to signal the end of a batch of
335
345
// semantics node updates.
336
- // const int32_t kFlutterSemanticsNodeIdBatchEnd = -1;
346
+ FLUTTER_EXPORT
347
+ extern const int32_t kFlutterSemanticsNodeIdBatchEnd ;
337
348
338
349
// A node that represents some semantic data.
339
350
//
@@ -404,7 +415,8 @@ typedef struct {
404
415
405
416
// |FlutterSemanticsCustomAction| ID used as a sentinel to signal the end of a
406
417
// batch of semantics custom action updates.
407
- // const int32_t kFlutterSemanticsCustomActionIdBatchEnd = -1;
418
+ FLUTTER_EXPORT
419
+ extern const int32_t kFlutterSemanticsCustomActionIdBatchEnd ;
408
420
409
421
// A custom semantics action, or action override.
410
422
//
@@ -437,6 +449,52 @@ typedef void (*FlutterUpdateSemanticsCustomActionCallback)(
437
449
const FlutterSemanticsCustomAction * /* semantics custom action */ ,
438
450
void * /* user data */ );
439
451
452
+ typedef struct _FlutterTaskRunner * FlutterTaskRunner ;
453
+
454
+ typedef struct {
455
+ FlutterTaskRunner runner ;
456
+ uint64_t task ;
457
+ } FlutterTask ;
458
+
459
+ typedef void (* FlutterTaskRunnerPostTaskCallback )(
460
+ FlutterTask /* task */ ,
461
+ uint64_t /* target time nanos */ ,
462
+ void * /* user data */ );
463
+
464
+ // An interface used by the Flutter engine to execute tasks at the target time
465
+ // on a specified thread. There should be a 1-1 relationship between a thread
466
+ // and a task runner. It is undefined behavior to run a task on a thread that is
467
+ // not associated with its task runner.
468
+ typedef struct {
469
+ // The size of this struct. Must be sizeof(FlutterTaskRunnerDescription).
470
+ size_t struct_size ;
471
+ void * user_data ;
472
+ // May be called from any thread. Should return true if tasks posted on the
473
+ // calling thread will be run on that same thread.
474
+ //
475
+ // This field is required.
476
+ BoolCallback runs_task_on_current_thread_callback ;
477
+ // May be called from any thread. The given task should be executed by the
478
+ // embedder on the thread associated with that task runner by calling
479
+ // |FlutterEngineRunTask| at the given target time. The system monotonic clock
480
+ // should be used for the target time. The target time is the absolute time
481
+ // from epoch (NOT a delta) at which the task must be returned back to the
482
+ // engine on the correct thread. If the embedder needs to calculate a delta,
483
+ // |FlutterEngineGetCurrentTime| may be called and the difference used as the
484
+ // delta.
485
+ //
486
+ // This field is required.
487
+ FlutterTaskRunnerPostTaskCallback post_task_callback ;
488
+ } FlutterTaskRunnerDescription ;
489
+
490
+ typedef struct {
491
+ // The size of this struct. Must be sizeof(FlutterCustomTaskRunners).
492
+ size_t struct_size ;
493
+ // Specify the task runner for the thread on which the |FlutterEngineRun| call
494
+ // is made.
495
+ const FlutterTaskRunnerDescription * platform_task_runner ;
496
+ } FlutterCustomTaskRunners ;
497
+
440
498
typedef struct {
441
499
// The size of this struct. Must be sizeof(FlutterProjectArgs).
442
500
size_t struct_size ;
@@ -539,14 +597,34 @@ typedef struct {
539
597
// Flutter application (such as compiled shader programs used by Skia).
540
598
// This is optional. The string must be NULL terminated.
541
599
const char * persistent_cache_path ;
542
- // A callback that gets invoked by the engine when it attempts to wait for
543
- // a platform vsync event. The engine will give the platform a baton that
544
- // needs to be returned back to the engine via |FlutterEngineOnVsync|. All
545
- // vsync operations must occur on the thread that made the call to
546
- // |FlutterEngineRun|. All batons must be retured to the engine before
547
- // initializing a |FlutterEngineShutdown|. Not doing the same will result in a
548
- // memory leak.
600
+
601
+ // If true, we'll only read the existing cache, but not write new ones.
602
+ bool is_persistent_cache_read_only ;
603
+
604
+ // A callback that gets invoked by the engine when it attempts to wait for a
605
+ // platform vsync event. The engine will give the platform a baton that needs
606
+ // to be returned back to the engine via |FlutterEngineOnVsync|. All batons
607
+ // must be retured to the engine before initializing a
608
+ // |FlutterEngineShutdown|. Not doing the same will result in a memory leak.
609
+ // While the call to |FlutterEngineOnVsync| must occur on the thread that made
610
+ // the call to |FlutterEngineRun|, the engine will make this callback on an
611
+ // internal engine-managed thread. If the components accessed on the embedder
612
+ // are not thread safe, the appropriate re-threading must be done.
549
613
VsyncCallback vsync_callback ;
614
+
615
+ // The name of a custom Dart entrypoint. This is optional and specifying a
616
+ // null or empty entrypoint makes the engine look for a method named "main" in
617
+ // the root library of the application.
618
+ //
619
+ // Care must be taken to ensure that the custom entrypoint is not tree-shaken
620
+ // away. Usually, this is done using the `@pragma('vm:entry-point')`
621
+ // decoration.
622
+ const char * custom_dart_entrypoint ;
623
+
624
+ // Typically the Flutter engine create and manages its internal threads. This
625
+ // optional argument allows for the specification of task runner interfaces to
626
+ // event loops managed by the embedder on threads it creates.
627
+ const FlutterCustomTaskRunners * custom_task_runners ;
550
628
} FlutterProjectArgs ;
551
629
552
630
FLUTTER_EXPORT
@@ -635,7 +713,21 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction(
635
713
size_t data_length );
636
714
637
715
// Notify the engine that a vsync event occurred. A baton passed to the
638
- // platform via the vsync callback must be returned.
716
+ // platform via the vsync callback must be returned. This call must be made on
717
+ // the thread on which the call to |FlutterEngineRun| was made.
718
+ //
719
+ // |frame_start_time_nanos| is the point at which the vsync event occurred or
720
+ // will occur. If the time point is in the future, the engine will wait till
721
+ // that point to begin its frame workload. The system monotonic clock is used as
722
+ // the timebase.
723
+ //
724
+ // |frame_target_time_nanos| is the point at which the embedder anticipates the
725
+ // next vsync to occur. This is a hint the engine uses to schedule Dart VM
726
+ // garbage collection in periods in which the various threads are most likely to
727
+ // be idle. For example, for a 60Hz display, embedders should add 16.6 * 1e6 to
728
+ // the frame time field. The system monotonic clock is used as the timebase.
729
+ //
730
+ // That frame timepoints are in nanoseconds.
639
731
FLUTTER_EXPORT
640
732
FlutterEngineResult FlutterEngineOnVsync (FlutterEngine engine ,
641
733
intptr_t baton ,
@@ -646,24 +738,49 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine,
646
738
// the timeline is unavailable or disabled, this has no effect. Must be
647
739
// balanced with an duration end event (via
648
740
// |FlutterEngineTraceEventDurationEnd|) with the same name on the same thread.
649
- // Can be called on any thread.
741
+ // Can be called on any thread. Strings passed into the function will NOT be
742
+ // copied when added to the timeline. Only string literals may be passed in.
650
743
FLUTTER_EXPORT
651
744
void FlutterEngineTraceEventDurationBegin (const char * name );
652
745
653
746
// A profiling utility. Logs a trace duration end event to the timeline. If the
654
747
// timeline is unavailable or disabled, this has no effect. This call must be
655
748
// preceded by a trace duration begin call (via
656
749
// |FlutterEngineTraceEventDurationBegin|) with the same name on the same
657
- // thread. Can be called on any thread.
750
+ // thread. Can be called on any thread. Strings passed into the function will
751
+ // NOT be copied when added to the timeline. Only string literals may be passed
752
+ // in.
658
753
FLUTTER_EXPORT
659
754
void FlutterEngineTraceEventDurationEnd (const char * name );
660
755
661
756
// A profiling utility. Logs a trace duration instant event to the timeline. If
662
757
// the timeline is unavailable or disabled, this has no effect. Can be called
663
- // on any thread.
758
+ // on any thread. Strings passed into the function will NOT be copied when added
759
+ // to the timeline. Only string literals may be passed in.
664
760
FLUTTER_EXPORT
665
761
void FlutterEngineTraceEventInstant (const char * name );
666
762
763
+ // Posts a task onto the Flutter render thread. Typically, this may be called
764
+ // from any thread as long as a |FlutterEngineShutdown| on the specific engine
765
+ // has not already been initiated.
766
+ FLUTTER_EXPORT
767
+ FlutterEngineResult FlutterEnginePostRenderThreadTask (FlutterEngine engine ,
768
+ VoidCallback callback ,
769
+ void * callback_data );
770
+
771
+ // Get the current time in nanoseconds from the clock used by the flutter
772
+ // engine. This is the system monotonic clock.
773
+ FLUTTER_EXPORT
774
+ uint64_t FlutterEngineGetCurrentTime ();
775
+
776
+ // Inform the engine to run the specified task. This task has been given to
777
+ // the engine via the |FlutterTaskRunnerDescription.post_task_callback|. This
778
+ // call must only be made at the target time specified in that callback. Running
779
+ // the task before that time is undefined behavior.
780
+ FLUTTER_EXPORT
781
+ FlutterEngineResult FlutterEngineRunTask (FlutterEngine engine ,
782
+ const FlutterTask * task );
783
+
667
784
#if defined(__cplusplus )
668
785
} // extern "C"
669
786
#endif
0 commit comments