Make `runtime/...` and `shell/common/...` compatible with `.clang-tidy`. (#48158)
diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
index ace47f0..04e413a 100644
--- a/runtime/dart_isolate.h
+++ b/runtime/dart_isolate.h
@@ -91,6 +91,7 @@
/// isolate and start over.
///
enum class Phase {
+ // NOLINTBEGIN(readability-identifier-naming)
//--------------------------------------------------------------------------
/// The initial phase of all Dart isolates. This is an internal phase and
/// callers can never get a reference to a Dart isolate in this phase.
@@ -132,6 +133,7 @@
/// reference to a Dart isolate in this phase.
///
Shutdown,
+ // NOLINTEND(readability-identifier-naming)
};
//----------------------------------------------------------------------------
diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h
index c5b016b..0b7189f 100644
--- a/runtime/dart_vm_lifecycle.h
+++ b/runtime/dart_vm_lifecycle.h
@@ -71,6 +71,7 @@
return vm_.get();
}
+ // NOLINTNEXTLINE(google-runtime-operator)
DartVM* operator&() {
FML_DCHECK(vm_);
return vm_.get();
diff --git a/shell/common/animator_unittests.cc b/shell/common/animator_unittests.cc
index 80fd305..a1f96e7 100644
--- a/shell/common/animator_unittests.cc
+++ b/shell/common/animator_unittests.cc
@@ -104,7 +104,7 @@
platform_task.wait();
on_target_time_latch.Wait();
const auto vsync_waiter_target_time =
- ConstantFiringVsyncWaiter::frame_target_time;
+ ConstantFiringVsyncWaiter::kFrameTargetTime;
ASSERT_EQ(vsync_waiter_target_time.ToEpochDelta().ToMicroseconds(),
target_time);
diff --git a/shell/common/engine.h b/shell/common/engine.h
index 17ba3cc..abe4978 100644
--- a/shell/common/engine.h
+++ b/shell/common/engine.h
@@ -76,6 +76,7 @@
/// @brief Indicates the result of the call to `Engine::Run`.
///
enum class RunStatus {
+ // NOLINTBEGIN(readability-identifier-naming)
//--------------------------------------------------------------------------
/// The call to |Engine::Run| was successful and the root isolate is in the
/// `DartIsolate::Phase::Running` phase with its entry-point invocation
@@ -125,6 +126,7 @@
/// AOT mode operation of the Dart VM.
///
Failure,
+ // NOLINTEND(readability-identifier-naming)
};
//----------------------------------------------------------------------------
diff --git a/shell/common/pipeline.h b/shell/common/pipeline.h
index 72401ee..2657d96 100644
--- a/shell/common/pipeline.h
+++ b/shell/common/pipeline.h
@@ -27,9 +27,11 @@
};
enum class PipelineConsumeResult {
+ // NOLINTBEGIN(readability-identifier-naming)
NoneAvailable,
Done,
MoreAvailable,
+ // NOLINTEND(readability-identifier-naming)
};
size_t GetNextPipelineTraceID();
diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc
index 523bf53..7106a8a 100644
--- a/shell/common/rasterizer.cc
+++ b/shell/common/rasterizer.cc
@@ -42,11 +42,9 @@
Rasterizer::Rasterizer(Delegate& delegate,
MakeGpuImageBehavior gpu_image_behavior)
- : is_torn_down_(false),
- delegate_(delegate),
+ : delegate_(delegate),
gpu_image_behavior_(gpu_image_behavior),
compositor_context_(std::make_unique<flutter::CompositorContext>(*this)),
- user_override_resource_cache_bytes_(false),
snapshot_controller_(
SnapshotController::Make(*this, delegate.GetSettings())),
weak_factory_(this) {
diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h
index e5acbaf..d2d3c40 100644
--- a/shell/common/rasterizer.h
+++ b/shell/common/rasterizer.h
@@ -344,6 +344,7 @@
/// rendered layer tree.
///
enum class ScreenshotType {
+ // NOLINTBEGIN(readability-identifier-naming)
//--------------------------------------------------------------------------
/// A format used to denote a Skia picture. A Skia picture is a serialized
/// representation of an `SkPicture` that can be used to introspect the
@@ -373,6 +374,7 @@
/// is determined from the surface. This is the only way to read wide gamut
/// color data, but isn't supported everywhere.
SurfaceData,
+ // NOLINTEND(readability-identifier-naming)
};
//----------------------------------------------------------------------------
@@ -711,7 +713,7 @@
static bool ShouldResubmitFrame(const DoDrawResult& result);
static DrawStatus ToDrawStatus(DoDrawStatus status);
- bool is_torn_down_;
+ bool is_torn_down_ = false;
Delegate& delegate_;
MakeGpuImageBehavior gpu_image_behavior_;
std::weak_ptr<impeller::Context> impeller_context_;
@@ -720,7 +722,7 @@
std::unique_ptr<flutter::CompositorContext> compositor_context_;
std::unordered_map<int64_t, ViewRecord> view_records_;
fml::closure next_frame_callback_;
- bool user_override_resource_cache_bytes_;
+ bool user_override_resource_cache_bytes_ = false;
std::optional<size_t> max_cache_bytes_;
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
std::shared_ptr<ExternalViewEmbedder> external_view_embedder_;
diff --git a/shell/common/resource_cache_limit_calculator.h b/shell/common/resource_cache_limit_calculator.h
index 89ef8fd..2796547 100644
--- a/shell/common/resource_cache_limit_calculator.h
+++ b/shell/common/resource_cache_limit_calculator.h
@@ -24,13 +24,14 @@
class ResourceCacheLimitCalculator {
public:
- ResourceCacheLimitCalculator(size_t max_bytes_threshold)
+ explicit ResourceCacheLimitCalculator(size_t max_bytes_threshold)
: max_bytes_threshold_(max_bytes_threshold) {}
~ResourceCacheLimitCalculator() = default;
// This will be called on the platform thread.
- void AddResourceCacheLimitItem(fml::WeakPtr<ResourceCacheLimitItem> item) {
+ void AddResourceCacheLimitItem(
+ const fml::WeakPtr<ResourceCacheLimitItem>& item) {
items_.push_back(item);
}
diff --git a/shell/common/shell.h b/shell/common/shell.h
index 9eb5bd1..1e2574f 100644
--- a/shell/common/shell.h
+++ b/shell/common/shell.h
@@ -45,6 +45,7 @@
/// Error exit codes for the Dart isolate.
enum class DartErrorCode {
+ // NOLINTBEGIN(readability-identifier-naming)
/// No error has occurred.
NoError = 0,
/// The Dart error code for an API error.
@@ -53,6 +54,7 @@
CompilationError = 254,
/// The Dart error code for an unknown error.
UnknownError = 255
+ // NOLINTEND(readability-identifier-naming)
};
/// Values for |Shell::SetGpuAvailability|.
diff --git a/shell/common/shell_test_platform_view.h b/shell/common/shell_test_platform_view.h
index fdbe870..0caac65 100644
--- a/shell/common/shell_test_platform_view.h
+++ b/shell/common/shell_test_platform_view.h
@@ -36,7 +36,7 @@
protected:
ShellTestPlatformView(PlatformView::Delegate& delegate,
- TaskRunners task_runners)
+ const TaskRunners& task_runners)
: PlatformView(delegate, task_runners) {}
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformView);
@@ -53,7 +53,7 @@
ShellTestPlatformView::BackendType::kDefaultBackend;
};
- ShellTestPlatformViewBuilder(Config config);
+ explicit ShellTestPlatformViewBuilder(Config config);
~ShellTestPlatformViewBuilder() = default;
// Override operator () to make this class assignable to std::function.
diff --git a/shell/common/thread_host.h b/shell/common/thread_host.h
index cc423cd..89b0e8f 100644
--- a/shell/common/thread_host.h
+++ b/shell/common/thread_host.h
@@ -20,11 +20,13 @@
/// The collection of all the threads used by the engine.
struct ThreadHost {
enum Type {
+ // NOLINTBEGIN(readability-identifier-naming)
Platform = 1 << 0,
UI = 1 << 1,
RASTER = 1 << 2,
IO = 1 << 3,
Profiler = 1 << 4,
+ // NOLINTEND(readability-identifier-naming)
};
/// The collection of all the thread configures, and we create custom thread
diff --git a/shell/common/vsync_waiters_test.cc b/shell/common/vsync_waiters_test.cc
index ff26cc6..3c23795 100644
--- a/shell/common/vsync_waiters_test.cc
+++ b/shell/common/vsync_waiters_test.cc
@@ -60,7 +60,7 @@
FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread());
auto async_wait = std::async([this]() {
task_runners_.GetPlatformTaskRunner()->PostTask(
- [this]() { FireCallback(frame_begin_time, frame_target_time); });
+ [this]() { FireCallback(kFrameBeginTime, kFrameTargetTime); });
});
}
diff --git a/shell/common/vsync_waiters_test.h b/shell/common/vsync_waiters_test.h
index 80fa3ab..b141077 100644
--- a/shell/common/vsync_waiters_test.h
+++ b/shell/common/vsync_waiters_test.h
@@ -7,6 +7,8 @@
#ifndef FLUTTER_SHELL_COMMON_VSYNC_WAITERS_TEST_H_
#define FLUTTER_SHELL_COMMON_VSYNC_WAITERS_TEST_H_
+#include <utility>
+
#include "flutter/shell/common/shell.h"
namespace flutter {
@@ -30,9 +32,9 @@
class ShellTestVsyncWaiter : public VsyncWaiter {
public:
- ShellTestVsyncWaiter(TaskRunners task_runners,
+ ShellTestVsyncWaiter(const TaskRunners& task_runners,
std::shared_ptr<ShellTestVsyncClock> clock)
- : VsyncWaiter(std::move(task_runners)), clock_(clock) {}
+ : VsyncWaiter(task_runners), clock_(std::move(clock)) {}
protected:
void AwaitVSync() override;
@@ -44,13 +46,13 @@
class ConstantFiringVsyncWaiter : public VsyncWaiter {
public:
// both of these are set in the past so as to fire immediately.
- static constexpr fml::TimePoint frame_begin_time =
+ static constexpr fml::TimePoint kFrameBeginTime =
fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromSeconds(0));
- static constexpr fml::TimePoint frame_target_time =
+ static constexpr fml::TimePoint kFrameTargetTime =
fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromSeconds(100));
- explicit ConstantFiringVsyncWaiter(TaskRunners task_runners)
- : VsyncWaiter(std::move(task_runners)) {}
+ explicit ConstantFiringVsyncWaiter(const TaskRunners& task_runners)
+ : VsyncWaiter(task_runners) {}
protected:
void AwaitVSync() override;