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

Commit

Permalink
Make runtime/... and shell/common/... compatible with `.clang-tid…
Browse files Browse the repository at this point in the history
…y`. (#48158)
  • Loading branch information
matanlurey authored Nov 20, 2023
1 parent 97cf063 commit 39fb458
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 17 deletions.
2 changes: 2 additions & 0 deletions runtime/dart_isolate.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class DartIsolate : public UIDartState {
/// 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.
Expand Down Expand Up @@ -132,6 +133,7 @@ class DartIsolate : public UIDartState {
/// reference to a Dart isolate in this phase.
///
Shutdown,
// NOLINTEND(readability-identifier-naming)
};

//----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions runtime/dart_vm_lifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class DartVMRef {
return vm_.get();
}

// NOLINTNEXTLINE(google-runtime-operator)
DartVM* operator&() {
FML_DCHECK(vm_);
return vm_.get();
Expand Down
2 changes: 1 addition & 1 deletion shell/common/animator_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ TEST_F(ShellTest, VSyncTargetTime) {
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);

Expand Down
2 changes: 2 additions & 0 deletions shell/common/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
/// @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
Expand Down Expand Up @@ -125,6 +126,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
/// AOT mode operation of the Dart VM.
///
Failure,
// NOLINTEND(readability-identifier-naming)
};

//----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions shell/common/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ struct PipelineProduceResult {
};

enum class PipelineConsumeResult {
// NOLINTBEGIN(readability-identifier-naming)
NoneAvailable,
Done,
MoreAvailable,
// NOLINTEND(readability-identifier-naming)
};

size_t GetNextPipelineTraceID();
Expand Down
4 changes: 1 addition & 3 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ static constexpr std::chrono::milliseconds kSkiaCleanupExpiration(15000);

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) {
Expand Down
6 changes: 4 additions & 2 deletions shell/common/rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ class Rasterizer final : public SnapshotDelegate,
/// 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
Expand Down Expand Up @@ -373,6 +374,7 @@ class Rasterizer final : public SnapshotDelegate,
/// 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)
};

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -711,7 +713,7 @@ class Rasterizer final : public SnapshotDelegate,
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_;
Expand All @@ -720,7 +722,7 @@ class Rasterizer final : public SnapshotDelegate,
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_;
Expand Down
5 changes: 3 additions & 2 deletions shell/common/resource_cache_limit_calculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ class ResourceCacheLimitItem {

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);
}

Expand Down
2 changes: 2 additions & 0 deletions shell/common/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace flutter {

/// 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.
Expand All @@ -53,6 +54,7 @@ enum class DartErrorCode {
CompilationError = 254,
/// The Dart error code for an unknown error.
UnknownError = 255
// NOLINTEND(readability-identifier-naming)
};

/// Values for |Shell::SetGpuAvailability|.
Expand Down
4 changes: 2 additions & 2 deletions shell/common/shell_test_platform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ShellTestPlatformView : public PlatformView {

protected:
ShellTestPlatformView(PlatformView::Delegate& delegate,
TaskRunners task_runners)
const TaskRunners& task_runners)
: PlatformView(delegate, task_runners) {}

FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformView);
Expand All @@ -53,7 +53,7 @@ class ShellTestPlatformViewBuilder {
ShellTestPlatformView::BackendType::kDefaultBackend;
};

ShellTestPlatformViewBuilder(Config config);
explicit ShellTestPlatformViewBuilder(Config config);
~ShellTestPlatformViewBuilder() = default;

// Override operator () to make this class assignable to std::function.
Expand Down
2 changes: 2 additions & 0 deletions shell/common/thread_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ using ThreadConfigSetter = fml::Thread::ThreadConfigSetter;
/// 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
Expand Down
2 changes: 1 addition & 1 deletion shell/common/vsync_waiters_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void ConstantFiringVsyncWaiter::AwaitVSync() {
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); });
});
}

Expand Down
14 changes: 8 additions & 6 deletions shell/common/vsync_waiters_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -30,9 +32,9 @@ class ShellTestVsyncClock {

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;
Expand All @@ -44,13 +46,13 @@ class ShellTestVsyncWaiter : public VsyncWaiter {
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;
Expand Down

0 comments on commit 39fb458

Please sign in to comment.