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

Commit 39fb458

Browse files
authored
Make runtime/... and shell/common/... compatible with .clang-tidy. (#48158)
1 parent 97cf063 commit 39fb458

13 files changed

+31
-17
lines changed

runtime/dart_isolate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class DartIsolate : public UIDartState {
9191
/// isolate and start over.
9292
///
9393
enum class Phase {
94+
// NOLINTBEGIN(readability-identifier-naming)
9495
//--------------------------------------------------------------------------
9596
/// The initial phase of all Dart isolates. This is an internal phase and
9697
/// callers can never get a reference to a Dart isolate in this phase.
@@ -132,6 +133,7 @@ class DartIsolate : public UIDartState {
132133
/// reference to a Dart isolate in this phase.
133134
///
134135
Shutdown,
136+
// NOLINTEND(readability-identifier-naming)
135137
};
136138

137139
//----------------------------------------------------------------------------

runtime/dart_vm_lifecycle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class DartVMRef {
7171
return vm_.get();
7272
}
7373

74+
// NOLINTNEXTLINE(google-runtime-operator)
7475
DartVM* operator&() {
7576
FML_DCHECK(vm_);
7677
return vm_.get();

shell/common/animator_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ TEST_F(ShellTest, VSyncTargetTime) {
104104
platform_task.wait();
105105
on_target_time_latch.Wait();
106106
const auto vsync_waiter_target_time =
107-
ConstantFiringVsyncWaiter::frame_target_time;
107+
ConstantFiringVsyncWaiter::kFrameTargetTime;
108108
ASSERT_EQ(vsync_waiter_target_time.ToEpochDelta().ToMicroseconds(),
109109
target_time);
110110

shell/common/engine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
7676
/// @brief Indicates the result of the call to `Engine::Run`.
7777
///
7878
enum class RunStatus {
79+
// NOLINTBEGIN(readability-identifier-naming)
7980
//--------------------------------------------------------------------------
8081
/// The call to |Engine::Run| was successful and the root isolate is in the
8182
/// `DartIsolate::Phase::Running` phase with its entry-point invocation
@@ -125,6 +126,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
125126
/// AOT mode operation of the Dart VM.
126127
///
127128
Failure,
129+
// NOLINTEND(readability-identifier-naming)
128130
};
129131

130132
//----------------------------------------------------------------------------

shell/common/pipeline.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ struct PipelineProduceResult {
2727
};
2828

2929
enum class PipelineConsumeResult {
30+
// NOLINTBEGIN(readability-identifier-naming)
3031
NoneAvailable,
3132
Done,
3233
MoreAvailable,
34+
// NOLINTEND(readability-identifier-naming)
3335
};
3436

3537
size_t GetNextPipelineTraceID();

shell/common/rasterizer.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ static constexpr std::chrono::milliseconds kSkiaCleanupExpiration(15000);
4242

4343
Rasterizer::Rasterizer(Delegate& delegate,
4444
MakeGpuImageBehavior gpu_image_behavior)
45-
: is_torn_down_(false),
46-
delegate_(delegate),
45+
: delegate_(delegate),
4746
gpu_image_behavior_(gpu_image_behavior),
4847
compositor_context_(std::make_unique<flutter::CompositorContext>(*this)),
49-
user_override_resource_cache_bytes_(false),
5048
snapshot_controller_(
5149
SnapshotController::Make(*this, delegate.GetSettings())),
5250
weak_factory_(this) {

shell/common/rasterizer.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ class Rasterizer final : public SnapshotDelegate,
344344
/// rendered layer tree.
345345
///
346346
enum class ScreenshotType {
347+
// NOLINTBEGIN(readability-identifier-naming)
347348
//--------------------------------------------------------------------------
348349
/// A format used to denote a Skia picture. A Skia picture is a serialized
349350
/// representation of an `SkPicture` that can be used to introspect the
@@ -373,6 +374,7 @@ class Rasterizer final : public SnapshotDelegate,
373374
/// is determined from the surface. This is the only way to read wide gamut
374375
/// color data, but isn't supported everywhere.
375376
SurfaceData,
377+
// NOLINTEND(readability-identifier-naming)
376378
};
377379

378380
//----------------------------------------------------------------------------
@@ -711,7 +713,7 @@ class Rasterizer final : public SnapshotDelegate,
711713
static bool ShouldResubmitFrame(const DoDrawResult& result);
712714
static DrawStatus ToDrawStatus(DoDrawStatus status);
713715

714-
bool is_torn_down_;
716+
bool is_torn_down_ = false;
715717
Delegate& delegate_;
716718
MakeGpuImageBehavior gpu_image_behavior_;
717719
std::weak_ptr<impeller::Context> impeller_context_;
@@ -720,7 +722,7 @@ class Rasterizer final : public SnapshotDelegate,
720722
std::unique_ptr<flutter::CompositorContext> compositor_context_;
721723
std::unordered_map<int64_t, ViewRecord> view_records_;
722724
fml::closure next_frame_callback_;
723-
bool user_override_resource_cache_bytes_;
725+
bool user_override_resource_cache_bytes_ = false;
724726
std::optional<size_t> max_cache_bytes_;
725727
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
726728
std::shared_ptr<ExternalViewEmbedder> external_view_embedder_;

shell/common/resource_cache_limit_calculator.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ class ResourceCacheLimitItem {
2424

2525
class ResourceCacheLimitCalculator {
2626
public:
27-
ResourceCacheLimitCalculator(size_t max_bytes_threshold)
27+
explicit ResourceCacheLimitCalculator(size_t max_bytes_threshold)
2828
: max_bytes_threshold_(max_bytes_threshold) {}
2929

3030
~ResourceCacheLimitCalculator() = default;
3131

3232
// This will be called on the platform thread.
33-
void AddResourceCacheLimitItem(fml::WeakPtr<ResourceCacheLimitItem> item) {
33+
void AddResourceCacheLimitItem(
34+
const fml::WeakPtr<ResourceCacheLimitItem>& item) {
3435
items_.push_back(item);
3536
}
3637

shell/common/shell.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ namespace flutter {
4545

4646
/// Error exit codes for the Dart isolate.
4747
enum class DartErrorCode {
48+
// NOLINTBEGIN(readability-identifier-naming)
4849
/// No error has occurred.
4950
NoError = 0,
5051
/// The Dart error code for an API error.
@@ -53,6 +54,7 @@ enum class DartErrorCode {
5354
CompilationError = 254,
5455
/// The Dart error code for an unknown error.
5556
UnknownError = 255
57+
// NOLINTEND(readability-identifier-naming)
5658
};
5759

5860
/// Values for |Shell::SetGpuAvailability|.

shell/common/shell_test_platform_view.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ShellTestPlatformView : public PlatformView {
3636

3737
protected:
3838
ShellTestPlatformView(PlatformView::Delegate& delegate,
39-
TaskRunners task_runners)
39+
const TaskRunners& task_runners)
4040
: PlatformView(delegate, task_runners) {}
4141

4242
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformView);
@@ -53,7 +53,7 @@ class ShellTestPlatformViewBuilder {
5353
ShellTestPlatformView::BackendType::kDefaultBackend;
5454
};
5555

56-
ShellTestPlatformViewBuilder(Config config);
56+
explicit ShellTestPlatformViewBuilder(Config config);
5757
~ShellTestPlatformViewBuilder() = default;
5858

5959
// Override operator () to make this class assignable to std::function.

shell/common/thread_host.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ using ThreadConfigSetter = fml::Thread::ThreadConfigSetter;
2020
/// The collection of all the threads used by the engine.
2121
struct ThreadHost {
2222
enum Type {
23+
// NOLINTBEGIN(readability-identifier-naming)
2324
Platform = 1 << 0,
2425
UI = 1 << 1,
2526
RASTER = 1 << 2,
2627
IO = 1 << 3,
2728
Profiler = 1 << 4,
29+
// NOLINTEND(readability-identifier-naming)
2830
};
2931

3032
/// The collection of all the thread configures, and we create custom thread

shell/common/vsync_waiters_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void ConstantFiringVsyncWaiter::AwaitVSync() {
6060
FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread());
6161
auto async_wait = std::async([this]() {
6262
task_runners_.GetPlatformTaskRunner()->PostTask(
63-
[this]() { FireCallback(frame_begin_time, frame_target_time); });
63+
[this]() { FireCallback(kFrameBeginTime, kFrameTargetTime); });
6464
});
6565
}
6666

shell/common/vsync_waiters_test.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef FLUTTER_SHELL_COMMON_VSYNC_WAITERS_TEST_H_
88
#define FLUTTER_SHELL_COMMON_VSYNC_WAITERS_TEST_H_
99

10+
#include <utility>
11+
1012
#include "flutter/shell/common/shell.h"
1113

1214
namespace flutter {
@@ -30,9 +32,9 @@ class ShellTestVsyncClock {
3032

3133
class ShellTestVsyncWaiter : public VsyncWaiter {
3234
public:
33-
ShellTestVsyncWaiter(TaskRunners task_runners,
35+
ShellTestVsyncWaiter(const TaskRunners& task_runners,
3436
std::shared_ptr<ShellTestVsyncClock> clock)
35-
: VsyncWaiter(std::move(task_runners)), clock_(clock) {}
37+
: VsyncWaiter(task_runners), clock_(std::move(clock)) {}
3638

3739
protected:
3840
void AwaitVSync() override;
@@ -44,13 +46,13 @@ class ShellTestVsyncWaiter : public VsyncWaiter {
4446
class ConstantFiringVsyncWaiter : public VsyncWaiter {
4547
public:
4648
// both of these are set in the past so as to fire immediately.
47-
static constexpr fml::TimePoint frame_begin_time =
49+
static constexpr fml::TimePoint kFrameBeginTime =
4850
fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromSeconds(0));
49-
static constexpr fml::TimePoint frame_target_time =
51+
static constexpr fml::TimePoint kFrameTargetTime =
5052
fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromSeconds(100));
5153

52-
explicit ConstantFiringVsyncWaiter(TaskRunners task_runners)
53-
: VsyncWaiter(std::move(task_runners)) {}
54+
explicit ConstantFiringVsyncWaiter(const TaskRunners& task_runners)
55+
: VsyncWaiter(task_runners) {}
5456

5557
protected:
5658
void AwaitVSync() override;

0 commit comments

Comments
 (0)