optimized IncomingMessageDispatcher::HandleMessage a bit (flutter/engine#34954)

* optimized IncomingMessageDispatcher::HandleMessage a bit.

* removed std::string ref
This commit is contained in:
gaaclarke
2022-07-28 14:12:57 -07:00
committed by GitHub
parent 815ffda131
commit 645ac3c239

View File

@@ -19,14 +19,15 @@ void IncomingMessageDispatcher::HandleMessage(
const std::function<void(void)>& input_unblock_cb) {
std::string channel(message.channel);
auto callback_iterator = callbacks_.find(channel);
// Find the handler for the channel; if there isn't one, report the failure.
if (callbacks_.find(channel) == callbacks_.end()) {
if (callback_iterator == callbacks_.end()) {
FlutterDesktopMessengerSendResponse(messenger_, message.response_handle,
nullptr, 0);
return;
}
auto& callback_info = callbacks_[channel];
FlutterDesktopMessageCallback message_callback = callback_info.first;
auto& callback_info = callback_iterator->second;
const FlutterDesktopMessageCallback& message_callback = callback_info.first;
// Process the call, handling input blocking if requested.
bool block_input = input_blocking_channels_.count(channel) > 0;