mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Avoid using Dart_New for semantics (#16849)
This commit is contained in:
parent
cc0e21b5d2
commit
e47fa0bee9
@ -805,7 +805,12 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// The returned object can be passed to [Window.updateSemantics] to actually
|
||||
/// update the semantics retained by the system.
|
||||
SemanticsUpdate build() native 'SemanticsUpdateBuilder_build';
|
||||
SemanticsUpdate build() {
|
||||
final SemanticsUpdate semanticsUpdate = SemanticsUpdate._();
|
||||
_build(semanticsUpdate);
|
||||
return semanticsUpdate;
|
||||
}
|
||||
void _build(SemanticsUpdate outSemanticsUpdate) native 'SemanticsUpdateBuilder_build';
|
||||
}
|
||||
|
||||
/// An opaque object representing a batch of semantics updates.
|
||||
|
||||
@ -20,11 +20,12 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, SemanticsUpdate);
|
||||
|
||||
DART_BIND_ALL(SemanticsUpdate, FOR_EACH_BINDING)
|
||||
|
||||
fml::RefPtr<SemanticsUpdate> SemanticsUpdate::create(
|
||||
SemanticsNodeUpdates nodes,
|
||||
CustomAccessibilityActionUpdates actions) {
|
||||
return fml::MakeRefCounted<SemanticsUpdate>(std::move(nodes),
|
||||
std::move(actions));
|
||||
void SemanticsUpdate::create(Dart_Handle semantics_update_handle,
|
||||
SemanticsNodeUpdates nodes,
|
||||
CustomAccessibilityActionUpdates actions) {
|
||||
auto semantics_update = fml::MakeRefCounted<SemanticsUpdate>(
|
||||
std::move(nodes), std::move(actions));
|
||||
semantics_update->AssociateWithDartWrapper(semantics_update_handle);
|
||||
}
|
||||
|
||||
SemanticsUpdate::SemanticsUpdate(SemanticsNodeUpdates nodes,
|
||||
|
||||
@ -21,9 +21,9 @@ class SemanticsUpdate : public RefCountedDartWrappable<SemanticsUpdate> {
|
||||
|
||||
public:
|
||||
~SemanticsUpdate() override;
|
||||
static fml::RefPtr<SemanticsUpdate> create(
|
||||
SemanticsNodeUpdates nodes,
|
||||
CustomAccessibilityActionUpdates actions);
|
||||
static void create(Dart_Handle semantics_update_handle,
|
||||
SemanticsNodeUpdates nodes,
|
||||
CustomAccessibilityActionUpdates actions);
|
||||
|
||||
SemanticsNodeUpdates takeNodes();
|
||||
|
||||
|
||||
@ -121,8 +121,9 @@ void SemanticsUpdateBuilder::updateCustomAction(int id,
|
||||
actions_[id] = action;
|
||||
}
|
||||
|
||||
fml::RefPtr<SemanticsUpdate> SemanticsUpdateBuilder::build() {
|
||||
return SemanticsUpdate::create(std::move(nodes_), std::move(actions_));
|
||||
void SemanticsUpdateBuilder::build(Dart_Handle semantics_update_handle) {
|
||||
SemanticsUpdate::create(semantics_update_handle, std::move(nodes_),
|
||||
std::move(actions_));
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@ -58,7 +58,7 @@ class SemanticsUpdateBuilder
|
||||
std::string hint,
|
||||
int overrideId);
|
||||
|
||||
fml::RefPtr<SemanticsUpdate> build();
|
||||
void build(Dart_Handle semantics_update_handle);
|
||||
|
||||
static void RegisterNatives(tonic::DartLibraryNatives* natives);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user