From 293a8e53fb8972adb1408bf6cafefbd7f23b8bef Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Sat, 3 Oct 2026 04:07:26 +0900 Subject: [PATCH] Sync client_wrapper with upstream Flutter Apply the upstream client_wrapper changes that the source syncs missed. They are already in the pinned Flutter commit (6655482ec0): - Take StreamHandlerError strings by const reference. https://github.com/flutter/engine/pull/46058 (42bac1a9a9) - Move std::function arguments instead of copying them, and take the MethodChannel handler by const reference. https://github.com/flutter/flutter/pull/173429 (f45a8f8b71) - Point the channel_buffers.dart link to the flutter/flutter repo. https://github.com/flutter/flutter/pull/182600 (2d7e80963b) --- .../platform/common/client_wrapper/core_implementations.cc | 2 +- .../client_wrapper/include/flutter/event_stream_handler.h | 4 ++-- .../include/flutter/event_stream_handler_functions.h | 2 +- .../common/client_wrapper/include/flutter/method_channel.h | 2 +- .../client_wrapper/include/flutter/method_result_functions.h | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flutter/shell/platform/common/client_wrapper/core_implementations.cc b/flutter/shell/platform/common/client_wrapper/core_implementations.cc index f682f1b2..2e642b4c 100644 --- a/flutter/shell/platform/common/client_wrapper/core_implementations.cc +++ b/flutter/shell/platform/common/client_wrapper/core_implementations.cc @@ -183,7 +183,7 @@ void ResizeChannel(BinaryMessenger* messenger, std::string name, int new_size) { messenger, kControlChannelName, &StandardMethodCodec::GetInstance()); // The deserialization logic handles only 32 bits values, see - // https://github.com/flutter/engine/blob/93e8901490e78c7ba7e319cce4470d9c6478c6dc/lib/ui/channel_buffers.dart#L495. + // https://github.com/flutter/flutter/blob/230240c56880f2c19bf92d2c32203b064054f173/engine/src/flutter/lib/ui/channel_buffers.dart#L523 control_channel->InvokeMethod( kResizeMethod, std::make_unique(EncodableList{ EncodableValue(name), diff --git a/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler.h b/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler.h index 9c1d8941..166733dd 100644 --- a/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler.h +++ b/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler.h @@ -20,8 +20,8 @@ struct StreamHandlerError { const std::string error_message; const std::unique_ptr error_details; - StreamHandlerError(const std::string error_code, - const std::string error_message, + StreamHandlerError(const std::string& error_code, + const std::string& error_message, std::unique_ptr&& error_details) : error_code(error_code), error_message(error_message), diff --git a/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler_functions.h b/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler_functions.h index fde4ce44..74d64fc3 100644 --- a/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler_functions.h +++ b/flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler_functions.h @@ -35,7 +35,7 @@ class StreamHandlerFunctions : public StreamHandler { // for the corresponding StreamHandler outcomes. StreamHandlerFunctions(StreamHandlerListen on_listen, StreamHandlerCancel on_cancel) - : on_listen_(on_listen), on_cancel_(on_cancel) {} + : on_listen_(std::move(on_listen)), on_cancel_(std::move(on_cancel)) {} virtual ~StreamHandlerFunctions() = default; diff --git a/flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h b/flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h index a4029fcc..b1d551a9 100644 --- a/flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h +++ b/flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h @@ -96,7 +96,7 @@ class MethodChannel { // Destroying the MethodChannel will not unregister the handler, so // the caller is responsible for unregistering explicitly if the handler // stops being valid before the engine is destroyed. - void SetMethodCallHandler(MethodCallHandler handler) const { + void SetMethodCallHandler(const MethodCallHandler& handler) const { if (!handler) { messenger_->SetMessageHandler(name_, nullptr); return; diff --git a/flutter/shell/platform/common/client_wrapper/include/flutter/method_result_functions.h b/flutter/shell/platform/common/client_wrapper/include/flutter/method_result_functions.h index 57f6d0e9..c485da3c 100644 --- a/flutter/shell/platform/common/client_wrapper/include/flutter/method_result_functions.h +++ b/flutter/shell/platform/common/client_wrapper/include/flutter/method_result_functions.h @@ -35,8 +35,8 @@ class MethodResultFunctions : public MethodResult { MethodResultFunctions(ResultHandlerSuccess on_success, ResultHandlerError on_error, ResultHandlerNotImplemented on_not_implemented) - : on_success_(on_success), - on_error_(on_error), + : on_success_(std::move(on_success)), + on_error_(std::move(on_error)), on_not_implemented_(std::move(on_not_implemented)) {} virtual ~MethodResultFunctions() = default;