-
Notifications
You must be signed in to change notification settings - Fork 6k
Add callback to Embedder API to respond to new channel listeners, and use for Windows lifecycle #44827
Add callback to Embedder API to respond to new channel listeners, and use for Windows lifecycle #44827
Changes from all commits
bf3c3c7
839f8d1
5dd476e
0bdacd0
c2091cf
b3cf373
0ca00f7
0ea137c
af8cf2d
711ebac
17c85e1
770bcfe
da9083a
ba08343
f10ec72
6d86f71
c7a6454
6286c00
60f5ac9
d136a93
3413635
ff1e6c2
bf67370
6cf7338
f0ac397
bff347a
2e87fa9
cf671c8
77316c9
54d0826
62b015c
478b6dd
96e841c
d01b399
48a17ff
6b9b572
5b6a221
bdbb829
f4d292b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,17 @@ class PlatformConfigurationClient { | |
/// | ||
virtual void RequestDartDeferredLibrary(intptr_t loading_unit_id) = 0; | ||
|
||
//-------------------------------------------------------------------------- | ||
/// @brief Invoked when a listener is registered on a platform channel. | ||
/// | ||
/// @param[in] name The name of the platform channel to which a | ||
/// listener has been registered or cleared. | ||
/// | ||
/// @param[in] listening Whether the listener has been set (true) or | ||
/// cleared (false). | ||
/// | ||
virtual void SendChannelUpdate(std::string name, bool listening) = 0; | ||
|
||
//-------------------------------------------------------------------------- | ||
/// @brief Synchronously invokes platform-specific APIs to apply the | ||
/// system text scaling on the given unscaled font size. | ||
|
@@ -571,6 +582,8 @@ class PlatformConfigurationNativeApi { | |
static void RespondToPlatformMessage(int response_id, | ||
const tonic::DartByteData& data); | ||
|
||
static void SendChannelUpdate(const std::string& name, bool listening); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently, it seems this may not be an option. I tried that and pushed the change, but ironically, it seems doing so actually results in errors reported by the clang tidy tests explicitly saying to make the parameters const references. This is only the case for some of the lambdas/methods, but the signature of |
||
|
||
//-------------------------------------------------------------------------- | ||
/// @brief Requests the Dart VM to adjusts the GC heuristics based on | ||
/// the requested `performance_mode`. Returns the old performance | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1402,6 +1402,20 @@ typedef void (*FlutterUpdateSemanticsCallback2)( | |
const FlutterSemanticsUpdate2* /* semantics update */, | ||
void* /* user data*/); | ||
|
||
/// An update to whether a message channel has a listener set or not. | ||
typedef struct { | ||
// The size of the struct. Must be sizeof(FlutterChannelUpdate). | ||
size_t struct_size; | ||
/// The name of the channel. | ||
const char* channel; | ||
/// True if a listener has been set, false if one has been cleared. | ||
bool listening; | ||
} FlutterChannelUpdate; | ||
loic-sharma marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we 100% certain that we'll never want to add more members to this struct? If not, add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh derp I completely forgot this 🤦. Yup let's add a |
||
|
||
typedef void (*FlutterChannelUpdateCallback)( | ||
const FlutterChannelUpdate* /* channel update */, | ||
void* /* user data */); | ||
|
||
typedef struct _FlutterTaskRunner* FlutterTaskRunner; | ||
|
||
typedef struct { | ||
|
@@ -2194,6 +2208,11 @@ typedef struct { | |
/// and `update_semantics_callback2` may be provided; the others must be set | ||
/// to null. | ||
FlutterUpdateSemanticsCallback2 update_semantics_callback2; | ||
|
||
/// The callback invoked by the engine in response to a channel listener | ||
/// being registered on the framework side. The callback is invoked from | ||
/// a task posted to the UI task runner. | ||
FlutterChannelUpdateCallback channel_update_callback; | ||
} FlutterProjectArgs; | ||
|
||
#ifndef FLUTTER_ENGINE_NO_PROTOTYPES | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This signature doesn't appear to match the implementation.
std::string
vsconst std::string& name
. Based on @loic-sharma's comment, looks like maybe this is the correct signature but the one lower downstatic void SendChannelUpdate(const std::string& name, bool listening);
should be corrected?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What non-matching implementation to this signature are you looking at? It is implemented in
runtime_controller.cc:405
, where the signatures match.