Skip to content

Commit 1902050

Browse files
embedder: merge embedder.h from flutter/engine (sony#394)
Merged from flutter/engine@f358bde Signed-off-by: Hidenori Matsubayashi <[email protected]>
1 parent d5fe468 commit 1902050

File tree

1 file changed

+134
-3
lines changed

1 file changed

+134
-3
lines changed

src/flutter/shell/platform/embedder/embedder.h

Lines changed: 134 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
// - Function signatures (names, argument counts, argument order, and argument
2626
// type) cannot change.
2727
// - The core behavior of existing functions cannot change.
28-
// - Instead of nesting structures by value within another structure, prefer
29-
// nesting by pointer. This ensures that adding members to the nested struct
30-
// does not break the ABI of the parent struct.
28+
// - Instead of nesting structures by value within another structure/union,
29+
// prefer nesting by pointer. This ensures that adding members to the nested
30+
// struct does not break the ABI of the parent struct/union.
3131
// - Instead of array of structures, prefer array of pointers to structures.
3232
// This ensures that array indexing does not break if members are added
3333
// to the structure.
@@ -757,6 +757,11 @@ typedef struct {
757757
/// The queue family index of the VkQueue supplied in the next field.
758758
uint32_t queue_family_index;
759759
/// VkQueue handle.
760+
/// The queue should not be used without protection from a mutex to make sure
761+
/// it is not used simultaneously with other threads. That mutex should match
762+
/// the one injected via the |get_instance_proc_address_callback|.
763+
/// There is a proposal to remove the need for the mutex at
764+
/// https://github.com/flutter/flutter/issues/134573.
760765
FlutterVulkanQueueHandle queue;
761766
/// The number of instance extensions available for enumerating in the next
762767
/// field.
@@ -780,6 +785,12 @@ typedef struct {
780785
/// For example: VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME
781786
const char** enabled_device_extensions;
782787
/// The callback invoked when resolving Vulkan function pointers.
788+
/// At a bare minimum this should be used to swap out any calls that operate
789+
/// on vkQueue's for threadsafe variants that obtain locks for their duration.
790+
/// The functions to swap out are "vkQueueSubmit" and "vkQueueWaitIdle". An
791+
/// example of how to do that can be found in the test
792+
/// "EmbedderTest.CanSwapOutVulkanCalls" unit-test in
793+
/// //shell/platform/embedder/tests/embedder_vk_unittests.cc.
783794
FlutterVulkanInstanceProcAddressCallback get_instance_proc_address_callback;
784795
/// The callback invoked when the engine requests a VkImage from the embedder
785796
/// for rendering the next frame.
@@ -1064,6 +1075,57 @@ typedef int64_t FlutterPlatformViewIdentifier;
10641075
FLUTTER_EXPORT
10651076
extern const int32_t kFlutterSemanticsNodeIdBatchEnd;
10661077

1078+
// The enumeration of possible string attributes that affect how assistive
1079+
// technologies announce a string.
1080+
//
1081+
// See dart:ui's implementers of the StringAttribute abstract class.
1082+
typedef enum {
1083+
// Indicates the string should be announced character by character.
1084+
kSpellOut,
1085+
// Indicates the string should be announced using the specified locale.
1086+
kLocale,
1087+
} FlutterStringAttributeType;
1088+
1089+
// Indicates the assistive technology should announce out the string character
1090+
// by character.
1091+
//
1092+
// See dart:ui's SpellOutStringAttribute.
1093+
typedef struct {
1094+
/// The size of this struct. Must be sizeof(FlutterSpellOutStringAttribute).
1095+
size_t struct_size;
1096+
} FlutterSpellOutStringAttribute;
1097+
1098+
// Indicates the assistive technology should announce the string using the
1099+
// specified locale.
1100+
//
1101+
// See dart:ui's LocaleStringAttribute.
1102+
typedef struct {
1103+
/// The size of this struct. Must be sizeof(FlutterLocaleStringAttribute).
1104+
size_t struct_size;
1105+
// The locale of this attribute.
1106+
const char* locale;
1107+
} FlutterLocaleStringAttribute;
1108+
1109+
// Indicates how the assistive technology should treat the string.
1110+
//
1111+
// See dart:ui's StringAttribute.
1112+
typedef struct {
1113+
/// The size of this struct. Must be sizeof(FlutterStringAttribute).
1114+
size_t struct_size;
1115+
// The position this attribute starts.
1116+
size_t start;
1117+
// The next position after the attribute ends.
1118+
size_t end;
1119+
/// The type of the attribute described by the subsequent union.
1120+
FlutterStringAttributeType type;
1121+
union {
1122+
// Indicates the string should be announced character by character.
1123+
const FlutterSpellOutStringAttribute* spell_out;
1124+
// Indicates the string should be announced using the specified locale.
1125+
const FlutterLocaleStringAttribute* locale;
1126+
};
1127+
} FlutterStringAttribute;
1128+
10671129
/// A node that represents some semantic data.
10681130
///
10691131
/// The semantics tree is maintained during the semantics phase of the pipeline
@@ -1215,6 +1277,31 @@ typedef struct {
12151277
FlutterPlatformViewIdentifier platform_view_id;
12161278
/// A textual tooltip attached to the node.
12171279
const char* tooltip;
1280+
// The number of string attributes associated with the `label`.
1281+
size_t label_attribute_count;
1282+
// Array of string attributes associated with the `label`.
1283+
// Has length `label_attribute_count`.
1284+
const FlutterStringAttribute** label_attributes;
1285+
// The number of string attributes associated with the `hint`.
1286+
size_t hint_attribute_count;
1287+
// Array of string attributes associated with the `hint`.
1288+
// Has length `hint_attribute_count`.
1289+
const FlutterStringAttribute** hint_attributes;
1290+
// The number of string attributes associated with the `value`.
1291+
size_t value_attribute_count;
1292+
// Array of string attributes associated with the `value`.
1293+
// Has length `value_attribute_count`.
1294+
const FlutterStringAttribute** value_attributes;
1295+
// The number of string attributes associated with the `increased_value`.
1296+
size_t increased_value_attribute_count;
1297+
// Array of string attributes associated with the `increased_value`.
1298+
// Has length `increased_value_attribute_count`.
1299+
const FlutterStringAttribute** increased_value_attributes;
1300+
// The number of string attributes associated with the `decreased_value`.
1301+
size_t decreased_value_attribute_count;
1302+
// Array of string attributes associated with the `decreased_value`.
1303+
// Has length `decreased_value_attribute_count`.
1304+
const FlutterStringAttribute** decreased_value_attributes;
12181305
} FlutterSemanticsNode2;
12191306

12201307
/// `FlutterSemanticsCustomAction` ID used as a sentinel to signal the end of a
@@ -1326,6 +1413,20 @@ typedef void (*FlutterUpdateSemanticsCallback2)(
13261413
const FlutterSemanticsUpdate2* /* semantics update */,
13271414
void* /* user data*/);
13281415

1416+
/// An update to whether a message channel has a listener set or not.
1417+
typedef struct {
1418+
// The size of the struct. Must be sizeof(FlutterChannelUpdate).
1419+
size_t struct_size;
1420+
/// The name of the channel.
1421+
const char* channel;
1422+
/// True if a listener has been set, false if one has been cleared.
1423+
bool listening;
1424+
} FlutterChannelUpdate;
1425+
1426+
typedef void (*FlutterChannelUpdateCallback)(
1427+
const FlutterChannelUpdate* /* channel update */,
1428+
void* /* user data */);
1429+
13291430
typedef struct _FlutterTaskRunner* FlutterTaskRunner;
13301431

13311432
typedef struct {
@@ -1573,6 +1674,27 @@ typedef enum {
15731674
kFlutterLayerContentTypePlatformView,
15741675
} FlutterLayerContentType;
15751676

1677+
/// A region represented by a collection of non-overlapping rectangles.
1678+
typedef struct {
1679+
/// The size of this struct. Must be sizeof(FlutterRegion).
1680+
size_t struct_size;
1681+
/// Number of rectangles in the region.
1682+
size_t rects_count;
1683+
/// The rectangles that make up the region.
1684+
FlutterRect* rects;
1685+
} FlutterRegion;
1686+
1687+
/// Contains additional information about the backing store provided
1688+
/// during presentation to the embedder.
1689+
typedef struct {
1690+
size_t struct_size;
1691+
1692+
/// The area of the backing store that contains Flutter contents. Pixels
1693+
/// outside of this area are transparent and the embedder may choose not
1694+
/// to render them. Coordinates are in physical pixels.
1695+
FlutterRegion* paint_region;
1696+
} FlutterBackingStorePresentInfo;
1697+
15761698
typedef struct {
15771699
/// This size of this struct. Must be sizeof(FlutterLayer).
15781700
size_t struct_size;
@@ -1592,6 +1714,10 @@ typedef struct {
15921714
FlutterPoint offset;
15931715
/// The size of the layer (in physical pixels).
15941716
FlutterSize size;
1717+
1718+
/// Extra information for the backing store that the embedder may
1719+
/// use during presentation.
1720+
FlutterBackingStorePresentInfo* backing_store_present_info;
15951721
} FlutterLayer;
15961722

15971723
typedef bool (*FlutterBackingStoreCreateCallback)(
@@ -2118,6 +2244,11 @@ typedef struct {
21182244
/// and `update_semantics_callback2` may be provided; the others must be set
21192245
/// to null.
21202246
FlutterUpdateSemanticsCallback2 update_semantics_callback2;
2247+
2248+
/// The callback invoked by the engine in response to a channel listener
2249+
/// being registered on the framework side. The callback is invoked from
2250+
/// a task posted to the platform thread.
2251+
FlutterChannelUpdateCallback channel_update_callback;
21212252
} FlutterProjectArgs;
21222253

21232254
#ifndef FLUTTER_ENGINE_NO_PROTOTYPES

0 commit comments

Comments
 (0)