Conform to clang_tidy in client_wrapper headers. (flutter/engine#46058)
Partial work towards https://github.com/flutter/flutter/issues/134969. All of these were auto-suggested by Clang, and mostly avoid unnecessary copies.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "binary_messenger.h"
|
||||
#include "message_codec.h"
|
||||
@@ -58,7 +59,8 @@ class BasicMessageChannel {
|
||||
void Send(const T& message, BinaryReply reply) {
|
||||
std::unique_ptr<std::vector<uint8_t>> raw_message =
|
||||
codec_->EncodeMessage(message);
|
||||
messenger_->Send(name_, raw_message->data(), raw_message->size(), reply);
|
||||
messenger_->Send(name_, raw_message->data(), raw_message->size(),
|
||||
std::move(reply));
|
||||
}
|
||||
|
||||
// Registers a handler that should be called any time a message is
|
||||
@@ -77,7 +79,7 @@ class BasicMessageChannel {
|
||||
BinaryMessageHandler binary_handler = [handler, codec, channel_name](
|
||||
const uint8_t* binary_message,
|
||||
const size_t binary_message_size,
|
||||
BinaryReply binary_reply) {
|
||||
const BinaryReply& binary_reply) {
|
||||
// Use this channel's codec to decode the message and build a reply
|
||||
// handler.
|
||||
std::unique_ptr<T> message =
|
||||
|
||||
@@ -69,7 +69,7 @@ class EventChannel {
|
||||
// Mutable state to track the handler's listening status.
|
||||
is_listening = bool(false)](const uint8_t* message,
|
||||
const size_t message_size,
|
||||
BinaryReply reply) mutable {
|
||||
const BinaryReply& reply) mutable {
|
||||
constexpr char kOnListenMethod[] = "listen";
|
||||
constexpr char kOnCancelMethod[] = "cancel";
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ struct StreamHandlerError {
|
||||
const std::string error_message;
|
||||
const std::unique_ptr<T> 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<T>&& error_details)
|
||||
: error_code(error_code),
|
||||
error_message(error_message),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "method_result.h"
|
||||
|
||||
@@ -36,7 +37,7 @@ class MethodResultFunctions : public MethodResult<T> {
|
||||
ResultHandlerNotImplemented<T> on_not_implemented)
|
||||
: on_success_(on_success),
|
||||
on_error_(on_error),
|
||||
on_not_implemented_(on_not_implemented) {}
|
||||
on_not_implemented_(std::move(on_not_implemented)) {}
|
||||
|
||||
virtual ~MethodResultFunctions() = default;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
namespace flutter {
|
||||
@@ -28,7 +29,7 @@ class PixelBufferTexture {
|
||||
// take care of proper synchronization. It also needs to be ensured that the
|
||||
// returned buffer isn't released prior to unregistering this texture.
|
||||
explicit PixelBufferTexture(CopyBufferCallback copy_buffer_callback)
|
||||
: copy_buffer_callback_(copy_buffer_callback) {}
|
||||
: copy_buffer_callback_(std::move(copy_buffer_callback)) {}
|
||||
|
||||
// Returns the callback-provided FlutterDesktopPixelBuffer that contains the
|
||||
// actual pixel data. The intended surface size is specified by |width| and
|
||||
|
||||
@@ -32,7 +32,7 @@ class Point {
|
||||
// variable-length type that includes types handled by the core standard codec.
|
||||
class SomeData {
|
||||
public:
|
||||
SomeData(const std::string label, const std::vector<uint8_t>& data)
|
||||
SomeData(const std::string& label, const std::vector<uint8_t>& data)
|
||||
: label_(label), data_(data) {}
|
||||
~SomeData() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user