Skip to content

Commit

Permalink
Turned unnecessary value and move of const to errors for mac host_debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke committed Oct 21, 2022
1 parent 04fa86e commit eab8459
Show file tree
Hide file tree
Showing 28 changed files with 114 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ performance-unnecessary-value-param"
# Add checks when all warnings are fixed
# to prevent new warnings being introduced.
# https://github.com/flutter/flutter/issues/93279
# Note: There are platform specific warnings as errors in
# //tools/clang_tidy/lib/src/options.dart
WarningsAsErrors: "bugprone-use-after-move,\
clang-analyzer-*,\
readability-identifier-naming,\
Expand Down
8 changes: 4 additions & 4 deletions impeller/renderer/render_target.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const std::optional<StencilAttachment>& RenderTarget::GetStencilAttachment()

RenderTarget RenderTarget::CreateOffscreen(const Context& context,
ISize size,
std::string label,
const std::string& label,
StorageMode color_storage_mode,
LoadAction color_load_action,
StoreAction color_store_action,
Expand Down Expand Up @@ -230,7 +230,7 @@ RenderTarget RenderTarget::CreateOffscreen(const Context& context,
stencil0.texture->SetLabel(SPrintF("%s Stencil Texture", label.c_str()));

RenderTarget target;
target.SetColorAttachment(std::move(color0), 0u);
target.SetColorAttachment(color0, 0u);
target.SetStencilAttachment(std::move(stencil0));

return target;
Expand All @@ -239,7 +239,7 @@ RenderTarget RenderTarget::CreateOffscreen(const Context& context,
RenderTarget RenderTarget::CreateOffscreenMSAA(
const Context& context,
ISize size,
std::string label,
const std::string& label,
StorageMode color_storage_mode,
StorageMode color_resolve_storage_mode,
LoadAction color_load_action,
Expand Down Expand Up @@ -322,7 +322,7 @@ RenderTarget RenderTarget::CreateOffscreenMSAA(
stencil0.texture->SetLabel(SPrintF("%s Stencil Texture", label.c_str()));

RenderTarget target;
target.SetColorAttachment(std::move(color0), 0u);
target.SetColorAttachment(color0, 0u);
target.SetStencilAttachment(std::move(stencil0));

return target;
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/render_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RenderTarget {
static RenderTarget CreateOffscreen(
const Context& context,
ISize size,
std::string label = "Offscreen",
const std::string& label = "Offscreen",
StorageMode color_storage_mode = StorageMode::kDevicePrivate,
LoadAction color_load_action = LoadAction::kClear,
StoreAction color_store_action = StoreAction::kStore,
Expand All @@ -33,7 +33,7 @@ class RenderTarget {
static RenderTarget CreateOffscreenMSAA(
const Context& context,
ISize size,
std::string label = "Offscreen MSAA",
const std::string& label = "Offscreen MSAA",
StorageMode color_storage_mode = StorageMode::kDeviceTransient,
StorageMode color_resolve_storage_mode = StorageMode::kDevicePrivate,
LoadAction color_load_action = LoadAction::kClear,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ static FontGlyphPair::Set CollectUniqueFontGlyphPairsSet(

static FontGlyphPair::Vector CollectUniqueFontGlyphPairs(
GlyphAtlas::Type type,
TextRenderContext::FrameIterator frame_iterator) {
const TextRenderContext::FrameIterator& frame_iterator) {
TRACE_EVENT0("impeller", __FUNCTION__);
FontGlyphPair::Vector vector;
auto set = CollectUniqueFontGlyphPairsSet(type, std::move(frame_iterator));
auto set = CollectUniqueFontGlyphPairsSet(type, frame_iterator);
vector.reserve(set.size());
for (const auto& item : set) {
vector.emplace_back(item);
Expand Down
4 changes: 2 additions & 2 deletions impeller/typographer/typographer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ TEST_P(TypographerTest, LazyAtlasTracksColor) {
LazyGlyphAtlas lazy_atlas;
ASSERT_FALSE(lazy_atlas.HasColor());

lazy_atlas.AddTextFrame(std::move(frame));
lazy_atlas.AddTextFrame(frame);

ASSERT_FALSE(lazy_atlas.HasColor());

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

ASSERT_TRUE(frame.HasColor());

lazy_atlas.AddTextFrame(std::move(frame));
lazy_atlas.AddTextFrame(frame);

ASSERT_TRUE(lazy_atlas.HasColor());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/compositing/scene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static sk_sp<DlImage> CreateDeferredImage(
width, height, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
return DlDeferredImageGPUSkia::MakeFromLayerTree(
image_info, std::move(layer_tree), std::move(snapshot_delegate),
std::move(raster_task_runner), std::move(unref_queue));
raster_task_runner, std::move(unref_queue));
}

void Scene::RasterizeToImage(uint32_t width,
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/painting/image_encoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ Dart_Handle EncodeImage(CanvasImage* canvas_image,
snapshot_delegate =
UIDartState::Current()->GetSnapshotDelegate()]() mutable {
EncodeImageAndInvokeDataCallback(
std::move(image), std::move(callback), image_format, ui_task_runner,
std::move(raster_task_runner), std::move(io_task_runner),
io_manager->GetResourceContext(), std::move(snapshot_delegate),
image, std::move(callback), image_format, ui_task_runner,
raster_task_runner, io_task_runner,
io_manager->GetResourceContext(), snapshot_delegate,
io_manager->GetIsGpuDisabledSyncSwitch());
}));

Expand Down
5 changes: 3 additions & 2 deletions lib/ui/painting/immutable_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ Dart_Handle ImmutableBuffer::initFromFile(Dart_Handle raw_buffer_handle,
sk_data = MakeSkDataWithCopy(bytes, buffer_size);
}
ui_task_runner->PostTask(
[sk_data = std::move(sk_data), ui_task = std::move(ui_task),
buffer_size]() { ui_task(sk_data, buffer_size); });
[sk_data = std::move(sk_data), ui_task = ui_task, buffer_size]() {
ui_task(sk_data, buffer_size);
});
});
return Dart_Null();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/painting/multi_frame_codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void MultiFrameCodec::State::GetNextFrameAndInvokeCallback(
int duration = 0;
sk_sp<DlImage> dlImage =
GetNextFrameImage(std::move(resourceContext), gpu_disable_sync_switch,
impeller_context, unref_queue);
std::move(impeller_context), std::move(unref_queue));
if (dlImage) {
image = CanvasImage::Create();
image->set_image(dlImage);
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/ui_dart_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ UIDartState::Context::Context(
advisory_script_uri(std::move(advisory_script_uri)),
advisory_script_entrypoint(std::move(advisory_script_entrypoint)),
volatile_path_tracker(std::move(volatile_path_tracker)),
concurrent_task_runner(concurrent_task_runner),
concurrent_task_runner(std::move(concurrent_task_runner)),
enable_impeller(enable_impeller) {}

UIDartState::UIDartState(
Expand Down
11 changes: 7 additions & 4 deletions shell/platform/embedder/tests/embedder_test_compositor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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

#include <utility>

#include "flutter/fml/logging.h"
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
#include "third_party/skia/include/core/SkSurface.h"
Expand All @@ -13,7 +15,7 @@ namespace testing {

EmbedderTestCompositor::EmbedderTestCompositor(SkISize surface_size,
sk_sp<GrDirectContext> context)
: surface_size_(surface_size), context_(context) {
: surface_size_(surface_size), context_(std::move(context)) {
FML_CHECK(!surface_size_.isEmpty()) << "Surface size must not be empty";
}

Expand Down Expand Up @@ -118,16 +120,17 @@ size_t EmbedderTestCompositor::GetBackingStoresCollectedCount() const {
}

void EmbedderTestCompositor::AddOnCreateRenderTargetCallback(
fml::closure callback) {
const fml::closure& callback) {
on_create_render_target_callbacks_.push_back(callback);
}

void EmbedderTestCompositor::AddOnCollectRenderTargetCallback(
fml::closure callback) {
const fml::closure& callback) {
on_collect_render_target_callbacks_.push_back(callback);
}

void EmbedderTestCompositor::AddOnPresentCallback(fml::closure callback) {
void EmbedderTestCompositor::AddOnPresentCallback(
const fml::closure& callback) {
on_present_callbacks_.push_back(callback);
}

Expand Down
6 changes: 3 additions & 3 deletions shell/platform/embedder/tests/embedder_test_compositor.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ class EmbedderTestCompositor {

size_t GetBackingStoresCollectedCount() const;

void AddOnCreateRenderTargetCallback(fml::closure callback);
void AddOnCreateRenderTargetCallback(const fml::closure& callback);

void AddOnCollectRenderTargetCallback(fml::closure callback);
void AddOnCollectRenderTargetCallback(const fml::closure& callback);

void AddOnPresentCallback(fml::closure callback);
void AddOnPresentCallback(const fml::closure& callback);

sk_sp<GrDirectContext> GetGrContext();

Expand Down
4 changes: 3 additions & 1 deletion shell/platform/embedder/tests/embedder_test_compositor_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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

#include <utility>

#include "flutter/fml/logging.h"
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
#include "third_party/skia/include/core/SkSurface.h"
Expand All @@ -14,7 +16,7 @@ namespace testing {
EmbedderTestCompositorGL::EmbedderTestCompositorGL(
SkISize surface_size,
sk_sp<GrDirectContext> context)
: EmbedderTestCompositor(surface_size, context) {}
: EmbedderTestCompositor(surface_size, std::move(context)) {}

EmbedderTestCompositorGL::~EmbedderTestCompositorGL() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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

#include <utility>

#include "flutter/fml/logging.h"
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
#include "third_party/skia/include/core/SkSurface.h"
Expand All @@ -14,7 +16,7 @@ namespace testing {
EmbedderTestCompositorMetal::EmbedderTestCompositorMetal(
SkISize surface_size,
sk_sp<GrDirectContext> context)
: EmbedderTestCompositor(surface_size, context) {}
: EmbedderTestCompositor(surface_size, std::move(context)) {}

EmbedderTestCompositorMetal::~EmbedderTestCompositorMetal() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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

#include <utility>

#include "flutter/fml/logging.h"
#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
#include "flutter/shell/platform/embedder/tests/embedder_test_backingstore_producer.h"
Expand All @@ -15,7 +17,7 @@ namespace testing {
EmbedderTestCompositorVulkan::EmbedderTestCompositorVulkan(
SkISize surface_size,
sk_sp<GrDirectContext> context)
: EmbedderTestCompositor(surface_size, context) {}
: EmbedderTestCompositor(surface_size, std::move(context)) {}

EmbedderTestCompositorVulkan::~EmbedderTestCompositorVulkan() = default;

Expand Down
7 changes: 5 additions & 2 deletions shell/platform/embedder/tests/embedder_test_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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

#include <utility>

#include "flutter/fml/make_copyable.h"
#include "flutter/fml/paths.h"
#include "flutter/runtime/dart_vm.h"
Expand Down Expand Up @@ -94,7 +96,8 @@ void EmbedderTestContext::SetRootSurfaceTransformation(SkMatrix matrix) {
root_surface_transformation_ = matrix;
}

void EmbedderTestContext::AddIsolateCreateCallback(fml::closure closure) {
void EmbedderTestContext::AddIsolateCreateCallback(
const fml::closure& closure) {
if (closure) {
isolate_create_callbacks_.push_back(closure);
}
Expand Down Expand Up @@ -226,7 +229,7 @@ void EmbedderTestContext::FireRootSurfacePresentCallbackIfPresent(

void EmbedderTestContext::SetVsyncCallback(
std::function<void(intptr_t)> callback) {
vsync_callback_ = callback;
vsync_callback_ = std::move(callback);
}

void EmbedderTestContext::RunVsyncCallback(intptr_t baton) {
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/embedder/tests/embedder_test_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class EmbedderTestContext {

void SetRootSurfaceTransformation(SkMatrix matrix);

void AddIsolateCreateCallback(fml::closure closure);
void AddIsolateCreateCallback(const fml::closure& closure);

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

Expand Down
10 changes: 6 additions & 4 deletions shell/platform/embedder/tests/embedder_test_context_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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

#include <utility>

#include "flutter/fml/make_copyable.h"
#include "flutter/fml/paths.h"
#include "flutter/runtime/dart_vm.h"
Expand All @@ -18,7 +20,7 @@ namespace flutter {
namespace testing {

EmbedderTestContextGL::EmbedderTestContextGL(std::string assets_path)
: EmbedderTestContext(assets_path) {}
: EmbedderTestContext(std::move(assets_path)) {}

EmbedderTestContextGL::~EmbedderTestContextGL() {
SetGLGetFBOCallback(nullptr);
Expand Down Expand Up @@ -61,18 +63,18 @@ bool EmbedderTestContextGL::GLPresent(FlutterPresentInfo present_info) {

void EmbedderTestContextGL::SetGLGetFBOCallback(GLGetFBOCallback callback) {
std::scoped_lock lock(gl_callback_mutex_);
gl_get_fbo_callback_ = callback;
gl_get_fbo_callback_ = std::move(callback);
}

void EmbedderTestContextGL::SetGLPopulateExistingDamageCallback(
GLPopulateExistingDamageCallback callback) {
std::scoped_lock lock(gl_callback_mutex_);
gl_populate_existing_damage_callback_ = callback;
gl_populate_existing_damage_callback_ = std::move(callback);
}

void EmbedderTestContextGL::SetGLPresentCallback(GLPresentCallback callback) {
std::scoped_lock lock(gl_callback_mutex_);
gl_present_callback_ = callback;
gl_present_callback_ = std::move(callback);
}

uint32_t EmbedderTestContextGL::GLGetFramebuffer(FlutterFrameInfo frame_info) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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

#include <utility>

#include "flutter/fml/make_copyable.h"
#include "flutter/fml/paths.h"
#include "flutter/runtime/dart_vm.h"
Expand All @@ -18,11 +20,11 @@ namespace testing {

EmbedderTestContextSoftware::EmbedderTestContextSoftware(
std::string assets_path)
: EmbedderTestContext(assets_path) {}
: EmbedderTestContext(std::move(assets_path)) {}

EmbedderTestContextSoftware::~EmbedderTestContextSoftware() = default;

bool EmbedderTestContextSoftware::Present(sk_sp<SkImage> image) {
bool EmbedderTestContextSoftware::Present(const sk_sp<SkImage>& image) {
software_surface_present_count_++;

FireRootSurfacePresentCallbackIfPresent([image] { return image; });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class EmbedderTestContextSoftware : public EmbedderTestContext {
// |EmbedderTestContext|
EmbedderTestContextType GetContextType() const override;

bool Present(sk_sp<SkImage> image);
bool Present(const sk_sp<SkImage>& image);

protected:
virtual void SetupCompositor() override;
Expand Down
Loading

0 comments on commit eab8459

Please sign in to comment.