From 96f2fe53b3298739f5bd95514c4db4d5434a1f0f Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Tue, 8 Nov 2022 14:27:52 -0800 Subject: [PATCH 1/7] Turned on performance-unnecessary-value-param everywhere. --- .clang-tidy | 3 ++- ci/lint.sh | 3 ++- fml/platform/android/jni_weak_ref.cc | 6 ++++-- .../backend/vulkan/command_buffer_vk.cc | 6 ++++-- .../backend/vulkan/command_buffer_vk.h | 2 +- .../backend/vulkan/device_buffer_vk.cc | 2 +- .../renderer/backend/vulkan/pipeline_vk.cc | 4 ++-- .../renderer/backend/vulkan/pipeline_vk.h | 2 +- .../backend/vulkan/surface_producer_vk.cc | 5 +++-- .../backend/vulkan/surface_producer_vk.h | 2 +- .../renderer/backend/vulkan/surface_vk.cc | 11 +++++----- impeller/renderer/backend/vulkan/surface_vk.h | 2 +- impeller/toolkit/egl/config.cc | 2 +- impeller/toolkit/egl/context.cc | 2 +- impeller/toolkit/egl/context.h | 3 ++- impeller/toolkit/egl/display.cc | 2 +- lib/ui/ui_dart_state.cc | 2 +- .../android/android_context_gl_skia.cc | 4 ++-- .../android/android_context_gl_skia.h | 2 +- .../android/android_external_texture_gl.cc | 4 +++- .../android/android_image_generator.cc | 5 +++-- .../android/android_image_generator.h | 2 +- .../platform/android/android_shell_holder.cc | 15 +++++++------- shell/platform/android/android_shell_holder.h | 2 +- .../android/android_surface_gl_impeller.cc | 6 +++--- .../android/android_surface_gl_impeller.h | 2 +- .../android/android_surface_gl_skia.cc | 2 +- .../android/android_surface_gl_skia.h | 5 +++-- .../android/android_surface_software.cc | 12 +++++++---- .../android/android_surface_software.h | 5 +++-- shell/platform/android/apk_asset_provider.cc | 3 ++- shell/platform/android/flutter_main.cc | 16 +++++++-------- shell/platform/android/flutter_main.h | 2 +- .../platform_message_handler_android.cc | 6 ++++-- .../platform_message_response_android.cc | 4 +++- .../platform/android/platform_view_android.cc | 20 +++++++++---------- .../platform/android/platform_view_android.h | 6 +++--- .../android/platform_view_android_jni_impl.cc | 9 +++++---- .../android/platform_view_android_jni_impl.h | 2 +- .../platform/android/vsync_waiter_android.cc | 4 ++-- shell/platform/android/vsync_waiter_android.h | 2 +- vulkan/vulkan_swapchain.cc | 9 +++++---- vulkan/vulkan_swapchain.h | 2 +- 43 files changed, 116 insertions(+), 94 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 9103fd70bd432..6bd27668fd974 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -28,7 +28,8 @@ clang-analyzer-*,\ readability-identifier-naming,\ clang-diagnostic-*,\ google-objc-*,\ -google-explicit-constructor" +google-explicit-constructor,\ +performance-unnecessary-value-param" CheckOptions: - key: modernize-use-default-member-init.UseAssignment diff --git a/ci/lint.sh b/ci/lint.sh index e5096b3518947..47f854135d5d8 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -34,8 +34,9 @@ DART_BIN="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk/bin" DART="${DART_BIN}/dart" # TODO(https://github.com/flutter/flutter/issues/113848): Migrate all platforms # to have this as an error. -MAC_HOST_WARNINGS_AS_ERRORS="performance-move-const-arg,performance-unnecessary-value-param" +MAC_HOST_WARNINGS_AS_ERRORS="performance-move-const-arg" +FLUTTER_LINT_PRINT_FIX=1 # FLUTTER_LINT_PRINT_FIX will make it so that fix is executed and the generated # diff is printed to stdout if clang-tidy fails. This is helpful for enabling # new lints. diff --git a/fml/platform/android/jni_weak_ref.cc b/fml/platform/android/jni_weak_ref.cc index 70ff1b27ccab2..468d44b3a4307 100644 --- a/fml/platform/android/jni_weak_ref.cc +++ b/fml/platform/android/jni_weak_ref.cc @@ -54,12 +54,14 @@ ScopedJavaLocalRef GetRealObject(JNIEnv* env, jweak obj) { } void JavaObjectWeakGlobalRef::Assign(const JavaObjectWeakGlobalRef& other) { - if (&other == this) + if (&other == this) { return; + } JNIEnv* env = AttachCurrentThread(); - if (obj_) + if (obj_) { env->DeleteWeakGlobalRef(obj_); + } obj_ = other.obj_ ? env->NewWeakGlobalRef(other.obj_) : NULL; } diff --git a/impeller/renderer/backend/vulkan/command_buffer_vk.cc b/impeller/renderer/backend/vulkan/command_buffer_vk.cc index 048bac07dacf8..af8ab6d6b9c1e 100644 --- a/impeller/renderer/backend/vulkan/command_buffer_vk.cc +++ b/impeller/renderer/backend/vulkan/command_buffer_vk.cc @@ -4,6 +4,8 @@ #include "impeller/renderer/backend/vulkan/command_buffer_vk.h" +#include + #include "flutter/fml/logging.h" #include "impeller/base/validation.h" #include "impeller/renderer/backend/vulkan/context_vk.h" @@ -15,7 +17,7 @@ namespace impeller { std::shared_ptr CommandBufferVK::Create( - std::weak_ptr context, + const std::weak_ptr& context, vk::Device device, vk::CommandPool command_pool, SurfaceProducerVK* surface_producer) { @@ -41,7 +43,7 @@ CommandBufferVK::CommandBufferVK(std::weak_ptr context, SurfaceProducerVK* surface_producer, vk::CommandPool command_pool, vk::UniqueCommandBuffer command_buffer) - : CommandBuffer(context), + : CommandBuffer(std::move(context)), device_(device), command_pool_(command_pool), command_buffer_(std::move(command_buffer)), diff --git a/impeller/renderer/backend/vulkan/command_buffer_vk.h b/impeller/renderer/backend/vulkan/command_buffer_vk.h index 4fc05036ec41d..2b004071d683e 100644 --- a/impeller/renderer/backend/vulkan/command_buffer_vk.h +++ b/impeller/renderer/backend/vulkan/command_buffer_vk.h @@ -14,7 +14,7 @@ namespace impeller { class CommandBufferVK final : public CommandBuffer { public: static std::shared_ptr Create( - std::weak_ptr context, + const std::weak_ptr& context, vk::Device device, vk::CommandPool command_pool, SurfaceProducerVK* surface_producer); diff --git a/impeller/renderer/backend/vulkan/device_buffer_vk.cc b/impeller/renderer/backend/vulkan/device_buffer_vk.cc index 02e7eea14ca9d..3951864d701fe 100644 --- a/impeller/renderer/backend/vulkan/device_buffer_vk.cc +++ b/impeller/renderer/backend/vulkan/device_buffer_vk.cc @@ -39,7 +39,7 @@ DeviceBufferVK::DeviceBufferVK( DeviceBufferDescriptor desc, ContextVK& context, std::unique_ptr device_allocation) - : DeviceBuffer(std::move(desc)), + : DeviceBuffer(desc), context_(context), device_allocation_(std::move(device_allocation)) {} diff --git a/impeller/renderer/backend/vulkan/pipeline_vk.cc b/impeller/renderer/backend/vulkan/pipeline_vk.cc index c467f71c60bbc..b24a7acf67a6c 100644 --- a/impeller/renderer/backend/vulkan/pipeline_vk.cc +++ b/impeller/renderer/backend/vulkan/pipeline_vk.cc @@ -40,9 +40,9 @@ vk::DescriptorSetLayout PipelineCreateInfoVK::GetDescriptorSetLayout() const { } PipelineVK::PipelineVK(std::weak_ptr library, - PipelineDescriptor desc, + const PipelineDescriptor& desc, std::unique_ptr create_info) - : Pipeline(std::move(library), std::move(desc)), + : Pipeline(std::move(library), desc), pipeline_info_(std::move(create_info)) {} PipelineVK::~PipelineVK() = default; diff --git a/impeller/renderer/backend/vulkan/pipeline_vk.h b/impeller/renderer/backend/vulkan/pipeline_vk.h index ed834ada5005b..ce7b988d44d58 100644 --- a/impeller/renderer/backend/vulkan/pipeline_vk.h +++ b/impeller/renderer/backend/vulkan/pipeline_vk.h @@ -43,7 +43,7 @@ class PipelineVK final public BackendCast> { public: PipelineVK(std::weak_ptr library, - PipelineDescriptor desc, + const PipelineDescriptor& desc, std::unique_ptr create_info); // |Pipeline| diff --git a/impeller/renderer/backend/vulkan/surface_producer_vk.cc b/impeller/renderer/backend/vulkan/surface_producer_vk.cc index e92c27617d442..b3a0f7a0f79de 100644 --- a/impeller/renderer/backend/vulkan/surface_producer_vk.cc +++ b/impeller/renderer/backend/vulkan/surface_producer_vk.cc @@ -5,6 +5,7 @@ #include "impeller/renderer/backend/vulkan/surface_producer_vk.h" #include +#include #include "impeller/base/validation.h" #include "impeller/renderer/backend/vulkan/surface_vk.h" @@ -13,7 +14,7 @@ namespace impeller { std::unique_ptr SurfaceProducerVK::Create( - std::weak_ptr context, + const std::weak_ptr& context, const SurfaceProducerCreateInfoVK& create_info) { auto surface_producer = std::make_unique(context, create_info); @@ -28,7 +29,7 @@ std::unique_ptr SurfaceProducerVK::Create( SurfaceProducerVK::SurfaceProducerVK( std::weak_ptr context, const SurfaceProducerCreateInfoVK& create_info) - : context_(context), create_info_(create_info) {} + : context_(std::move(context)), create_info_(create_info) {} SurfaceProducerVK::~SurfaceProducerVK() = default; diff --git a/impeller/renderer/backend/vulkan/surface_producer_vk.h b/impeller/renderer/backend/vulkan/surface_producer_vk.h index 4850b5580f9ee..2b8a823bf723c 100644 --- a/impeller/renderer/backend/vulkan/surface_producer_vk.h +++ b/impeller/renderer/backend/vulkan/surface_producer_vk.h @@ -33,7 +33,7 @@ class SurfaceSyncObjectsVK { class SurfaceProducerVK { public: static std::unique_ptr Create( - std::weak_ptr context, + const std::weak_ptr& context, const SurfaceProducerCreateInfoVK& create_info); SurfaceProducerVK(std::weak_ptr context, diff --git a/impeller/renderer/backend/vulkan/surface_vk.cc b/impeller/renderer/backend/vulkan/surface_vk.cc index a87dc9af0daed..d3963fb7d5b30 100644 --- a/impeller/renderer/backend/vulkan/surface_vk.cc +++ b/impeller/renderer/backend/vulkan/surface_vk.cc @@ -34,7 +34,7 @@ std::unique_ptr SurfaceVK::WrapSwapchainImage( .frame_num = frame_num, }, }); - color0.texture = std::make_shared(std::move(color0_tex), context, + color0.texture = std::make_shared(color0_tex, context, std::move(color_texture_info)); color0.clear_color = Color::DarkSlateGray(); color0.load_action = LoadAction::kClear; @@ -59,19 +59,18 @@ std::unique_ptr SurfaceVK::WrapSwapchainImage( }, }); stencil0.texture = std::make_shared( - std::move(stencil0_tex), context, std::move(stencil_texture_info)); + stencil0_tex, context, std::move(stencil_texture_info)); stencil0.load_action = LoadAction::kClear; stencil0.store_action = StoreAction::kDontCare; RenderTarget render_target_desc; render_target_desc.SetColorAttachment(color0, 0u); - return std::unique_ptr(new SurfaceVK(std::move(render_target_desc), - swapchain_image, - std::move(swap_callback))); + return std::unique_ptr(new SurfaceVK( + render_target_desc, swapchain_image, std::move(swap_callback))); } -SurfaceVK::SurfaceVK(RenderTarget target, +SurfaceVK::SurfaceVK(const RenderTarget& target, SwapchainImageVK* swapchain_image, SwapCallback swap_callback) : Surface(target) { diff --git a/impeller/renderer/backend/vulkan/surface_vk.h b/impeller/renderer/backend/vulkan/surface_vk.h index fd5ff489385b5..77d6367e3a647 100644 --- a/impeller/renderer/backend/vulkan/surface_vk.h +++ b/impeller/renderer/backend/vulkan/surface_vk.h @@ -23,7 +23,7 @@ class SurfaceVK final : public Surface { ContextVK* context, SwapCallback swap_callback); - SurfaceVK(RenderTarget target, + SurfaceVK(const RenderTarget& target, SwapchainImageVK* swapchain_image, SwapCallback swap_callback); diff --git a/impeller/toolkit/egl/config.cc b/impeller/toolkit/egl/config.cc index c52ed48534990..be42642bc446b 100644 --- a/impeller/toolkit/egl/config.cc +++ b/impeller/toolkit/egl/config.cc @@ -10,7 +10,7 @@ namespace impeller { namespace egl { Config::Config(ConfigDescriptor descriptor, EGLConfig config) - : desc_(std::move(descriptor)), config_(config) {} + : desc_(descriptor), config_(config) {} Config::~Config() = default; diff --git a/impeller/toolkit/egl/context.cc b/impeller/toolkit/egl/context.cc index c89971c7fb6fd..c2d0ecd759a1b 100644 --- a/impeller/toolkit/egl/context.cc +++ b/impeller/toolkit/egl/context.cc @@ -72,7 +72,7 @@ bool Context::ClearCurrent() const { } std::optional Context::AddLifecycleListener( - LifecycleListener listener) { + const LifecycleListener& listener) { if (!listener) { return std::nullopt; } diff --git a/impeller/toolkit/egl/context.h b/impeller/toolkit/egl/context.h index 19d4a25181885..5a6f37f4f9873 100644 --- a/impeller/toolkit/egl/context.h +++ b/impeller/toolkit/egl/context.h @@ -35,7 +35,8 @@ class Context { kWillClearCurrent, }; using LifecycleListener = std::function; - std::optional AddLifecycleListener(LifecycleListener listener); + std::optional AddLifecycleListener( + const LifecycleListener& listener); bool RemoveLifecycleListener(UniqueID id); diff --git a/impeller/toolkit/egl/display.cc b/impeller/toolkit/egl/display.cc index 2afb265c9f679..b1c4fca1a309e 100644 --- a/impeller/toolkit/egl/display.cc +++ b/impeller/toolkit/egl/display.cc @@ -166,7 +166,7 @@ std::unique_ptr Display::ChooseConfig(ConfigDescriptor config) const { return nullptr; } - return std::make_unique(std::move(config), config_out); + return std::make_unique(config, config_out); } std::unique_ptr Display::CreateWindowSurface( diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index df5f74bd46c09..4de6f50aca410 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -215,7 +215,7 @@ void UIDartState::LogMessage(const std::string& tag, // Fall back to previous behavior if unspecified. #if defined(FML_OS_ANDROID) __android_log_print(ANDROID_LOG_INFO, tag.c_str(), "%.*s", - (int)message.size(), message.c_str()); + static_cast(message.size()), message.c_str()); #elif defined(FML_OS_IOS) std::stringstream stream; if (!tag.empty()) { diff --git a/shell/platform/android/android_context_gl_skia.cc b/shell/platform/android/android_context_gl_skia.cc index 1af21c40cde30..adc29695d7347 100644 --- a/shell/platform/android/android_context_gl_skia.cc +++ b/shell/platform/android/android_context_gl_skia.cc @@ -70,7 +70,7 @@ AndroidContextGLSkia::AndroidContextGLSkia( const TaskRunners& task_runners, uint8_t msaa_samples) : AndroidContext(AndroidRenderingAPI::kOpenGLES), - environment_(environment), + environment_(std::move(environment)), config_(nullptr), task_runners_(task_runners) { if (!environment_->IsValid()) { @@ -146,7 +146,7 @@ AndroidContextGLSkia::~AndroidContextGLSkia() { } std::unique_ptr AndroidContextGLSkia::CreateOnscreenSurface( - fml::RefPtr window) const { + const fml::RefPtr& window) const { if (window->IsFakeWindow()) { return CreatePbufferSurface(); } else { diff --git a/shell/platform/android/android_context_gl_skia.h b/shell/platform/android/android_context_gl_skia.h index f3e9ff9f2ef02..145be6144b218 100644 --- a/shell/platform/android/android_context_gl_skia.h +++ b/shell/platform/android/android_context_gl_skia.h @@ -41,7 +41,7 @@ class AndroidContextGLSkia : public AndroidContext { /// @return The window surface. /// std::unique_ptr CreateOnscreenSurface( - fml::RefPtr window) const; + const fml::RefPtr& window) const; //---------------------------------------------------------------------------- /// @brief Allocates an 1x1 pbuffer surface that is used for making the diff --git a/shell/platform/android/android_external_texture_gl.cc b/shell/platform/android/android_external_texture_gl.cc index 2a58de3a96171..03c03a5c327ec 100644 --- a/shell/platform/android/android_external_texture_gl.cc +++ b/shell/platform/android/android_external_texture_gl.cc @@ -6,6 +6,8 @@ #include +#include + #include "third_party/skia/include/core/SkAlphaType.h" #include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkColorType.h" @@ -20,7 +22,7 @@ AndroidExternalTextureGL::AndroidExternalTextureGL( const fml::jni::ScopedJavaGlobalRef& surface_texture, std::shared_ptr jni_facade) : Texture(id), - jni_facade_(jni_facade), + jni_facade_(std::move(jni_facade)), surface_texture_(surface_texture), transform(SkMatrix::I()) {} diff --git a/shell/platform/android/android_image_generator.cc b/shell/platform/android/android_image_generator.cc index 924d2fa5d6b6b..714eef933b145 100644 --- a/shell/platform/android/android_image_generator.cc +++ b/shell/platform/android/android_image_generator.cc @@ -5,6 +5,7 @@ #include "flutter/shell/platform/android/android_image_generator.h" #include +#include #include #include @@ -21,7 +22,7 @@ static jmethodID g_decode_image_method = nullptr; AndroidImageGenerator::~AndroidImageGenerator() = default; AndroidImageGenerator::AndroidImageGenerator(sk_sp data) - : data_(data), image_info_(SkImageInfo::MakeUnknown(-1, -1)) {} + : data_(std::move(data)), image_info_(SkImageInfo::MakeUnknown(-1, -1)) {} const SkImageInfo& AndroidImageGenerator::GetInfo() { header_decoded_latch_.Wait(); @@ -173,7 +174,7 @@ bool AndroidImageGenerator::Register(JNIEnv* env) { std::shared_ptr AndroidImageGenerator::MakeFromData( sk_sp data, - fml::RefPtr task_runner) { + const fml::RefPtr& task_runner) { std::shared_ptr generator( new AndroidImageGenerator(std::move(data))); diff --git a/shell/platform/android/android_image_generator.h b/shell/platform/android/android_image_generator.h index ce62163a88f3c..6d13c94116492 100644 --- a/shell/platform/android/android_image_generator.h +++ b/shell/platform/android/android_image_generator.h @@ -50,7 +50,7 @@ class AndroidImageGenerator : public ImageGenerator { static std::shared_ptr MakeFromData( sk_sp data, - fml::RefPtr task_runner); + const fml::RefPtr& task_runner); static void NativeImageHeaderCallback(JNIEnv* env, jclass jcaller, diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index 1e5b9e95c05ee..79605a574345f 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -78,9 +78,9 @@ static PlatformData GetDefaultPlatformData() { } AndroidShellHolder::AndroidShellHolder( - flutter::Settings settings, + const flutter::Settings& settings, std::shared_ptr jni_facade) - : settings_(std::move(settings)), jni_facade_(jni_facade) { + : settings_(settings), jni_facade_(jni_facade) { static size_t thread_host_count = 1; auto thread_label = std::to_string(thread_host_count++); @@ -164,7 +164,7 @@ AndroidShellHolder::AndroidShellHolder( shell_->RegisterImageDecoder( [runner = task_runners.GetIOTaskRunner()](sk_sp buffer) { - return AndroidImageGenerator::MakeFromData(buffer, runner); + return AndroidImageGenerator::MakeFromData(std::move(buffer), runner); }, -1); FML_DLOG(INFO) << "Registered Android SDK image decoder (API level 28+)"; @@ -181,7 +181,7 @@ AndroidShellHolder::AndroidShellHolder( const std::shared_ptr& thread_host, std::unique_ptr shell, const fml::WeakPtr& platform_view) - : settings_(std::move(settings)), + : settings_(settings), jni_facade_(jni_facade), platform_view_(platform_view), thread_host_(thread_host), @@ -335,13 +335,12 @@ std::optional AndroidShellHolder::BuildRunConfiguration( { if (!entrypoint.empty() && !libraryUrl.empty()) { - config.SetEntrypointAndLibrary(std::move(entrypoint), - std::move(libraryUrl)); + config.SetEntrypointAndLibrary(entrypoint, libraryUrl); } else if (!entrypoint.empty()) { - config.SetEntrypoint(std::move(entrypoint)); + config.SetEntrypoint(entrypoint); } if (!entrypoint_args.empty()) { - config.SetEntrypointArgs(std::move(entrypoint_args)); + config.SetEntrypointArgs(entrypoint_args); } } return config; diff --git a/shell/platform/android/android_shell_holder.h b/shell/platform/android/android_shell_holder.h index bf14db6a24237..36c0b9629f34b 100644 --- a/shell/platform/android/android_shell_holder.h +++ b/shell/platform/android/android_shell_holder.h @@ -41,7 +41,7 @@ namespace flutter { /// class AndroidShellHolder { public: - AndroidShellHolder(flutter::Settings settings, + AndroidShellHolder(const flutter::Settings& settings, std::shared_ptr jni_facade); ~AndroidShellHolder(); diff --git a/shell/platform/android/android_surface_gl_impeller.cc b/shell/platform/android/android_surface_gl_impeller.cc index 635acc77a9502..89cbf668a7d16 100644 --- a/shell/platform/android/android_surface_gl_impeller.cc +++ b/shell/platform/android/android_surface_gl_impeller.cc @@ -46,7 +46,7 @@ class AndroidSurfaceGLImpeller::ReactorWorker final }; static std::shared_ptr CreateImpellerContext( - std::shared_ptr worker) { + const std::shared_ptr& worker) { auto proc_table = std::make_unique( impeller::egl::CreateProcAddressResolver()); @@ -68,7 +68,7 @@ static std::shared_ptr CreateImpellerContext( return nullptr; } - if (!context->AddReactorWorker(std::move(worker)).has_value()) { + if (!context->AddReactorWorker(worker).has_value()) { FML_LOG(ERROR) << "Could not add reactor worker."; return nullptr; } @@ -78,7 +78,7 @@ static std::shared_ptr CreateImpellerContext( AndroidSurfaceGLImpeller::AndroidSurfaceGLImpeller( const std::shared_ptr& android_context, - std::shared_ptr jni_facade) + const std::shared_ptr& jni_facade) : AndroidSurface(android_context), reactor_worker_(std::shared_ptr(new ReactorWorker())) { auto display = std::make_unique(); diff --git a/shell/platform/android/android_surface_gl_impeller.h b/shell/platform/android/android_surface_gl_impeller.h index 9d2399868da97..b8ca423072f60 100644 --- a/shell/platform/android/android_surface_gl_impeller.h +++ b/shell/platform/android/android_surface_gl_impeller.h @@ -19,7 +19,7 @@ class AndroidSurfaceGLImpeller final : public GPUSurfaceGLDelegate, public: AndroidSurfaceGLImpeller( const std::shared_ptr& android_context, - std::shared_ptr jni_facade); + const std::shared_ptr& jni_facade); // |AndroidSurface| ~AndroidSurfaceGLImpeller() override; diff --git a/shell/platform/android/android_surface_gl_skia.cc b/shell/platform/android/android_surface_gl_skia.cc index f4e3d5acd24c3..343d691e2ae75 100644 --- a/shell/platform/android/android_surface_gl_skia.cc +++ b/shell/platform/android/android_surface_gl_skia.cc @@ -22,7 +22,7 @@ constexpr char kEmulatorRendererPrefix[] = AndroidSurfaceGLSkia::AndroidSurfaceGLSkia( const std::shared_ptr& android_context, - std::shared_ptr jni_facade) + const std::shared_ptr& jni_facade) : AndroidSurface(android_context), native_window_(nullptr), onscreen_surface_(nullptr), diff --git a/shell/platform/android/android_surface_gl_skia.h b/shell/platform/android/android_surface_gl_skia.h index 73f36945127f8..274c28f2c6760 100644 --- a/shell/platform/android/android_surface_gl_skia.h +++ b/shell/platform/android/android_surface_gl_skia.h @@ -21,8 +21,9 @@ namespace flutter { class AndroidSurfaceGLSkia final : public GPUSurfaceGLDelegate, public AndroidSurface { public: - AndroidSurfaceGLSkia(const std::shared_ptr& android_context, - std::shared_ptr jni_facade); + AndroidSurfaceGLSkia( + const std::shared_ptr& android_context, + const std::shared_ptr& jni_facade); ~AndroidSurfaceGLSkia() override; diff --git a/shell/platform/android/android_surface_software.cc b/shell/platform/android/android_surface_software.cc index 3c85cd175c59b..164049d9d9bde 100644 --- a/shell/platform/android/android_surface_software.cc +++ b/shell/platform/android/android_surface_software.cc @@ -40,7 +40,7 @@ bool GetSkColorType(int32_t buffer_format, AndroidSurfaceSoftware::AndroidSurfaceSoftware( const std::shared_ptr& android_context, - std::shared_ptr jni_facade) + const std::shared_ptr& jni_facade) : AndroidSurface(android_context) { GetSkColorType(WINDOW_FORMAT_RGBA_8888, &target_color_type_, &target_alpha_type_); @@ -153,13 +153,17 @@ bool AndroidSurfaceSoftware::OnScreenSurfaceResize(const SkISize& size) { bool AndroidSurfaceSoftware::SetNativeWindow( fml::RefPtr window) { native_window_ = std::move(window); - if (!(native_window_ && native_window_->IsValid())) + if (!(native_window_ && native_window_->IsValid())) { return false; + } int32_t window_format = ANativeWindow_getFormat(native_window_->handle()); - if (window_format < 0) + if (window_format < 0) { return false; - if (!GetSkColorType(window_format, &target_color_type_, &target_alpha_type_)) + } + if (!GetSkColorType(window_format, &target_color_type_, + &target_alpha_type_)) { return false; + } return true; } diff --git a/shell/platform/android/android_surface_software.h b/shell/platform/android/android_surface_software.h index 151c05c15a310..1ea3fe8637132 100644 --- a/shell/platform/android/android_surface_software.h +++ b/shell/platform/android/android_surface_software.h @@ -17,8 +17,9 @@ namespace flutter { class AndroidSurfaceSoftware final : public AndroidSurface, public GPUSurfaceSoftwareDelegate { public: - AndroidSurfaceSoftware(const std::shared_ptr& android_context, - std::shared_ptr jni_facade); + AndroidSurfaceSoftware( + const std::shared_ptr& android_context, + const std::shared_ptr& jni_facade); ~AndroidSurfaceSoftware() override; diff --git a/shell/platform/android/apk_asset_provider.cc b/shell/platform/android/apk_asset_provider.cc index f0670fa84801d..663ca6df263b5 100644 --- a/shell/platform/android/apk_asset_provider.cc +++ b/shell/platform/android/apk_asset_provider.cc @@ -8,6 +8,7 @@ #include #include +#include #include "flutter/fml/logging.h" @@ -75,7 +76,7 @@ APKAssetProvider::APKAssetProvider(JNIEnv* env, APKAssetProvider::APKAssetProvider( std::shared_ptr impl) - : impl_(impl) {} + : impl_(std::move(impl)) {} // |AssetResolver| bool APKAssetProvider::IsValid() const { diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index 99c7d052df26d..bf4930b1f1082 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -58,8 +58,8 @@ fml::jni::ScopedJavaGlobalRef* g_flutter_jni_class = nullptr; } // anonymous namespace -FlutterMain::FlutterMain(flutter::Settings settings) - : settings_(std::move(settings)), observatory_uri_callback_() {} +FlutterMain::FlutterMain(const flutter::Settings& settings) + : settings_(settings), observatory_uri_callback_() {} FlutterMain::~FlutterMain() = default; @@ -133,8 +133,8 @@ void FlutterMain::Init(JNIEnv* env, } } - settings.task_observer_add = [](intptr_t key, fml::closure callback) { - fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback)); + settings.task_observer_add = [](intptr_t key, const fml::closure& callback) { + fml::MessageLoop::GetCurrent().AddTaskObserver(key, callback); }; settings.task_observer_remove = [](intptr_t key) { @@ -144,7 +144,7 @@ void FlutterMain::Init(JNIEnv* env, settings.log_message_callback = [](const std::string& tag, const std::string& message) { __android_log_print(ANDROID_LOG_INFO, tag.c_str(), "%.*s", - (int)message.size(), message.c_str()); + static_cast(message.size()), message.c_str()); }; #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG @@ -162,7 +162,7 @@ void FlutterMain::Init(JNIEnv* env, // Not thread safe. Will be removed when FlutterMain is refactored to no // longer be a singleton. - g_flutter_main.reset(new FlutterMain(std::move(settings))); + g_flutter_main.reset(new FlutterMain(settings)); g_flutter_main->SetupObservatoryUriCallback(env); } @@ -179,7 +179,7 @@ void FlutterMain::SetupObservatoryUriCallback(JNIEnv* env) { return; } - auto set_uri = [env, uri_field](std::string uri) { + auto set_uri = [env, uri_field](const std::string& uri) { fml::jni::ScopedJavaLocalRef java_uri = fml::jni::StringToJavaString(env, uri); env->SetStaticObjectField(g_flutter_jni_class->obj(), uri_field, @@ -191,7 +191,7 @@ void FlutterMain::SetupObservatoryUriCallback(JNIEnv* env) { fml::MessageLoop::GetCurrent().GetTaskRunner(); observatory_uri_callback_ = DartServiceIsolate::AddServerStatusCallback( - [platform_runner, set_uri](std::string uri) { + [platform_runner, set_uri](const std::string& uri) { platform_runner->PostTask([uri, set_uri] { set_uri(uri); }); }); } diff --git a/shell/platform/android/flutter_main.h b/shell/platform/android/flutter_main.h index 32a1efe806a5b..b956377c8e295 100644 --- a/shell/platform/android/flutter_main.h +++ b/shell/platform/android/flutter_main.h @@ -27,7 +27,7 @@ class FlutterMain { const flutter::Settings settings_; DartServiceIsolate::CallbackHandle observatory_uri_callback_; - explicit FlutterMain(flutter::Settings settings); + explicit FlutterMain(const flutter::Settings& settings); static void Init(JNIEnv* env, jclass clazz, diff --git a/shell/platform/android/platform_message_handler_android.cc b/shell/platform/android/platform_message_handler_android.cc index 8440898be9906..937f0c95f588e 100644 --- a/shell/platform/android/platform_message_handler_android.cc +++ b/shell/platform/android/platform_message_handler_android.cc @@ -20,8 +20,9 @@ void PlatformMessageHandlerAndroid::InvokePlatformMessageResponseCallback( { std::lock_guard lock(pending_responses_mutex_); auto it = pending_responses_.find(response_id); - if (it == pending_responses_.end()) + if (it == pending_responses_.end()) { return; + } message_response = std::move(it->second); pending_responses_.erase(it); } @@ -39,8 +40,9 @@ void PlatformMessageHandlerAndroid::InvokePlatformMessageEmptyResponseCallback( { std::lock_guard lock(pending_responses_mutex_); auto it = pending_responses_.find(response_id); - if (it == pending_responses_.end()) + if (it == pending_responses_.end()) { return; + } message_response = std::move(it->second); pending_responses_.erase(it); } diff --git a/shell/platform/android/platform_message_response_android.cc b/shell/platform/android/platform_message_response_android.cc index 36950caf43942..6c88b85e6e32d 100644 --- a/shell/platform/android/platform_message_response_android.cc +++ b/shell/platform/android/platform_message_response_android.cc @@ -4,6 +4,8 @@ #include "flutter/shell/platform/android/platform_message_response_android.h" +#include + #include "flutter/fml/make_copyable.h" #include "flutter/shell/platform/android/jni/platform_view_android_jni.h" @@ -14,7 +16,7 @@ PlatformMessageResponseAndroid::PlatformMessageResponseAndroid( std::shared_ptr jni_facade, fml::RefPtr platform_task_runner) : response_id_(response_id), - jni_facade_(jni_facade), + jni_facade_(std::move(jni_facade)), platform_task_runner_(std::move(platform_task_runner)) {} PlatformMessageResponseAndroid::~PlatformMessageResponseAndroid() = default; diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index eec2de08dbf80..f4b02c3251482 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -32,7 +32,7 @@ AndroidSurfaceFactoryImpl::AndroidSurfaceFactoryImpl( std::shared_ptr jni_facade, bool enable_impeller) : android_context_(context), - jni_facade_(jni_facade), + jni_facade_(std::move(jni_facade)), enable_impeller_(enable_impeller) {} AndroidSurfaceFactoryImpl::~AndroidSurfaceFactoryImpl() = default; @@ -65,7 +65,7 @@ std::unique_ptr AndroidSurfaceFactoryImpl::CreateSurface() { static std::shared_ptr CreateAndroidContext( bool use_software_rendering, - const flutter::TaskRunners task_runners, + const flutter::TaskRunners& task_runners, uint8_t msaa_samples, bool enable_impeller) { if (use_software_rendering) { @@ -84,14 +84,14 @@ static std::shared_ptr CreateAndroidContext( PlatformViewAndroid::PlatformViewAndroid( PlatformView::Delegate& delegate, - flutter::TaskRunners task_runners, - std::shared_ptr jni_facade, + const flutter::TaskRunners& task_runners, + const std::shared_ptr& jni_facade, bool use_software_rendering, uint8_t msaa_samples) : PlatformViewAndroid( delegate, - std::move(task_runners), - std::move(jni_facade), + task_runners, + jni_facade, CreateAndroidContext( use_software_rendering, task_runners, @@ -100,12 +100,12 @@ PlatformViewAndroid::PlatformViewAndroid( PlatformViewAndroid::PlatformViewAndroid( PlatformView::Delegate& delegate, - flutter::TaskRunners task_runners, + const flutter::TaskRunners& task_runners, const std::shared_ptr& jni_facade, const std::shared_ptr& android_context) - : PlatformView(delegate, std::move(task_runners)), + : PlatformView(delegate, task_runners), jni_facade_(jni_facade), - android_context_(std::move(android_context)), + android_context_(android_context), platform_view_android_delegate_(jni_facade), platform_message_handler_(new PlatformMessageHandlerAndroid(jni_facade)) { if (android_context_) { @@ -267,7 +267,7 @@ void PlatformViewAndroid::RegisterExternalTexture( const fml::jni::ScopedJavaGlobalRef& surface_texture) { if (android_context_->RenderingApi() == AndroidRenderingAPI::kOpenGLES) { RegisterTexture(std::make_shared( - texture_id, surface_texture, std::move(jni_facade_))); + texture_id, surface_texture, jni_facade_)); } else { FML_LOG(INFO) << "Attempted to use a GL texture in a non GL context."; } diff --git a/shell/platform/android/platform_view_android.h b/shell/platform/android/platform_view_android.h index e03d4c54b7de5..536cb1d20f722 100644 --- a/shell/platform/android/platform_view_android.h +++ b/shell/platform/android/platform_view_android.h @@ -45,8 +45,8 @@ class PlatformViewAndroid final : public PlatformView { static bool Register(JNIEnv* env); PlatformViewAndroid(PlatformView::Delegate& delegate, - flutter::TaskRunners task_runners, - std::shared_ptr jni_facade, + const flutter::TaskRunners& task_runners, + const std::shared_ptr& jni_facade, bool use_software_rendering, uint8_t msaa_samples); @@ -57,7 +57,7 @@ class PlatformViewAndroid final : public PlatformView { /// PlatformViewAndroid( PlatformView::Delegate& delegate, - flutter::TaskRunners task_runners, + const flutter::TaskRunners& task_runners, const std::shared_ptr& jni_facade, const std::shared_ptr& android_context); diff --git a/shell/platform/android/platform_view_android_jni_impl.cc b/shell/platform/android/platform_view_android_jni_impl.cc index 9cc05789d943a..031ec1057eb22 100644 --- a/shell/platform/android/platform_view_android_jni_impl.cc +++ b/shell/platform/android/platform_view_android_jni_impl.cc @@ -541,7 +541,7 @@ static jboolean FlutterTextUtilsIsRegionalIndicator(JNIEnv* env, } static void LoadLoadingUnitFailure(intptr_t loading_unit_id, - std::string message, + const std::string& message, bool transient) { // TODO(garyq): Implement } @@ -1140,7 +1140,7 @@ bool PlatformViewAndroid::Register(JNIEnv* env) { } PlatformViewAndroidJNIImpl::PlatformViewAndroidJNIImpl( - fml::jni::JavaObjectWeakGlobalRef java_object) + const fml::jni::JavaObjectWeakGlobalRef& java_object) : java_object_(java_object) {} PlatformViewAndroidJNIImpl::~PlatformViewAndroidJNIImpl() = default; @@ -1464,8 +1464,9 @@ void PlatformViewAndroidJNIImpl::FlutterViewOnDisplayPlatformView( env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis); env->CallVoidMethod( mutatorsStack, g_mutators_stack_push_cliprrect_method, - (int)rect.left(), (int)rect.top(), (int)rect.right(), - (int)rect.bottom(), radiisArray.obj()); + static_cast(rect.left()), static_cast(rect.top()), + static_cast(rect.right()), static_cast(rect.bottom()), + radiisArray.obj()); break; } // TODO(cyanglaz): Implement other mutators. diff --git a/shell/platform/android/platform_view_android_jni_impl.h b/shell/platform/android/platform_view_android_jni_impl.h index 4f2102a090db4..b3df5358291fa 100644 --- a/shell/platform/android/platform_view_android_jni_impl.h +++ b/shell/platform/android/platform_view_android_jni_impl.h @@ -17,7 +17,7 @@ namespace flutter { class PlatformViewAndroidJNIImpl final : public PlatformViewAndroidJNI { public: explicit PlatformViewAndroidJNIImpl( - fml::jni::JavaObjectWeakGlobalRef java_object); + const fml::jni::JavaObjectWeakGlobalRef& java_object); ~PlatformViewAndroidJNIImpl() override; diff --git a/shell/platform/android/vsync_waiter_android.cc b/shell/platform/android/vsync_waiter_android.cc index 9198beb32206e..ff9f980e370a5 100644 --- a/shell/platform/android/vsync_waiter_android.cc +++ b/shell/platform/android/vsync_waiter_android.cc @@ -21,8 +21,8 @@ static fml::jni::ScopedJavaGlobalRef* g_vsync_waiter_class = nullptr; static jmethodID g_async_wait_for_vsync_method_ = nullptr; static std::atomic_uint g_refresh_rate_ = 60; -VsyncWaiterAndroid::VsyncWaiterAndroid(flutter::TaskRunners task_runners) - : VsyncWaiter(std::move(task_runners)), +VsyncWaiterAndroid::VsyncWaiterAndroid(const flutter::TaskRunners& task_runners) + : VsyncWaiter(task_runners), use_ndk_choreographer_( AndroidChoreographer::ShouldUseNDKChoreographer()) {} diff --git a/shell/platform/android/vsync_waiter_android.h b/shell/platform/android/vsync_waiter_android.h index 3eef39f116ae3..0d7e383fd0286 100644 --- a/shell/platform/android/vsync_waiter_android.h +++ b/shell/platform/android/vsync_waiter_android.h @@ -20,7 +20,7 @@ class VsyncWaiterAndroid final : public VsyncWaiter { public: static bool Register(JNIEnv* env); - explicit VsyncWaiterAndroid(flutter::TaskRunners task_runners); + explicit VsyncWaiterAndroid(const flutter::TaskRunners& task_runners); ~VsyncWaiterAndroid() override; diff --git a/vulkan/vulkan_swapchain.cc b/vulkan/vulkan_swapchain.cc index 7e8126e631f0c..cb8a28fa6b656 100644 --- a/vulkan/vulkan_swapchain.cc +++ b/vulkan/vulkan_swapchain.cc @@ -254,10 +254,11 @@ sk_sp VulkanSwapchain::CreateSkiaSurface( ); } -bool VulkanSwapchain::CreateSwapchainImages(GrDirectContext* skia_context, - SkColorType color_type, - sk_sp color_space, - VkImageUsageFlags usage_flags) { +bool VulkanSwapchain::CreateSwapchainImages( + GrDirectContext* skia_context, + SkColorType color_type, + const sk_sp& color_space, + VkImageUsageFlags usage_flags) { std::vector images = GetImages(); if (images.empty()) { diff --git a/vulkan/vulkan_swapchain.h b/vulkan/vulkan_swapchain.h index 6d3c6788e5da6..5a16747665e25 100644 --- a/vulkan/vulkan_swapchain.h +++ b/vulkan/vulkan_swapchain.h @@ -79,7 +79,7 @@ class VulkanSwapchain { bool CreateSwapchainImages(GrDirectContext* skia_context, SkColorType color_type, - sk_sp color_space, + const sk_sp& color_space, VkImageUsageFlags usage_flags); sk_sp CreateSkiaSurface(GrDirectContext* skia_context, From 1a8e09ff652225839f1ea003cf62671c95e06fe7 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Tue, 8 Nov 2022 15:26:17 -0800 Subject: [PATCH 2/7] linux host additions --- shell/common/rasterizer.cc | 2 +- shell/platform/glfw/event_loop.cc | 3 +-- shell/platform/glfw/flutter_glfw.cc | 6 +++--- shell/platform/glfw/glfw_event_loop.cc | 2 +- shell/platform/glfw/headless_event_loop.cc | 2 +- shell/platform/glfw/key_event_handler.cc | 4 ++-- shell/platform/glfw/system_utils.cc | 2 +- .../linux/fl_key_embedder_responder_test.cc | 4 ++-- .../linux/fl_keyboard_manager_test.cc | 6 +++--- shell/platform/linux/fl_scrolling_manager.cc | 4 ++-- .../linux/fl_scrolling_manager_test.cc | 20 +++++++++++-------- .../linux/fl_text_input_plugin_test.cc | 10 ++++++---- shell/platform/linux/fl_view.cc | 3 ++- shell/platform/linux/testing/mock_engine.cc | 8 ++++---- 14 files changed, 41 insertions(+), 35 deletions(-) diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index cf124ad80476e..f283c4142097a 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -292,7 +292,7 @@ std::unique_ptr Rasterizer::MakeSkiaGpuImage( // I can't seem to get the GPU path working on it. // https://github.com/flutter/flutter/issues/108835 #if FML_OS_LINUX - return MakeBitmapImage(std::move(display_list), image_info); + return MakeBitmapImage(display_list, image_info); #endif std::unique_ptr result; diff --git a/shell/platform/glfw/event_loop.cc b/shell/platform/glfw/event_loop.cc index a5dc89f8ac9cb..966eb39d7b63a 100644 --- a/shell/platform/glfw/event_loop.cc +++ b/shell/platform/glfw/event_loop.cc @@ -11,8 +11,7 @@ namespace flutter { EventLoop::EventLoop(std::thread::id main_thread_id, const TaskExpiredCallback& on_task_expired) - : main_thread_id_(main_thread_id), - on_task_expired_(std::move(on_task_expired)) {} + : main_thread_id_(main_thread_id), on_task_expired_(on_task_expired) {} EventLoop::~EventLoop() = default; diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc index 50eb69ea70001..55015cfec0d0e 100644 --- a/shell/platform/glfw/flutter_glfw.cc +++ b/shell/platform/glfw/flutter_glfw.cc @@ -424,8 +424,8 @@ static void GLFWScrollCallback(GLFWwindow* window, auto* controller = GetWindowController(window); SetEventPhaseFromCursorButtonState(window, &event, controller->buttons); event.signal_kind = FlutterPointerSignalKind::kFlutterPointerSignalKindScroll; - // TODO: See if this can be queried from the OS; this value is chosen - // arbitrarily to get something that feels reasonable. + // TODO(chrome-bot): See if this can be queried from the OS; this value is + // chosen arbitrarily to get something that feels reasonable. const int kScrollOffsetMultiplier = 20; event.scroll_delta_x = delta_x * kScrollOffsetMultiplier; event.scroll_delta_y = -delta_y * kScrollOffsetMultiplier; @@ -596,7 +596,7 @@ static void GLFWErrorCallback(int error_code, const char* description) { // Attempts to load AOT data from the given path, which must be absolute and // non-empty. Logs and returns nullptr on failure. -UniqueAotDataPtr LoadAotData(std::filesystem::path aot_data_path) { +UniqueAotDataPtr LoadAotData(const std::filesystem::path& aot_data_path) { if (aot_data_path.empty()) { std::cerr << "Attempted to load AOT data, but no aot_data_path was provided." diff --git a/shell/platform/glfw/glfw_event_loop.cc b/shell/platform/glfw/glfw_event_loop.cc index 97512b2653a6f..e1209aaf82df2 100644 --- a/shell/platform/glfw/glfw_event_loop.cc +++ b/shell/platform/glfw/glfw_event_loop.cc @@ -13,7 +13,7 @@ namespace flutter { GLFWEventLoop::GLFWEventLoop(std::thread::id main_thread_id, const TaskExpiredCallback& on_task_expired) - : EventLoop(main_thread_id, std::move(on_task_expired)) {} + : EventLoop(main_thread_id, on_task_expired) {} GLFWEventLoop::~GLFWEventLoop() = default; diff --git a/shell/platform/glfw/headless_event_loop.cc b/shell/platform/glfw/headless_event_loop.cc index 23e44637783c9..0dd70a57d019f 100644 --- a/shell/platform/glfw/headless_event_loop.cc +++ b/shell/platform/glfw/headless_event_loop.cc @@ -11,7 +11,7 @@ namespace flutter { HeadlessEventLoop::HeadlessEventLoop(std::thread::id main_thread_id, const TaskExpiredCallback& on_task_expired) - : EventLoop(main_thread_id, std::move(on_task_expired)) {} + : EventLoop(main_thread_id, on_task_expired) {} HeadlessEventLoop::~HeadlessEventLoop() = default; diff --git a/shell/platform/glfw/key_event_handler.cc b/shell/platform/glfw/key_event_handler.cc index 5654ce8e9a999..c6504caa08f98 100644 --- a/shell/platform/glfw/key_event_handler.cc +++ b/shell/platform/glfw/key_event_handler.cc @@ -117,8 +117,8 @@ void KeyEventHandler::KeyboardHook(GLFWwindow* window, int scancode, int action, int mods) { - // TODO: Translate to a cross-platform key code system rather than passing - // the native key code. + // TODO(chrome-bot): Translate to a cross-platform key code system rather than + // passing the native key code. // NOLINTNEXTLINE(clang-analyzer-core.NullDereference) rapidjson::Document event(rapidjson::kObjectType); auto& allocator = event.GetAllocator(); diff --git a/shell/platform/glfw/system_utils.cc b/shell/platform/glfw/system_utils.cc index ed4ca2da66384..515f28e6d05d2 100644 --- a/shell/platform/glfw/system_utils.cc +++ b/shell/platform/glfw/system_utils.cc @@ -59,7 +59,7 @@ int ComputeVariantMask(const LanguageInfo& info) { // For example, "de_DE@euro" would append "de_DE@euro", "de@euro", "de_DE", // and "de". void AppendLocaleVariants(std::vector& languages, - LanguageInfo info) { + const LanguageInfo& info) { int mask = ComputeVariantMask(info); for (int i = mask; i >= 0; --i) { if ((i & ~mask) == 0) { diff --git a/shell/platform/linux/fl_key_embedder_responder_test.cc b/shell/platform/linux/fl_key_embedder_responder_test.cc index 67337b3f32fa2..6b7d0f1c068e2 100644 --- a/shell/platform/linux/fl_key_embedder_responder_test.cc +++ b/shell/platform/linux/fl_key_embedder_responder_test.cc @@ -410,7 +410,7 @@ TEST(FlKeyEmbedderResponderTest, TapNumPadKeysBetweenNumLockEvents) { EXPECT_EQ(record->event->type, kFlutterKeyEventTypeDown); EXPECT_EQ(record->event->physical, kPhysicalNumpad1); EXPECT_EQ(record->event->logical, kLogicalNumpad1); - EXPECT_STREQ(record->event->character, nullptr); // TODO + EXPECT_STREQ(record->event->character, nullptr); // TODO(chrome-bot): EXPECT_EQ(record->event->synthesized, false); invoke_record_callback_and_verify(record, TRUE, &user_data); @@ -482,7 +482,7 @@ TEST(FlKeyEmbedderResponderTest, TapNumPadKeysBetweenNumLockEvents) { EXPECT_EQ(record->event->type, kFlutterKeyEventTypeDown); EXPECT_EQ(record->event->physical, kPhysicalNumpad1); EXPECT_EQ(record->event->logical, kLogicalNumpad1); - EXPECT_STREQ(record->event->character, nullptr); // TODO + EXPECT_STREQ(record->event->character, nullptr); // TODO(chrome-bot): EXPECT_EQ(record->event->synthesized, false); invoke_record_callback_and_verify(record, TRUE, &user_data); diff --git a/shell/platform/linux/fl_keyboard_manager_test.cc b/shell/platform/linux/fl_keyboard_manager_test.cc index f8bf9d1d1bd1b..b9856cedfe506 100644 --- a/shell/platform/linux/fl_keyboard_manager_test.cc +++ b/shell/platform/linux/fl_keyboard_manager_test.cc @@ -449,7 +449,7 @@ class KeyboardTester { void respondToEmbedderCallsWith(bool response) { fl_mock_view_set_embedder_handler( view_, [response, this](const FlutterKeyEvent* event, - AsyncKeyCallback callback) { + const AsyncKeyCallback& callback) { EXPECT_FALSE(during_redispatch_); callback(response); }); @@ -477,7 +477,7 @@ class KeyboardTester { std::vector& storage) { fl_mock_view_set_embedder_handler( view_, [&storage, response, this](const FlutterKeyEvent* event, - AsyncKeyCallback callback) { + const AsyncKeyCallback& callback) { EXPECT_FALSE(during_redispatch_); auto new_event = std::make_unique(*event); char* new_event_character = cloneString(event->character); @@ -493,7 +493,7 @@ class KeyboardTester { void respondToChannelCallsWith(bool response) { fl_mock_key_binary_messenger_set_callback_handler( - view_->messenger, [response, this](AsyncKeyCallback callback) { + view_->messenger, [response, this](const AsyncKeyCallback& callback) { EXPECT_FALSE(during_redispatch_); callback(response); }); diff --git a/shell/platform/linux/fl_scrolling_manager.cc b/shell/platform/linux/fl_scrolling_manager.cc index 54ca4f559cc42..f75efec4440c6 100644 --- a/shell/platform/linux/fl_scrolling_manager.cc +++ b/shell/platform/linux/fl_scrolling_manager.cc @@ -87,8 +87,8 @@ void fl_scrolling_manager_handle_scroll_event(FlScrollingManager* self, scroll_delta_x *= kScrollOffsetMultiplier * scale_factor; scroll_delta_y *= kScrollOffsetMultiplier * scale_factor; - if (gdk_device_get_source(gdk_event_get_source_device((GdkEvent*)event)) == - GDK_SOURCE_TOUCHPAD) { + if (gdk_device_get_source(gdk_event_get_source_device( + reinterpret_cast(event))) == GDK_SOURCE_TOUCHPAD) { scroll_delta_x *= -1; scroll_delta_y *= -1; if (event->is_stop) { diff --git a/shell/platform/linux/fl_scrolling_manager_test.cc b/shell/platform/linux/fl_scrolling_manager_test.cc index 73be92970c008..4f8617a3cdf28 100644 --- a/shell/platform/linux/fl_scrolling_manager_test.cc +++ b/shell/platform/linux/fl_scrolling_manager_test.cc @@ -222,13 +222,14 @@ struct _FakeGdkDevice { GdkInputSource source; }; GdkDevice* makeFakeDevice(GdkInputSource source) { - _FakeGdkDevice* device = (_FakeGdkDevice*)g_malloc0(sizeof(_FakeGdkDevice)); + _FakeGdkDevice* device = + static_cast<_FakeGdkDevice*>(g_malloc0(sizeof(_FakeGdkDevice))); device->source = source; // Bully the type checker - ((GTypeInstance*)device)->g_class = - (GTypeClass*)g_malloc0(sizeof(GTypeClass)); - ((GTypeInstance*)device)->g_class->g_type = GDK_TYPE_DEVICE; - return (GdkDevice*)device; + (reinterpret_cast(device))->g_class = + static_cast(g_malloc0(sizeof(GTypeClass))); + (reinterpret_cast(device))->g_class->g_type = GDK_TYPE_DEVICE; + return reinterpret_cast(device); } TEST(FlScrollingManagerTest, DiscreteDirectionional) { @@ -238,7 +239,8 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) { tester.recordMousePointerCallsTo(mouse_records); tester.recordPointerPanZoomCallsTo(pan_zoom_records); GdkDevice* mouse = makeFakeDevice(GDK_SOURCE_MOUSE); - GdkEventScroll* event = (GdkEventScroll*)gdk_event_new(GDK_SCROLL); + GdkEventScroll* event = + reinterpret_cast(gdk_event_new(GDK_SCROLL)); event->time = 1; event->x = 4.0; event->y = 8.0; @@ -292,7 +294,8 @@ TEST(FlScrollingManagerTest, DiscreteScrolling) { tester.recordMousePointerCallsTo(mouse_records); tester.recordPointerPanZoomCallsTo(pan_zoom_records); GdkDevice* mouse = makeFakeDevice(GDK_SOURCE_MOUSE); - GdkEventScroll* event = (GdkEventScroll*)gdk_event_new(GDK_SCROLL); + GdkEventScroll* event = + reinterpret_cast(gdk_event_new(GDK_SCROLL)); event->time = 1; event->x = 4.0; event->y = 8.0; @@ -318,7 +321,8 @@ TEST(FlScrollingManagerTest, Panning) { tester.recordMousePointerCallsTo(mouse_records); tester.recordPointerPanZoomCallsTo(pan_zoom_records); GdkDevice* touchpad = makeFakeDevice(GDK_SOURCE_TOUCHPAD); - GdkEventScroll* event = (GdkEventScroll*)gdk_event_new(GDK_SCROLL); + GdkEventScroll* event = + reinterpret_cast(gdk_event_new(GDK_SCROLL)); event->time = 1; event->x = 4.0; event->y = 8.0; diff --git a/shell/platform/linux/fl_text_input_plugin_test.cc b/shell/platform/linux/fl_text_input_plugin_test.cc index 8f0c55ccb02ac..6f952d7ede52d 100644 --- a/shell/platform/linux/fl_text_input_plugin_test.cc +++ b/shell/platform/linux/fl_text_input_plugin_test.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/platform/linux/fl_text_input_plugin.h" +#include + #include "flutter/shell/platform/linux/fl_method_codec_private.h" +#include "flutter/shell/platform/linux/fl_text_input_plugin.h" #include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h" #include "flutter/shell/platform/linux/public/flutter_linux/fl_json_method_codec.h" #include "flutter/shell/platform/linux/public/flutter_linux/fl_value.h" @@ -44,7 +46,7 @@ class MethodCallMatcher { explicit MethodCallMatcher(::testing::Matcher name, ::testing::Matcher args) - : name_(name), args_(args) {} + : name_(std::move(name)), args_(std::move(args)) {} bool MatchAndExplain(GBytes* method_call, ::testing::MatchResultListener* result_listener) const { @@ -89,9 +91,9 @@ class MethodCallMatcher { ::testing::Matcher args_; }; -::testing::Matcher MethodCall(std::string name, +::testing::Matcher MethodCall(const std::string& name, ::testing::Matcher args) { - return MethodCallMatcher(::testing::StrEq(name), args); + return MethodCallMatcher(::testing::StrEq(name), std::move(args)); } static FlValue* build_map(std::map args) { diff --git a/shell/platform/linux/fl_view.cc b/shell/platform/linux/fl_view.cc index 4ae2257b31d74..967dd67d7cbce 100644 --- a/shell/platform/linux/fl_view.cc +++ b/shell/platform/linux/fl_view.cc @@ -222,8 +222,9 @@ static void add_pending_child(FlView* self, static GList* find_child(GList* list, GtkWidget* widget) { for (GList* i = list; i; i = i->next) { FlViewChild* child = reinterpret_cast(i->data); - if (child && child->widget == widget) + if (child && child->widget == widget) { return i; + } } return nullptr; } diff --git a/shell/platform/linux/testing/mock_engine.cc b/shell/platform/linux/testing/mock_engine.cc index 69057667e8c39..dc3772e9bac28 100644 --- a/shell/platform/linux/testing/mock_engine.cc +++ b/shell/platform/linux/testing/mock_engine.cc @@ -11,6 +11,7 @@ #include #include +#include #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/linux/fl_method_codec_private.h" @@ -27,7 +28,7 @@ struct _FlutterEngineTexture { }; struct _FlutterEngine { - bool running; + bool running = false; FlutterPlatformMessageCallback platform_message_callback; FlutterTaskRunnerPostTaskCallback platform_post_task_callback; void* user_data; @@ -36,8 +37,7 @@ struct _FlutterEngine { _FlutterEngine(FlutterPlatformMessageCallback platform_message_callback, FlutterTaskRunnerPostTaskCallback platform_post_task_callback, void* user_data) - : running(false), - platform_message_callback(platform_message_callback), + : platform_message_callback(platform_message_callback), platform_post_task_callback(platform_post_task_callback), user_data(user_data) {} }; @@ -52,7 +52,7 @@ struct _FlutterPlatformMessageResponseHandle { explicit _FlutterPlatformMessageResponseHandle(std::string channel) : data_callback(nullptr), user_data(nullptr), - channel(channel), + channel(std::move(channel)), released(false) {} // Constructor for a response handle generated by the shell. From 16db8da6c660d3714495ff53ff27f32c91cd0b1b Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Tue, 8 Nov 2022 16:29:53 -0800 Subject: [PATCH 3/7] ios patch --- lib/ui/ui_dart_state.cc | 3 +- shell/common/shell_io_manager.cc | 2 +- shell/common/shell_io_manager.h | 2 +- .../framework/Source/FlutterDartProject.mm | 4 +-- .../ios/framework/Source/FlutterEngine.mm | 8 +++--- .../Source/FlutterObservatoryPublisher.mm | 2 +- .../framework/Source/FlutterPlatformViews.mm | 14 ++++++---- .../Source/FlutterPlatformViews_Internal.h | 28 ++++++++++--------- .../Source/FlutterPlatformViews_Internal.mm | 8 +++--- .../framework/Source/FlutterViewController.mm | 2 +- .../framework/Source/accessibility_bridge.h | 2 +- .../framework/Source/accessibility_bridge.mm | 11 +++++--- .../ios/framework/Source/vsync_waiter_ios.h | 2 +- .../ios/framework/Source/vsync_waiter_ios.mm | 4 +-- .../darwin/ios/ios_external_texture_metal.h | 2 +- .../darwin/ios/ios_external_texture_metal.mm | 2 +- .../darwin/ios/platform_message_handler_ios.h | 2 +- .../ios/platform_message_handler_ios.mm | 2 +- 18 files changed, 54 insertions(+), 46 deletions(-) diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index 4de6f50aca410..65cef346ec173 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -223,7 +223,8 @@ void UIDartState::LogMessage(const std::string& tag, } stream << message; std::string log = stream.str(); - syslog(1 /* LOG_ALERT */, "%.*s", (int)log.size(), log.c_str()); + syslog(1 /* LOG_ALERT */, "%.*s", static_cast(log.size()), + log.c_str()); #else if (!tag.empty()) { std::cout << tag << ": "; diff --git a/shell/common/shell_io_manager.cc b/shell/common/shell_io_manager.cc index 0338855f27f94..9232db2dd3a58 100644 --- a/shell/common/shell_io_manager.cc +++ b/shell/common/shell_io_manager.cc @@ -14,7 +14,7 @@ namespace flutter { sk_sp ShellIOManager::CreateCompatibleResourceLoadingContext( GrBackend backend, - sk_sp gl_interface) { + const sk_sp& gl_interface) { #if SK_GL if (backend != GrBackend::kOpenGL_GrBackend) { return nullptr; diff --git a/shell/common/shell_io_manager.h b/shell/common/shell_io_manager.h index b4f2dff52e60b..b178541939771 100644 --- a/shell/common/shell_io_manager.h +++ b/shell/common/shell_io_manager.h @@ -22,7 +22,7 @@ class ShellIOManager final : public IOManager { // they so desire. static sk_sp CreateCompatibleResourceLoadingContext( GrBackend backend, - sk_sp gl_interface); + const sk_sp& gl_interface); ShellIOManager( sk_sp resource_context, diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 64c80557c5b1a..d57393db6bba4 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -54,8 +54,8 @@ auto settings = flutter::SettingsFromCommandLine(command_line); - settings.task_observer_add = [](intptr_t key, fml::closure callback) { - fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback)); + settings.task_observer_add = [](intptr_t key, const fml::closure& callback) { + fml::MessageLoop::GetCurrent().AddTaskObserver(key, callback); }; settings.task_observer_remove = [](intptr_t key) { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index bb996706cb36e..9a0352a360604 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -287,7 +287,7 @@ - (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics { if (!self.platformView) { return; } - self.platformView->SetViewportMetrics(std::move(viewportMetrics)); + self.platformView->SetViewportMetrics(viewportMetrics); } - (void)dispatchPointerDataPacket:(std::unique_ptr)packet { @@ -797,9 +797,9 @@ - (BOOL)createShell:(NSString*)entrypoint [UIApplication sharedApplication].applicationState == UIApplicationStateBackground; // Create the shell. This is a blocking operation. std::unique_ptr shell = flutter::Shell::Create( - /*platform_data=*/std::move(platformData), - /*task_runners=*/std::move(task_runners), - /*settings=*/std::move(settings), + /*platform_data=*/platformData, + /*task_runners=*/task_runners, + /*settings=*/settings, /*on_create_platform_view=*/on_create_platform_view, /*on_create_rasterizer=*/on_create_rasterizer, /*is_gpu_disabled=*/_isGpuDisabled); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index 2e6242270a052..9b3c437856c6f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -194,7 +194,7 @@ - (void)dealloc { [_delegate stopService]; [_url release]; - flutter::DartServiceIsolate::RemoveServerStatusCallback(std::move(_callbackHandle)); + flutter::DartServiceIsolate::RemoveServerStatusCallback(_callbackHandle); [super dealloc]; } @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 44f35fc365466..b1c6d74d50254 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -8,6 +8,7 @@ #include #include #include +#include #include "flutter/common/graphics/persistent_cache.h" #include "flutter/flow/rtree.h" @@ -38,7 +39,7 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { std::shared_ptr FlutterPlatformViewLayerPool::GetLayer( GrDirectContext* gr_context, - std::shared_ptr ios_context) { + const std::shared_ptr& ios_context) { if (available_layer_index_ >= layers_.size()) { std::shared_ptr layer; fml::scoped_nsobject overlay_view; @@ -285,7 +286,7 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { const int FlutterPlatformViewsController::kDefaultMergedLeaseDuration; PostPrerollResult FlutterPlatformViewsController::PostPrerollAction( - fml::RefPtr raster_thread_merger) { + const fml::RefPtr& raster_thread_merger) { // TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474 // Rename `has_platform_view` to `view_mutated` when the above issue is resolved. if (!HasPlatformViewThisOrNextFrame()) { @@ -314,14 +315,14 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { void FlutterPlatformViewsController::EndFrame( bool should_resubmit_frame, - fml::RefPtr raster_thread_merger) { + const fml::RefPtr& raster_thread_merger) { if (should_resubmit_frame) { raster_thread_merger->MergeWithLease(kDefaultMergedLeaseDuration); } } void FlutterPlatformViewsController::PushFilterToVisitedPlatformViews( - std::shared_ptr filter, + const std::shared_ptr& filter, const SkRect& filter_rect) { for (int64_t id : visited_platform_views_) { EmbeddedViewParams params = current_composition_params_[id]; @@ -584,7 +585,7 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { } bool FlutterPlatformViewsController::SubmitFrame(GrDirectContext* gr_context, - std::shared_ptr ios_context, + const std::shared_ptr& ios_context, std::unique_ptr frame) { // Any UIKit related code has to run on main thread. FML_DCHECK([[NSThread currentThread] isMainThread]); @@ -734,7 +735,8 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { int64_t view_id, int64_t overlay_id) { FML_DCHECK(flutter_view_); - std::shared_ptr layer = layer_pool_->GetLayer(gr_context, ios_context); + std::shared_ptr layer = + layer_pool_->GetLayer(gr_context, std::move(ios_context)); UIView* overlay_view_wrapper = layer->overlay_view_wrapper.get(); auto screenScale = [UIScreen mainScreen].scale; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 5a66baeee8e89..cc41894b2123f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -112,8 +112,8 @@ class IOSContextGL; class IOSSurface; struct FlutterPlatformViewLayer { - FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, - fml::scoped_nsobject overlay_view_wrapper, + FlutterPlatformViewLayer(const fml::scoped_nsobject& overlay_view, + const fml::scoped_nsobject& overlay_view_wrapper, std::unique_ptr ios_surface, std::unique_ptr surface); @@ -144,10 +144,11 @@ class FlutterPlatformViewLayerPool { // Finally, it marks the layer as used. That is, it increments `available_layer_index_`. std::shared_ptr GetLayer(GrDirectContext* gr_context, std::shared_ptr ios_context); - - // Gets the layers in the pool that aren't currently used. - // This method doesn't mark the layers as unused. - std::vector> GetUnusedLayers(); + const + // Gets the layers in th&e pool that aren't currently used. + // This method doesn't mark the layers as unused. + std::vector> + GetUnusedLayers(); // Marks the layers in the pool as available for reuse. void RecycleLayers(); @@ -207,12 +208,13 @@ class FlutterPlatformViewsController { // returns nil. UIView* GetPlatformViewByID(int view_id); - PostPrerollResult PostPrerollAction(fml::RefPtr raster_thread_merger); + PostPrerollResult PostPrerollAction( + fml::RefPtr rasteconst r_thread_merger); - void EndFrame(bool should_resubmit_frame, - fml::RefPtr raster_thread_merger); + void EndFrame(b& ool should_resubmit_frame, + fml::RefPtr rasteconst r_thread_merger); - std::vector GetCurrentCanvases(); + std::vector GetCurrentCanvases(); std::vector GetCurrentBuilders(); @@ -227,7 +229,7 @@ class FlutterPlatformViewsController { bool SubmitFrame(GrDirectContext* gr_context, std::shared_ptr ios_context, - std::unique_ptr frame); + const std::uniq& ue_ptr frame); void OnMethodCall(FlutterMethodCall* call, FlutterResult& result); @@ -236,8 +238,8 @@ class FlutterPlatformViewsController { long FindFirstResponderPlatformViewId(); // Pushes backdrop filter mutation to the mutator stack of each visited platform view. - void PushFilterToVisitedPlatformViews(std::shared_ptr filter, - const SkRect& filter_rect); + void + PushFilterToVisitedPlatformViews(std::shared_ptr filteconst r, & const SkRect& filter_rect); // Pushes the view id of a visted platform view to the list of visied platform views. void PushVisitedPlatformView(int64_t view_id) { visited_platform_views_.push_back(view_id); } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index 84771ebef8d42..ff70a4b4d2b27 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -13,12 +13,12 @@ namespace flutter { FlutterPlatformViewLayer::FlutterPlatformViewLayer( - fml::scoped_nsobject overlay_view, - fml::scoped_nsobject overlay_view_wrapper, + const fml::scoped_nsobject& overlay_view, + const fml::scoped_nsobject& overlay_view_wrapper, std::unique_ptr ios_surface, std::unique_ptr surface) - : overlay_view(std::move(overlay_view)), - overlay_view_wrapper(std::move(overlay_view_wrapper)), + : overlay_view(overlay_view), + overlay_view_wrapper(overlay_view_wrapper), ios_surface(std::move(ios_surface)), surface(std::move(surface)){}; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 45e90e0c76544..2716ba252ef5a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -229,7 +229,7 @@ - (void)sharedSetupWithProject:(nullable FlutterDartProject*)project } _viewOpaque = YES; - _engine = std::move(engine); + _engine = engine; _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]); [_engine.get() createShell:nil libraryURI:nil initialRoute:initialRoute]; _engineNeedsLaunch = YES; diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h index f3ad233389c37..bebb2e7e699c1 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h @@ -56,7 +56,7 @@ class AccessibilityBridge final : public AccessibilityBridgeIos { ~AccessibilityBridge(); void UpdateSemantics(flutter::SemanticsNodeUpdates nodes, - flutter::CustomAccessibilityActionUpdates actions); + const flutter::CustomAccessibilityActionUpdates& actions); void DispatchSemanticsAction(int32_t id, flutter::SemanticsAction action) override; void DispatchSemanticsAction(int32_t id, flutter::SemanticsAction action, diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index e713e1166a8fb..92b73b187ee78 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #import "flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h" @@ -43,7 +45,7 @@ void PostAccessibilityNotification(UIAccessibilityNotifications notification, std::unique_ptr ios_delegate) : view_controller_(view_controller), platform_view_(platform_view), - platform_views_controller_(platform_views_controller), + platform_views_controller_(std::move(platform_views_controller)), last_focused_semantics_object_id_(kSemanticObjectIdInvalid), objects_([[NSMutableDictionary alloc] init]), previous_route_id_(0), @@ -80,8 +82,9 @@ void PostAccessibilityNotification(UIAccessibilityNotifications notification, } } -void AccessibilityBridge::UpdateSemantics(flutter::SemanticsNodeUpdates nodes, - flutter::CustomAccessibilityActionUpdates actions) { +void AccessibilityBridge::UpdateSemantics( + flutter::SemanticsNodeUpdates nodes, + const flutter::CustomAccessibilityActionUpdates& actions) { BOOL layoutChanged = NO; BOOL scrollOccured = NO; BOOL needsAnnouncement = NO; @@ -251,7 +254,7 @@ static void ReplaceSemanticsObject(SemanticsObject* oldObject, } static SemanticsObject* CreateObject(const flutter::SemanticsNode& node, - fml::WeakPtr weak_ptr) { + const fml::WeakPtr& weak_ptr) { if (node.HasFlag(flutter::SemanticsFlags::kIsTextField) && !node.HasFlag(flutter::SemanticsFlags::kIsReadOnly)) { // Text fields are backed by objects that implement UITextInput. diff --git a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h index 8178f845b8001..14beef5401a9f 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h @@ -57,7 +57,7 @@ namespace flutter { class VsyncWaiterIOS final : public VsyncWaiter, public VariableRefreshRateReporter { public: - explicit VsyncWaiterIOS(flutter::TaskRunners task_runners); + explicit VsyncWaiterIOS(const flutter::TaskRunners& task_runners); ~VsyncWaiterIOS() override; diff --git a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm index da358506ac5ce..cc732fd66ded6 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm @@ -16,8 +16,8 @@ namespace flutter { -VsyncWaiterIOS::VsyncWaiterIOS(flutter::TaskRunners task_runners) - : VsyncWaiter(std::move(task_runners)) { +VsyncWaiterIOS::VsyncWaiterIOS(const flutter::TaskRunners& task_runners) + : VsyncWaiter(task_runners) { auto callback = [this](std::unique_ptr recorder) { const fml::TimePoint start_time = recorder->GetVsyncStartTime(); const fml::TimePoint target_time = recorder->GetVsyncTargetTime(); diff --git a/shell/platform/darwin/ios/ios_external_texture_metal.h b/shell/platform/darwin/ios/ios_external_texture_metal.h index ba0153013a907..41e6c95b05d41 100644 --- a/shell/platform/darwin/ios/ios_external_texture_metal.h +++ b/shell/platform/darwin/ios/ios_external_texture_metal.h @@ -15,7 +15,7 @@ namespace flutter { class IOSExternalTextureMetal final : public Texture { public: explicit IOSExternalTextureMetal( - fml::scoped_nsobject + const fml::scoped_nsobject& darwin_external_texture_metal); // |Texture| diff --git a/shell/platform/darwin/ios/ios_external_texture_metal.mm b/shell/platform/darwin/ios/ios_external_texture_metal.mm index ccc68aa07a008..4f3f812ee0d4d 100644 --- a/shell/platform/darwin/ios/ios_external_texture_metal.mm +++ b/shell/platform/darwin/ios/ios_external_texture_metal.mm @@ -8,7 +8,7 @@ namespace flutter { IOSExternalTextureMetal::IOSExternalTextureMetal( - fml::scoped_nsobject darwin_external_texture_metal) + const fml::scoped_nsobject& darwin_external_texture_metal) : Texture([darwin_external_texture_metal textureID]), darwin_external_texture_metal_(darwin_external_texture_metal) {} diff --git a/shell/platform/darwin/ios/platform_message_handler_ios.h b/shell/platform/darwin/ios/platform_message_handler_ios.h index 7149535f0f407..09ef281daa517 100644 --- a/shell/platform/darwin/ios/platform_message_handler_ios.h +++ b/shell/platform/darwin/ios/platform_message_handler_ios.h @@ -21,7 +21,7 @@ class PlatformMessageHandlerIos : public PlatformMessageHandler { public: static NSObject* MakeBackgroundTaskQueue(); - PlatformMessageHandlerIos(TaskRunners task_runners); + PlatformMessageHandlerIos(const TaskRunners& task_runners); void HandlePlatformMessage(std::unique_ptr message) override; diff --git a/shell/platform/darwin/ios/platform_message_handler_ios.mm b/shell/platform/darwin/ios/platform_message_handler_ios.mm index f6c4f392d97d4..cf510bc301fef 100644 --- a/shell/platform/darwin/ios/platform_message_handler_ios.mm +++ b/shell/platform/darwin/ios/platform_message_handler_ios.mm @@ -44,7 +44,7 @@ - (void)dispatch:(dispatch_block_t)block { return [[[FLTSerialTaskQueue alloc] init] autorelease]; } -PlatformMessageHandlerIos::PlatformMessageHandlerIos(TaskRunners task_runners) +PlatformMessageHandlerIos::PlatformMessageHandlerIos(const TaskRunners& task_runners) : task_runners_(task_runners) {} void PlatformMessageHandlerIos::HandlePlatformMessage(std::unique_ptr message) { From 7366e97b26d5a4b1d5ef9c7762f83e1e92a3315c Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Tue, 8 Nov 2022 17:04:30 -0800 Subject: [PATCH 4/7] reverted bad fix --- .../Source/FlutterPlatformViews_Internal.h | 28 +++++++++---------- .../Source/FlutterPlatformViews_Internal.mm | 8 +++--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index cc41894b2123f..5a66baeee8e89 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -112,8 +112,8 @@ class IOSContextGL; class IOSSurface; struct FlutterPlatformViewLayer { - FlutterPlatformViewLayer(const fml::scoped_nsobject& overlay_view, - const fml::scoped_nsobject& overlay_view_wrapper, + FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, + fml::scoped_nsobject overlay_view_wrapper, std::unique_ptr ios_surface, std::unique_ptr surface); @@ -144,11 +144,10 @@ class FlutterPlatformViewLayerPool { // Finally, it marks the layer as used. That is, it increments `available_layer_index_`. std::shared_ptr GetLayer(GrDirectContext* gr_context, std::shared_ptr ios_context); - const - // Gets the layers in th&e pool that aren't currently used. - // This method doesn't mark the layers as unused. - std::vector> - GetUnusedLayers(); + + // Gets the layers in the pool that aren't currently used. + // This method doesn't mark the layers as unused. + std::vector> GetUnusedLayers(); // Marks the layers in the pool as available for reuse. void RecycleLayers(); @@ -208,13 +207,12 @@ class FlutterPlatformViewsController { // returns nil. UIView* GetPlatformViewByID(int view_id); - PostPrerollResult PostPrerollAction( - fml::RefPtr rasteconst r_thread_merger); + PostPrerollResult PostPrerollAction(fml::RefPtr raster_thread_merger); - void EndFrame(b& ool should_resubmit_frame, - fml::RefPtr rasteconst r_thread_merger); + void EndFrame(bool should_resubmit_frame, + fml::RefPtr raster_thread_merger); - std::vector GetCurrentCanvases(); + std::vector GetCurrentCanvases(); std::vector GetCurrentBuilders(); @@ -229,7 +227,7 @@ class FlutterPlatformViewsController { bool SubmitFrame(GrDirectContext* gr_context, std::shared_ptr ios_context, - const std::uniq& ue_ptr frame); + std::unique_ptr frame); void OnMethodCall(FlutterMethodCall* call, FlutterResult& result); @@ -238,8 +236,8 @@ class FlutterPlatformViewsController { long FindFirstResponderPlatformViewId(); // Pushes backdrop filter mutation to the mutator stack of each visited platform view. - void - PushFilterToVisitedPlatformViews(std::shared_ptr filteconst r, & const SkRect& filter_rect); + void PushFilterToVisitedPlatformViews(std::shared_ptr filter, + const SkRect& filter_rect); // Pushes the view id of a visted platform view to the list of visied platform views. void PushVisitedPlatformView(int64_t view_id) { visited_platform_views_.push_back(view_id); } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index ff70a4b4d2b27..84771ebef8d42 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -13,12 +13,12 @@ namespace flutter { FlutterPlatformViewLayer::FlutterPlatformViewLayer( - const fml::scoped_nsobject& overlay_view, - const fml::scoped_nsobject& overlay_view_wrapper, + fml::scoped_nsobject overlay_view, + fml::scoped_nsobject overlay_view_wrapper, std::unique_ptr ios_surface, std::unique_ptr surface) - : overlay_view(overlay_view), - overlay_view_wrapper(overlay_view_wrapper), + : overlay_view(std::move(overlay_view)), + overlay_view_wrapper(std::move(overlay_view_wrapper)), ios_surface(std::move(ios_surface)), surface(std::move(surface)){}; From 148491af53082f8e994ccc54876d251d4878d66b Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 9 Nov 2022 09:39:22 -0800 Subject: [PATCH 5/7] revert bad fix --- .../framework/Source/FlutterPlatformViews.mm | 1 - .../Source/FlutterPlatformViews_Internal.h | 18 ++++++++++-------- .../Source/FlutterPlatformViews_Internal.mm | 8 ++++---- .../darwin/ios/ios_external_view_embedder.mm | 4 ++-- shell/platform/darwin/ios/ios_surface.h | 2 +- shell/platform/darwin/ios/ios_surface.mm | 2 +- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index b1c6d74d50254..31e303aeef9f5 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -8,7 +8,6 @@ #include #include #include -#include #include "flutter/common/graphics/persistent_cache.h" #include "flutter/flow/rtree.h" diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 5a66baeee8e89..568e424acf9f3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -112,8 +112,8 @@ class IOSContextGL; class IOSSurface; struct FlutterPlatformViewLayer { - FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, - fml::scoped_nsobject overlay_view_wrapper, + FlutterPlatformViewLayer(const fml::scoped_nsobject& overlay_view, + const fml::scoped_nsobject& overlay_view_wrapper, std::unique_ptr ios_surface, std::unique_ptr surface); @@ -142,8 +142,9 @@ class FlutterPlatformViewLayerPool { // Gets a layer from the pool if available, or allocates a new one. // Finally, it marks the layer as used. That is, it increments `available_layer_index_`. - std::shared_ptr GetLayer(GrDirectContext* gr_context, - std::shared_ptr ios_context); + std::shared_ptr GetLayer( + GrDirectContext* gr_context, + const std::shared_ptr& ios_context); // Gets the layers in the pool that aren't currently used. // This method doesn't mark the layers as unused. @@ -207,10 +208,11 @@ class FlutterPlatformViewsController { // returns nil. UIView* GetPlatformViewByID(int view_id); - PostPrerollResult PostPrerollAction(fml::RefPtr raster_thread_merger); + PostPrerollResult PostPrerollAction( + const fml::RefPtr& raster_thread_merger); void EndFrame(bool should_resubmit_frame, - fml::RefPtr raster_thread_merger); + const fml::RefPtr& raster_thread_merger); std::vector GetCurrentCanvases(); @@ -226,7 +228,7 @@ class FlutterPlatformViewsController { void Reset(); bool SubmitFrame(GrDirectContext* gr_context, - std::shared_ptr ios_context, + const std::shared_ptr& ios_context, std::unique_ptr frame); void OnMethodCall(FlutterMethodCall* call, FlutterResult& result); @@ -236,7 +238,7 @@ class FlutterPlatformViewsController { long FindFirstResponderPlatformViewId(); // Pushes backdrop filter mutation to the mutator stack of each visited platform view. - void PushFilterToVisitedPlatformViews(std::shared_ptr filter, + void PushFilterToVisitedPlatformViews(const std::shared_ptr& filter, const SkRect& filter_rect); // Pushes the view id of a visted platform view to the list of visied platform views. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index 84771ebef8d42..ff70a4b4d2b27 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -13,12 +13,12 @@ namespace flutter { FlutterPlatformViewLayer::FlutterPlatformViewLayer( - fml::scoped_nsobject overlay_view, - fml::scoped_nsobject overlay_view_wrapper, + const fml::scoped_nsobject& overlay_view, + const fml::scoped_nsobject& overlay_view_wrapper, std::unique_ptr ios_surface, std::unique_ptr surface) - : overlay_view(std::move(overlay_view)), - overlay_view_wrapper(std::move(overlay_view_wrapper)), + : overlay_view(overlay_view), + overlay_view_wrapper(overlay_view_wrapper), ios_surface(std::move(ios_surface)), surface(std::move(surface)){}; diff --git a/shell/platform/darwin/ios/ios_external_view_embedder.mm b/shell/platform/darwin/ios/ios_external_view_embedder.mm index 3222bf2a096c3..61fc7dc5bacd4 100644 --- a/shell/platform/darwin/ios/ios_external_view_embedder.mm +++ b/shell/platform/darwin/ios/ios_external_view_embedder.mm @@ -9,7 +9,7 @@ IOSExternalViewEmbedder::IOSExternalViewEmbedder( const std::shared_ptr& platform_views_controller, std::shared_ptr context) - : platform_views_controller_(platform_views_controller), ios_context_(context) { + : platform_views_controller_(platform_views_controller), ios_context_(std::move(context)) { FML_CHECK(ios_context_); } @@ -82,7 +82,7 @@ std::unique_ptr frame) { TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::SubmitFrame"); FML_CHECK(platform_views_controller_); - platform_views_controller_->SubmitFrame(std::move(context), ios_context_, std::move(frame)); + platform_views_controller_->SubmitFrame(context, ios_context_, std::move(frame)); TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::DidSubmitFrame"); } diff --git a/shell/platform/darwin/ios/ios_surface.h b/shell/platform/darwin/ios/ios_surface.h index 755e845849163..78394f25781c6 100644 --- a/shell/platform/darwin/ios/ios_surface.h +++ b/shell/platform/darwin/ios/ios_surface.h @@ -25,7 +25,7 @@ bool IsIosEmbeddedViewsPreviewEnabled(); class IOSSurface { public: static std::unique_ptr Create(std::shared_ptr context, - fml::scoped_nsobject layer); + const fml::scoped_nsobject& layer); std::shared_ptr GetContext() const; diff --git a/shell/platform/darwin/ios/ios_surface.mm b/shell/platform/darwin/ios/ios_surface.mm index 225a3b728ef46..c38c4e07a71d0 100644 --- a/shell/platform/darwin/ios/ios_surface.mm +++ b/shell/platform/darwin/ios/ios_surface.mm @@ -16,7 +16,7 @@ namespace flutter { std::unique_ptr IOSSurface::Create(std::shared_ptr context, - fml::scoped_nsobject layer) { + const fml::scoped_nsobject& layer) { FML_DCHECK(layer); FML_DCHECK(context); From d61c68f43a1c488d0867d0db4062cd4d8fbe99ef Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 9 Nov 2022 10:47:36 -0800 Subject: [PATCH 6/7] another ios patch --- .../ios/framework/Source/FlutterPlatformViews.mm | 2 +- .../framework/Source/FlutterPlatformViews_Internal.h | 2 +- shell/platform/darwin/ios/ios_surface.mm | 2 +- .../platform/darwin/ios/ios_surface_metal_impeller.h | 4 ++-- .../platform/darwin/ios/ios_surface_metal_impeller.mm | 6 +++--- shell/platform/darwin/ios/ios_surface_metal_skia.h | 2 +- shell/platform/darwin/ios/ios_surface_metal_skia.mm | 4 ++-- shell/platform/darwin/ios/ios_surface_software.h | 3 ++- shell/platform/darwin/ios/ios_surface_software.mm | 4 ++-- shell/platform/darwin/ios/platform_view_ios.h | 6 +++--- shell/platform/darwin/ios/platform_view_ios.mm | 11 ++++++----- 11 files changed, 24 insertions(+), 22 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 31e303aeef9f5..90885780576b0 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -728,7 +728,7 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { std::shared_ptr FlutterPlatformViewsController::GetLayer( GrDirectContext* gr_context, - std::shared_ptr ios_context, + const std::shared_ptr& ios_context, EmbedderViewSlice* slice, SkRect rect, int64_t view_id, diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 568e424acf9f3..9e8009e6fe077 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -286,7 +286,7 @@ class FlutterPlatformViewsController { // Allocates a new FlutterPlatformViewLayer if needed, draws the pixels within the rect from // the picture on the layer's canvas. std::shared_ptr GetLayer(GrDirectContext* gr_context, - std::shared_ptr ios_context, + const std::shared_ptr& ios_context, EmbedderViewSlice* slice, SkRect rect, int64_t view_id, diff --git a/shell/platform/darwin/ios/ios_surface.mm b/shell/platform/darwin/ios/ios_surface.mm index c38c4e07a71d0..63745aaebefa0 100644 --- a/shell/platform/darwin/ios/ios_surface.mm +++ b/shell/platform/darwin/ios/ios_surface.mm @@ -42,7 +42,7 @@ } #endif // SHELL_ENABLE_METAL - return std::make_unique(std::move(layer), // layer + return std::make_unique(layer, // layer std::move(context) // context ); } diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.h b/shell/platform/darwin/ios/ios_surface_metal_impeller.h index 63312ff8702b4..6c3615318a9ca 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_impeller.h +++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.h @@ -21,8 +21,8 @@ class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalImpeller final : public IOSSurface, public GPUSurfaceMetalDelegate { public: - IOSSurfaceMetalImpeller(fml::scoped_nsobject layer, - std::shared_ptr context); + IOSSurfaceMetalImpeller(const fml::scoped_nsobject& layer, + const std::shared_ptr& context); // |IOSSurface| ~IOSSurfaceMetalImpeller(); diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm index c63c6ff9e3d25..1aba7895cb2f3 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm +++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm @@ -8,11 +8,11 @@ namespace flutter { -IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(fml::scoped_nsobject layer, - std::shared_ptr context) +IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(const fml::scoped_nsobject& layer, + const std::shared_ptr& context) : IOSSurface(context), GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer), - layer_(std::move(layer)), + layer_(layer), impeller_context_(context ? context->GetImpellerContext() : nullptr) { if (!impeller_context_) { return; diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.h b/shell/platform/darwin/ios/ios_surface_metal_skia.h index 86b6490d01180..efd174b07e09d 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_skia.h +++ b/shell/platform/darwin/ios/ios_surface_metal_skia.h @@ -17,7 +17,7 @@ namespace flutter { class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalSkia final : public IOSSurface, public GPUSurfaceMetalDelegate { public: - IOSSurfaceMetalSkia(fml::scoped_nsobject layer, + IOSSurfaceMetalSkia(const fml::scoped_nsobject& layer, std::shared_ptr context); // |IOSSurface| diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.mm b/shell/platform/darwin/ios/ios_surface_metal_skia.mm index 9a4d8b2e48d76..13ac639a2fe0c 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_skia.mm +++ b/shell/platform/darwin/ios/ios_surface_metal_skia.mm @@ -14,11 +14,11 @@ return reinterpret_cast(context.get()); } -IOSSurfaceMetalSkia::IOSSurfaceMetalSkia(fml::scoped_nsobject layer, +IOSSurfaceMetalSkia::IOSSurfaceMetalSkia(const fml::scoped_nsobject& layer, std::shared_ptr context) : IOSSurface(std::move(context)), GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer), - layer_(std::move(layer)) { + layer_(layer) { is_valid_ = layer_; auto metal_context = CastToMetalContext(GetContext()); auto darwin_context = metal_context->GetDarwinContext().get(); diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h index 35c9fef674f2b..2d649bd80a6de 100644 --- a/shell/platform/darwin/ios/ios_surface_software.h +++ b/shell/platform/darwin/ios/ios_surface_software.h @@ -18,7 +18,8 @@ namespace flutter { class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDelegate { public: - IOSSurfaceSoftware(fml::scoped_nsobject layer, std::shared_ptr context); + IOSSurfaceSoftware(const fml::scoped_nsobject& layer, + std::shared_ptr context); ~IOSSurfaceSoftware() override; diff --git a/shell/platform/darwin/ios/ios_surface_software.mm b/shell/platform/darwin/ios/ios_surface_software.mm index 687ab7403ca3b..f60f9e95b0e9a 100644 --- a/shell/platform/darwin/ios/ios_surface_software.mm +++ b/shell/platform/darwin/ios/ios_surface_software.mm @@ -15,9 +15,9 @@ namespace flutter { -IOSSurfaceSoftware::IOSSurfaceSoftware(fml::scoped_nsobject layer, +IOSSurfaceSoftware::IOSSurfaceSoftware(const fml::scoped_nsobject& layer, std::shared_ptr context) - : IOSSurface(std::move(context)), layer_(std::move(layer)) {} + : IOSSurface(std::move(context)), layer_(layer) {} IOSSurfaceSoftware::~IOSSurfaceSoftware() = default; diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h index 8705215da2aec..e9129350a4277 100644 --- a/shell/platform/darwin/ios/platform_view_ios.h +++ b/shell/platform/darwin/ios/platform_view_ios.h @@ -43,13 +43,13 @@ class PlatformViewIOS final : public PlatformView { PlatformViewIOS(PlatformView::Delegate& delegate, const std::shared_ptr& context, const std::shared_ptr& platform_views_controller, - flutter::TaskRunners task_runners); + const flutter::TaskRunners& task_runners); explicit PlatformViewIOS( PlatformView::Delegate& delegate, IOSRenderingAPI rendering_api, const std::shared_ptr& platform_views_controller, - flutter::TaskRunners task_runners); + const flutter::TaskRunners& task_runners); ~PlatformViewIOS() override; @@ -64,7 +64,7 @@ class PlatformViewIOS final : public PlatformView { * this PlatformViewIOS. This should be updated when the `FlutterEngine` * is given a new `FlutterViewController`. */ - void SetOwnerViewController(fml::WeakPtr owner_controller); + void SetOwnerViewController(const fml::WeakPtr& owner_controller); /** * Called one time per `FlutterViewController` when the `FlutterViewController`'s diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index 5b6dfc3d95d9c..7e054fcb80309 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -43,8 +43,8 @@ PlatformView::Delegate& delegate, const std::shared_ptr& context, const std::shared_ptr& platform_views_controller, - flutter::TaskRunners task_runners) - : PlatformView(delegate, std::move(task_runners)), + const flutter::TaskRunners& task_runners) + : PlatformView(delegate, task_runners), ios_context_(context), platform_views_controller_(platform_views_controller), accessibility_bridge_([this](bool enabled) { PlatformView::SetSemanticsEnabled(enabled); }), @@ -54,7 +54,7 @@ PlatformView::Delegate& delegate, IOSRenderingAPI rendering_api, const std::shared_ptr& platform_views_controller, - flutter::TaskRunners task_runners) + const flutter::TaskRunners& task_runners) : PlatformViewIOS( delegate, IOSContext::Create( @@ -76,7 +76,8 @@ return owner_controller_; } -void PlatformViewIOS::SetOwnerViewController(fml::WeakPtr owner_controller) { +void PlatformViewIOS::SetOwnerViewController( + const fml::WeakPtr& owner_controller) { FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); std::lock_guard guard(ios_surface_mutex_); if (ios_surface_ || !owner_controller) { @@ -189,7 +190,7 @@ flutter::CustomAccessibilityActionUpdates actions) { FML_DCHECK(owner_controller_); if (accessibility_bridge_) { - accessibility_bridge_.get()->UpdateSemantics(std::move(update), std::move(actions)); + accessibility_bridge_.get()->UpdateSemantics(std::move(update), actions); [[NSNotificationCenter defaultCenter] postNotificationName:FlutterSemanticsUpdateNotification object:owner_controller_.get()]; } From 45a5dd832d710db428fa938baa3458c2080faa7b Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 9 Nov 2022 11:23:04 -0800 Subject: [PATCH 7/7] removed lint fix printer --- ci/lint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/lint.sh b/ci/lint.sh index 47f854135d5d8..7c6c4e0c314b8 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -36,7 +36,6 @@ DART="${DART_BIN}/dart" # to have this as an error. MAC_HOST_WARNINGS_AS_ERRORS="performance-move-const-arg" -FLUTTER_LINT_PRINT_FIX=1 # FLUTTER_LINT_PRINT_FIX will make it so that fix is executed and the generated # diff is printed to stdout if clang-tidy fails. This is helpful for enabling # new lints.