Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit aad8d17

Browse files
committed
Turned unnecessary value and move of const to errors for mac host_debug.
1 parent 04fa86e commit aad8d17

28 files changed

+115
-69
lines changed

.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ performance-unnecessary-value-param"
1919
# Add checks when all warnings are fixed
2020
# to prevent new warnings being introduced.
2121
# https://github.com/flutter/flutter/issues/93279
22+
# Note: There are platform specific warnings as errors in
23+
# //tools/clang_tidy/lib/src/options.dart
2224
WarningsAsErrors: "bugprone-use-after-move,\
2325
clang-analyzer-*,\
2426
readability-identifier-naming,\

impeller/renderer/render_target.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ const std::optional<StencilAttachment>& RenderTarget::GetStencilAttachment()
179179

180180
RenderTarget RenderTarget::CreateOffscreen(const Context& context,
181181
ISize size,
182-
std::string label,
182+
const std::string& label,
183183
StorageMode color_storage_mode,
184184
LoadAction color_load_action,
185185
StoreAction color_store_action,
@@ -230,7 +230,7 @@ RenderTarget RenderTarget::CreateOffscreen(const Context& context,
230230
stencil0.texture->SetLabel(SPrintF("%s Stencil Texture", label.c_str()));
231231

232232
RenderTarget target;
233-
target.SetColorAttachment(std::move(color0), 0u);
233+
target.SetColorAttachment(color0, 0u);
234234
target.SetStencilAttachment(std::move(stencil0));
235235

236236
return target;
@@ -239,7 +239,7 @@ RenderTarget RenderTarget::CreateOffscreen(const Context& context,
239239
RenderTarget RenderTarget::CreateOffscreenMSAA(
240240
const Context& context,
241241
ISize size,
242-
std::string label,
242+
const std::string& label,
243243
StorageMode color_storage_mode,
244244
StorageMode color_resolve_storage_mode,
245245
LoadAction color_load_action,
@@ -322,7 +322,7 @@ RenderTarget RenderTarget::CreateOffscreenMSAA(
322322
stencil0.texture->SetLabel(SPrintF("%s Stencil Texture", label.c_str()));
323323

324324
RenderTarget target;
325-
target.SetColorAttachment(std::move(color0), 0u);
325+
target.SetColorAttachment(color0, 0u);
326326
target.SetStencilAttachment(std::move(stencil0));
327327

328328
return target;

impeller/renderer/render_target.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RenderTarget {
2222
static RenderTarget CreateOffscreen(
2323
const Context& context,
2424
ISize size,
25-
std::string label = "Offscreen",
25+
const std::string& label = "Offscreen",
2626
StorageMode color_storage_mode = StorageMode::kDevicePrivate,
2727
LoadAction color_load_action = LoadAction::kClear,
2828
StoreAction color_store_action = StoreAction::kStore,
@@ -33,7 +33,7 @@ class RenderTarget {
3333
static RenderTarget CreateOffscreenMSAA(
3434
const Context& context,
3535
ISize size,
36-
std::string label = "Offscreen MSAA",
36+
const std::string& label = "Offscreen MSAA",
3737
StorageMode color_storage_mode = StorageMode::kDeviceTransient,
3838
StorageMode color_resolve_storage_mode = StorageMode::kDevicePrivate,
3939
LoadAction color_load_action = LoadAction::kClear,

impeller/typographer/backends/skia/text_render_context_skia.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ static FontGlyphPair::Set CollectUniqueFontGlyphPairsSet(
4747

4848
static FontGlyphPair::Vector CollectUniqueFontGlyphPairs(
4949
GlyphAtlas::Type type,
50-
TextRenderContext::FrameIterator frame_iterator) {
50+
const TextRenderContext::FrameIterator& frame_iterator) {
5151
TRACE_EVENT0("impeller", __FUNCTION__);
5252
FontGlyphPair::Vector vector;
53-
auto set = CollectUniqueFontGlyphPairsSet(type, std::move(frame_iterator));
53+
auto set = CollectUniqueFontGlyphPairsSet(type, frame_iterator);
5454
vector.reserve(set.size());
5555
for (const auto& item : set) {
5656
vector.emplace_back(item);

impeller/typographer/typographer_unittests.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ TEST_P(TypographerTest, LazyAtlasTracksColor) {
8080
LazyGlyphAtlas lazy_atlas;
8181
ASSERT_FALSE(lazy_atlas.HasColor());
8282

83-
lazy_atlas.AddTextFrame(std::move(frame));
83+
lazy_atlas.AddTextFrame(frame);
8484

8585
ASSERT_FALSE(lazy_atlas.HasColor());
8686

8787
frame = TextFrameFromTextBlob(SkTextBlob::MakeFromString("😀 ", emoji_font));
8888

8989
ASSERT_TRUE(frame.HasColor());
9090

91-
lazy_atlas.AddTextFrame(std::move(frame));
91+
lazy_atlas.AddTextFrame(frame);
9292

9393
ASSERT_TRUE(lazy_atlas.HasColor());
9494
}

lib/ui/compositing/scene.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static sk_sp<DlImage> CreateDeferredImage(
110110
width, height, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
111111
return DlDeferredImageGPUSkia::MakeFromLayerTree(
112112
image_info, std::move(layer_tree), std::move(snapshot_delegate),
113-
std::move(raster_task_runner), std::move(unref_queue));
113+
raster_task_runner, std::move(unref_queue));
114114
}
115115

116116
void Scene::RasterizeToImage(uint32_t width,

lib/ui/painting/image_encoding.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ Dart_Handle EncodeImage(CanvasImage* canvas_image,
275275
snapshot_delegate =
276276
UIDartState::Current()->GetSnapshotDelegate()]() mutable {
277277
EncodeImageAndInvokeDataCallback(
278-
std::move(image), std::move(callback), image_format, ui_task_runner,
279-
std::move(raster_task_runner), std::move(io_task_runner),
280-
io_manager->GetResourceContext(), std::move(snapshot_delegate),
278+
image, std::move(callback), image_format, ui_task_runner,
279+
raster_task_runner, io_task_runner,
280+
io_manager->GetResourceContext(), snapshot_delegate,
281281
io_manager->GetIsGpuDisabledSyncSwitch());
282282
}));
283283

lib/ui/painting/immutable_buffer.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ Dart_Handle ImmutableBuffer::initFromFile(Dart_Handle raw_buffer_handle,
139139
sk_data = MakeSkDataWithCopy(bytes, buffer_size);
140140
}
141141
ui_task_runner->PostTask(
142-
[sk_data = std::move(sk_data), ui_task = std::move(ui_task),
143-
buffer_size]() { ui_task(sk_data, buffer_size); });
142+
[sk_data = std::move(sk_data), ui_task = ui_task, buffer_size]() {
143+
ui_task(sk_data, buffer_size);
144+
});
144145
});
145146
return Dart_Null();
146147
}

lib/ui/painting/multi_frame_codec.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ void MultiFrameCodec::State::GetNextFrameAndInvokeCallback(
184184
int duration = 0;
185185
sk_sp<DlImage> dlImage =
186186
GetNextFrameImage(std::move(resourceContext), gpu_disable_sync_switch,
187-
impeller_context, unref_queue);
187+
std::move(impeller_context), std::move(unref_queue));
188188
if (dlImage) {
189189
image = CanvasImage::Create();
190190
image->set_image(dlImage);

lib/ui/ui_dart_state.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ UIDartState::Context::Context(
4949
advisory_script_uri(std::move(advisory_script_uri)),
5050
advisory_script_entrypoint(std::move(advisory_script_entrypoint)),
5151
volatile_path_tracker(std::move(volatile_path_tracker)),
52-
concurrent_task_runner(concurrent_task_runner),
52+
concurrent_task_runner(std::move(concurrent_task_runner)),
5353
enable_impeller(enable_impeller) {}
5454

5555
UIDartState::UIDartState(

shell/platform/embedder/tests/embedder_test_compositor.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/shell/platform/embedder/tests/embedder_test_compositor.h"
66

7+
#include <utility>
8+
79
#include "flutter/fml/logging.h"
810
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
911
#include "third_party/skia/include/core/SkSurface.h"
@@ -13,7 +15,7 @@ namespace testing {
1315

1416
EmbedderTestCompositor::EmbedderTestCompositor(SkISize surface_size,
1517
sk_sp<GrDirectContext> context)
16-
: surface_size_(surface_size), context_(context) {
18+
: surface_size_(surface_size), context_(std::move(context)) {
1719
FML_CHECK(!surface_size_.isEmpty()) << "Surface size must not be empty";
1820
}
1921

@@ -118,16 +120,17 @@ size_t EmbedderTestCompositor::GetBackingStoresCollectedCount() const {
118120
}
119121

120122
void EmbedderTestCompositor::AddOnCreateRenderTargetCallback(
121-
fml::closure callback) {
123+
const fml::closure& callback) {
122124
on_create_render_target_callbacks_.push_back(callback);
123125
}
124126

125127
void EmbedderTestCompositor::AddOnCollectRenderTargetCallback(
126-
fml::closure callback) {
128+
const fml::closure& callback) {
127129
on_collect_render_target_callbacks_.push_back(callback);
128130
}
129131

130-
void EmbedderTestCompositor::AddOnPresentCallback(fml::closure callback) {
132+
void EmbedderTestCompositor::AddOnPresentCallback(
133+
const fml::closure& callback) {
131134
on_present_callbacks_.push_back(callback);
132135
}
133136

shell/platform/embedder/tests/embedder_test_compositor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class EmbedderTestCompositor {
6464

6565
size_t GetBackingStoresCollectedCount() const;
6666

67-
void AddOnCreateRenderTargetCallback(fml::closure callback);
67+
void AddOnCreateRenderTargetCallback(const fml::closure& callback);
6868

69-
void AddOnCollectRenderTargetCallback(fml::closure callback);
69+
void AddOnCollectRenderTargetCallback(const fml::closure& callback);
7070

71-
void AddOnPresentCallback(fml::closure callback);
71+
void AddOnPresentCallback(const fml::closure& callback);
7272

7373
sk_sp<GrDirectContext> GetGrContext();
7474

shell/platform/embedder/tests/embedder_test_compositor_gl.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/shell/platform/embedder/tests/embedder_test_compositor_gl.h"
66

7+
#include <utility>
8+
79
#include "flutter/fml/logging.h"
810
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
911
#include "third_party/skia/include/core/SkSurface.h"
@@ -14,7 +16,7 @@ namespace testing {
1416
EmbedderTestCompositorGL::EmbedderTestCompositorGL(
1517
SkISize surface_size,
1618
sk_sp<GrDirectContext> context)
17-
: EmbedderTestCompositor(surface_size, context) {}
19+
: EmbedderTestCompositor(surface_size, std::move(context)) {}
1820

1921
EmbedderTestCompositorGL::~EmbedderTestCompositorGL() = default;
2022

shell/platform/embedder/tests/embedder_test_compositor_metal.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/shell/platform/embedder/tests/embedder_test_compositor_metal.h"
66

7+
#include <utility>
8+
79
#include "flutter/fml/logging.h"
810
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
911
#include "third_party/skia/include/core/SkSurface.h"
@@ -14,7 +16,7 @@ namespace testing {
1416
EmbedderTestCompositorMetal::EmbedderTestCompositorMetal(
1517
SkISize surface_size,
1618
sk_sp<GrDirectContext> context)
17-
: EmbedderTestCompositor(surface_size, context) {}
19+
: EmbedderTestCompositor(surface_size, std::move(context)) {}
1820

1921
EmbedderTestCompositorMetal::~EmbedderTestCompositorMetal() = default;
2022

shell/platform/embedder/tests/embedder_test_compositor_vulkan.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/shell/platform/embedder/tests/embedder_test_compositor_vulkan.h"
66

7+
#include <utility>
8+
79
#include "flutter/fml/logging.h"
810
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
911
#include "flutter/shell/platform/embedder/tests/embedder_test_backingstore_producer.h"
@@ -15,7 +17,7 @@ namespace testing {
1517
EmbedderTestCompositorVulkan::EmbedderTestCompositorVulkan(
1618
SkISize surface_size,
1719
sk_sp<GrDirectContext> context)
18-
: EmbedderTestCompositor(surface_size, context) {}
20+
: EmbedderTestCompositor(surface_size, std::move(context)) {}
1921

2022
EmbedderTestCompositorVulkan::~EmbedderTestCompositorVulkan() = default;
2123

shell/platform/embedder/tests/embedder_test_context.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/shell/platform/embedder/tests/embedder_test_context.h"
66

7+
#include <utility>
8+
79
#include "flutter/fml/make_copyable.h"
810
#include "flutter/fml/paths.h"
911
#include "flutter/runtime/dart_vm.h"
@@ -94,7 +96,8 @@ void EmbedderTestContext::SetRootSurfaceTransformation(SkMatrix matrix) {
9496
root_surface_transformation_ = matrix;
9597
}
9698

97-
void EmbedderTestContext::AddIsolateCreateCallback(fml::closure closure) {
99+
void EmbedderTestContext::AddIsolateCreateCallback(
100+
const fml::closure& closure) {
98101
if (closure) {
99102
isolate_create_callbacks_.push_back(closure);
100103
}
@@ -226,7 +229,7 @@ void EmbedderTestContext::FireRootSurfacePresentCallbackIfPresent(
226229

227230
void EmbedderTestContext::SetVsyncCallback(
228231
std::function<void(intptr_t)> callback) {
229-
vsync_callback_ = callback;
232+
vsync_callback_ = std::move(callback);
230233
}
231234

232235
void EmbedderTestContext::RunVsyncCallback(intptr_t baton) {

shell/platform/embedder/tests/embedder_test_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class EmbedderTestContext {
6767

6868
void SetRootSurfaceTransformation(SkMatrix matrix);
6969

70-
void AddIsolateCreateCallback(fml::closure closure);
70+
void AddIsolateCreateCallback(const fml::closure& closure);
7171

7272
void AddNativeCallback(const char* name, Dart_NativeFunction function);
7373

shell/platform/embedder/tests/embedder_test_context_gl.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/shell/platform/embedder/tests/embedder_test_context_gl.h"
66

7+
#include <utility>
8+
79
#include "flutter/fml/make_copyable.h"
810
#include "flutter/fml/paths.h"
911
#include "flutter/runtime/dart_vm.h"
@@ -18,7 +20,7 @@ namespace flutter {
1820
namespace testing {
1921

2022
EmbedderTestContextGL::EmbedderTestContextGL(std::string assets_path)
21-
: EmbedderTestContext(assets_path) {}
23+
: EmbedderTestContext(std::move(assets_path)) {}
2224

2325
EmbedderTestContextGL::~EmbedderTestContextGL() {
2426
SetGLGetFBOCallback(nullptr);
@@ -61,18 +63,18 @@ bool EmbedderTestContextGL::GLPresent(FlutterPresentInfo present_info) {
6163

6264
void EmbedderTestContextGL::SetGLGetFBOCallback(GLGetFBOCallback callback) {
6365
std::scoped_lock lock(gl_callback_mutex_);
64-
gl_get_fbo_callback_ = callback;
66+
gl_get_fbo_callback_ = std::move(callback);
6567
}
6668

6769
void EmbedderTestContextGL::SetGLPopulateExistingDamageCallback(
6870
GLPopulateExistingDamageCallback callback) {
6971
std::scoped_lock lock(gl_callback_mutex_);
70-
gl_populate_existing_damage_callback_ = callback;
72+
gl_populate_existing_damage_callback_ = std::move(callback);
7173
}
7274

7375
void EmbedderTestContextGL::SetGLPresentCallback(GLPresentCallback callback) {
7476
std::scoped_lock lock(gl_callback_mutex_);
75-
gl_present_callback_ = callback;
77+
gl_present_callback_ = std::move(callback);
7678
}
7779

7880
uint32_t EmbedderTestContextGL::GLGetFramebuffer(FlutterFrameInfo frame_info) {

shell/platform/embedder/tests/embedder_test_context_software.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "flutter/shell/platform/embedder/tests/embedder_test_context_software.h"
66

7+
#include <utility>
8+
79
#include "flutter/fml/make_copyable.h"
810
#include "flutter/fml/paths.h"
911
#include "flutter/runtime/dart_vm.h"
@@ -18,11 +20,11 @@ namespace testing {
1820

1921
EmbedderTestContextSoftware::EmbedderTestContextSoftware(
2022
std::string assets_path)
21-
: EmbedderTestContext(assets_path) {}
23+
: EmbedderTestContext(std::move(assets_path)) {}
2224

2325
EmbedderTestContextSoftware::~EmbedderTestContextSoftware() = default;
2426

25-
bool EmbedderTestContextSoftware::Present(sk_sp<SkImage> image) {
27+
bool EmbedderTestContextSoftware::Present(const sk_sp<SkImage>& image) {
2628
software_surface_present_count_++;
2729

2830
FireRootSurfacePresentCallbackIfPresent([image] { return image; });

shell/platform/embedder/tests/embedder_test_context_software.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class EmbedderTestContextSoftware : public EmbedderTestContext {
2121
// |EmbedderTestContext|
2222
EmbedderTestContextType GetContextType() const override;
2323

24-
bool Present(sk_sp<SkImage> image);
24+
bool Present(const sk_sp<SkImage>& image);
2525

2626
protected:
2727
virtual void SetupCompositor() override;

0 commit comments

Comments
 (0)