diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc index 7b138f5ae7..418c1b5baf 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc @@ -471,9 +471,10 @@ bool FlutterWindowsEngine::MarkExternalTextureFrameAvailable( bool FlutterWindowsEngine::DispatchSemanticsAction( uint64_t target, FlutterSemanticsAction action, - const std::vector& data) { - return (embedder_api_.DispatchSemanticsAction( - engine_, target, action, data.data(), data.size()) == kSuccess); + fml::MallocMapping data) { + return (embedder_api_.DispatchSemanticsAction(engine_, target, action, + data.GetMapping(), + data.GetSize()) == kSuccess); } void FlutterWindowsEngine::UpdateSemanticsEnabled(bool enabled) { diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h index 5386a914b7..831e669fb7 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h @@ -152,7 +152,7 @@ class FlutterWindowsEngine { // Dispatches a semantics action to the specified semantics node. bool DispatchSemanticsAction(uint64_t id, FlutterSemanticsAction action, - const std::vector& data); + fml::MallocMapping data); // Informs the engine that the semantics enabled state has changed. void UpdateSemanticsEnabled(bool enabled); diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc b/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc index 6f40e3ae9b..36185b5b7c 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc @@ -236,22 +236,22 @@ TEST(FlutterWindowsEngine, DispatchSemanticsAction) { EngineModifier modifier(engine.get()); bool called = false; - std::string test_data = "Hello"; + std::string message = "Hello"; modifier.embedder_api().DispatchSemanticsAction = MOCK_ENGINE_PROC( DispatchSemanticsAction, - ([&called, &test_data](auto engine, auto target, auto action, auto data, - auto data_length) { + ([&called, &message](auto engine, auto target, auto action, auto data, + auto data_length) { called = true; EXPECT_EQ(target, 42); EXPECT_EQ(action, kFlutterSemanticsActionDismiss); - EXPECT_EQ(memcmp(data, test_data.c_str(), test_data.size()), 0); - EXPECT_EQ(data_length, test_data.size()); + EXPECT_EQ(memcmp(data, message.c_str(), message.size()), 0); + EXPECT_EQ(data_length, message.size()); return kSuccess; })); - engine->DispatchSemanticsAction( - 42, kFlutterSemanticsActionDismiss, - std::vector(test_data.begin(), test_data.end())); + auto data = fml::MallocMapping::Copy(message.c_str(), message.size()); + engine->DispatchSemanticsAction(42, kFlutterSemanticsActionDismiss, + std::move(data)); EXPECT_TRUE(called); }