diff --git a/engine/src/flutter/benchmarking/benchmarking.h b/engine/src/flutter/benchmarking/benchmarking.h index 663095f912..872c697c0e 100644 --- a/engine/src/flutter/benchmarking/benchmarking.h +++ b/engine/src/flutter/benchmarking/benchmarking.h @@ -11,7 +11,7 @@ namespace benchmarking { class ScopedPauseTiming { public: - ScopedPauseTiming(::benchmark::State& state, bool enabled = true) + explicit ScopedPauseTiming(::benchmark::State& state, bool enabled = true) : state_(state), enabled_(enabled) { if (enabled_) { state_.PauseTiming(); diff --git a/engine/src/flutter/common/graphics/gl_context_switch.h b/engine/src/flutter/common/graphics/gl_context_switch.h index 18710ce627..1f5a89164e 100644 --- a/engine/src/flutter/common/graphics/gl_context_switch.h +++ b/engine/src/flutter/common/graphics/gl_context_switch.h @@ -57,7 +57,7 @@ class GLContextResult { bool GetResult(); protected: - GLContextResult(bool static_result); + explicit GLContextResult(bool static_result); bool result_; FML_DISALLOW_COPY_AND_ASSIGN(GLContextResult); @@ -78,7 +78,7 @@ class GLContextDefaultResult : public GLContextResult { /// /// @param static_result a static value that will be returned from /// |GetResult| - GLContextDefaultResult(bool static_result); + explicit GLContextDefaultResult(bool static_result); ~GLContextDefaultResult() override; @@ -99,7 +99,7 @@ class GLContextSwitch final : public GLContextResult { /// @param context The context that is going to be set as the current /// context. The |GLContextSwitch| should not outlive the owner of the gl /// context wrapped inside the `context`. - GLContextSwitch(std::unique_ptr context); + explicit GLContextSwitch(std::unique_ptr context); ~GLContextSwitch() override; diff --git a/engine/src/flutter/common/graphics/persistent_cache.h b/engine/src/flutter/common/graphics/persistent_cache.h index b10651876b..3266654069 100644 --- a/engine/src/flutter/common/graphics/persistent_cache.h +++ b/engine/src/flutter/common/graphics/persistent_cache.h @@ -59,7 +59,7 @@ class PersistentCache : public GrContextOptions::PersistentCache { static const uint32_t kSignature = 0xA869593F; static const uint32_t kVersion1 = 1; - CacheObjectHeader(uint32_t p_key_size) : key_size(p_key_size) {} + explicit CacheObjectHeader(uint32_t p_key_size) : key_size(p_key_size) {} uint32_t signature = kSignature; uint32_t version = kVersion1; @@ -163,7 +163,7 @@ class PersistentCache : public GrContextOptions::PersistentCache { bool IsValid() const; - PersistentCache(bool read_only = false); + explicit PersistentCache(bool read_only = false); // |GrContextOptions::PersistentCache| void store(const SkData& key, const SkData& data) override; diff --git a/engine/src/flutter/flow/compositor_context.h b/engine/src/flutter/flow/compositor_context.h index 4a5dcc9cf9..6a973d861b 100644 --- a/engine/src/flutter/flow/compositor_context.h +++ b/engine/src/flutter/flow/compositor_context.h @@ -138,7 +138,8 @@ class CompositorContext { FML_DISALLOW_COPY_AND_ASSIGN(ScopedFrame); }; - CompositorContext(fml::Milliseconds frame_budget = fml::kDefaultFrameBudget); + explicit CompositorContext( + fml::Milliseconds frame_budget = fml::kDefaultFrameBudget); virtual ~CompositorContext(); diff --git a/engine/src/flutter/flow/display_list.cc b/engine/src/flutter/flow/display_list.cc index 5f0845e14f..a2f1965bd3 100644 --- a/engine/src/flutter/flow/display_list.cc +++ b/engine/src/flutter/flow/display_list.cc @@ -105,7 +105,7 @@ DEFINE_SET_ENUM_OP(Join) struct SetStyleOp final : DLOp { static const auto kType = DisplayListOpType::kSetStyle; - SetStyleOp(SkPaint::Style style) : style(style) {} + explicit SetStyleOp(SkPaint::Style style) : style(style) {} const SkPaint::Style style; @@ -115,7 +115,7 @@ struct SetStyleOp final : DLOp { struct SetStrokeWidthOp final : DLOp { static const auto kType = DisplayListOpType::kSetStrokeWidth; - SetStrokeWidthOp(SkScalar width) : width(width) {} + explicit SetStrokeWidthOp(SkScalar width) : width(width) {} const SkScalar width; @@ -127,7 +127,7 @@ struct SetStrokeWidthOp final : DLOp { struct SetStrokeMiterOp final : DLOp { static const auto kType = DisplayListOpType::kSetStrokeMiter; - SetStrokeMiterOp(SkScalar limit) : limit(limit) {} + explicit SetStrokeMiterOp(SkScalar limit) : limit(limit) {} const SkScalar limit; @@ -140,7 +140,7 @@ struct SetStrokeMiterOp final : DLOp { struct SetColorOp final : DLOp { static const auto kType = DisplayListOpType::kSetColor; - SetColorOp(SkColor color) : color(color) {} + explicit SetColorOp(SkColor color) : color(color) {} const SkColor color; @@ -150,7 +150,7 @@ struct SetColorOp final : DLOp { struct SetBlendModeOp final : DLOp { static const auto kType = DisplayListOpType::kSetBlendMode; - SetBlendModeOp(SkBlendMode mode) : mode(mode) {} + explicit SetBlendModeOp(SkBlendMode mode) : mode(mode) {} const SkBlendMode mode; @@ -224,7 +224,7 @@ struct SaveOp final : DLOp { struct SaveLayerOp final : DLOp { static const auto kType = DisplayListOpType::kSaveLayer; - SaveLayerOp(bool with_paint) : with_paint(with_paint) {} + explicit SaveLayerOp(bool with_paint) : with_paint(with_paint) {} bool with_paint; @@ -283,7 +283,7 @@ struct ScaleOp final : DLOp { struct RotateOp final : DLOp { static const auto kType = DisplayListOpType::kRotate; - RotateOp(SkScalar degrees) : degrees(degrees) {} + explicit RotateOp(SkScalar degrees) : degrees(degrees) {} const SkScalar degrees; @@ -454,7 +454,7 @@ DEFINE_DRAW_1ARG_OP(RRect, SkRRect, rrect) struct DrawPathOp final : DLOp { static const auto kType = DisplayListOpType::kDrawPath; - DrawPathOp(SkPath path) : path(path) {} + explicit DrawPathOp(SkPath path) : path(path) {} const SkPath path; @@ -804,7 +804,7 @@ struct DrawSkPictureMatrixOp final : DLOp { struct DrawDisplayListOp final : DLOp { static const auto kType = DisplayListOpType::kDrawDisplayList; - DrawDisplayListOp(const sk_sp display_list) + explicit DrawDisplayListOp(const sk_sp display_list) : display_list(std::move(display_list)) {} sk_sp display_list; diff --git a/engine/src/flutter/flow/display_list.h b/engine/src/flutter/flow/display_list.h index 171c8553a9..ebaed09d8a 100644 --- a/engine/src/flutter/flow/display_list.h +++ b/engine/src/flutter/flow/display_list.h @@ -747,7 +747,7 @@ class DisplayListOpFlags : DisplayListFlags { // the DisplayListCanvasRecorder class. class DisplayListBuilder final : public virtual Dispatcher, public SkRefCnt { public: - DisplayListBuilder(const SkRect& cull_rect = kMaxCullRect_); + explicit DisplayListBuilder(const SkRect& cull_rect = kMaxCullRect_); ~DisplayListBuilder(); void setAntiAlias(bool aa) override { diff --git a/engine/src/flutter/flow/display_list_canvas.h b/engine/src/flutter/flow/display_list_canvas.h index d48b7760ea..6c4d0f7727 100644 --- a/engine/src/flutter/flow/display_list_canvas.h +++ b/engine/src/flutter/flow/display_list_canvas.h @@ -27,7 +27,7 @@ namespace flutter { class DisplayListCanvasDispatcher : public virtual Dispatcher, public SkPaintDispatchHelper { public: - DisplayListCanvasDispatcher(SkCanvas* canvas) : canvas_(canvas) {} + explicit DisplayListCanvasDispatcher(SkCanvas* canvas) : canvas_(canvas) {} void save() override; void restore() override; @@ -123,7 +123,7 @@ class DisplayListCanvasRecorder public SkRefCnt, DisplayListOpFlags { public: - DisplayListCanvasRecorder(const SkRect& bounds); + explicit DisplayListCanvasRecorder(const SkRect& bounds); const sk_sp builder() { return builder_; } diff --git a/engine/src/flutter/flow/display_list_utils.h b/engine/src/flutter/flow/display_list_utils.h index 779c48fd56..a8d0d6f88c 100644 --- a/engine/src/flutter/flow/display_list_utils.h +++ b/engine/src/flutter/flow/display_list_utils.h @@ -199,7 +199,7 @@ class ClipBoundsDispatchHelper : public virtual Dispatcher, public: ClipBoundsDispatchHelper() : ClipBoundsDispatchHelper(nullptr) {} - ClipBoundsDispatchHelper(const SkRect* cull_rect) + explicit ClipBoundsDispatchHelper(const SkRect* cull_rect) : has_clip_(cull_rect), bounds_(cull_rect && !cull_rect->isEmpty() ? *cull_rect : SkRect::MakeEmpty()) {} @@ -279,7 +279,7 @@ class DisplayListBoundsCalculator final // queried using |isUnbounded| if an alternate plan is available // for such cases. // The flag should never be set if a cull_rect is provided. - DisplayListBoundsCalculator(const SkRect* cull_rect = nullptr); + explicit DisplayListBoundsCalculator(const SkRect* cull_rect = nullptr); void setStrokeCap(SkPaint::Cap cap) override; void setStrokeJoin(SkPaint::Join join) override; @@ -403,7 +403,8 @@ class DisplayListBoundsCalculator final // the stack. // Some layers may substitute their own accumulator to compute // their own local bounds while they are on the stack. - LayerData(BoundsAccumulator* outer) : outer_(outer), is_unbounded_(false) {} + explicit LayerData(BoundsAccumulator* outer) + : outer_(outer), is_unbounded_(false) {} virtual ~LayerData() = default; // The accumulator to use while this layer is put in play by diff --git a/engine/src/flutter/flow/frame_timings.h b/engine/src/flutter/flow/frame_timings.h index e6bfcbd0b2..8d39bb6145 100644 --- a/engine/src/flutter/flow/frame_timings.h +++ b/engine/src/flutter/flow/frame_timings.h @@ -41,7 +41,7 @@ class FrameTimingsRecorder { FrameTimingsRecorder(); /// Constructor with a pre-populated frame number. - FrameTimingsRecorder(uint64_t frame_number); + explicit FrameTimingsRecorder(uint64_t frame_number); ~FrameTimingsRecorder(); diff --git a/engine/src/flutter/flow/instrumentation.h b/engine/src/flutter/flow/instrumentation.h index 49ca887844..e38e7118f5 100644 --- a/engine/src/flutter/flow/instrumentation.h +++ b/engine/src/flutter/flow/instrumentation.h @@ -16,7 +16,7 @@ namespace flutter { class Stopwatch { public: - Stopwatch(fml::Milliseconds frame_budget = fml::kDefaultFrameBudget); + explicit Stopwatch(fml::Milliseconds frame_budget = fml::kDefaultFrameBudget); ~Stopwatch(); diff --git a/engine/src/flutter/flow/layers/clip_path_layer.h b/engine/src/flutter/flow/layers/clip_path_layer.h index 737b2ef89b..6e19e0a374 100644 --- a/engine/src/flutter/flow/layers/clip_path_layer.h +++ b/engine/src/flutter/flow/layers/clip_path_layer.h @@ -11,7 +11,8 @@ namespace flutter { class ClipPathLayer : public ContainerLayer { public: - ClipPathLayer(const SkPath& clip_path, Clip clip_behavior = Clip::antiAlias); + explicit ClipPathLayer(const SkPath& clip_path, + Clip clip_behavior = Clip::antiAlias); void Diff(DiffContext* context, const Layer* old_layer) override; diff --git a/engine/src/flutter/flow/layers/color_filter_layer.h b/engine/src/flutter/flow/layers/color_filter_layer.h index c3c2f2968f..e19d69377a 100644 --- a/engine/src/flutter/flow/layers/color_filter_layer.h +++ b/engine/src/flutter/flow/layers/color_filter_layer.h @@ -12,7 +12,7 @@ namespace flutter { class ColorFilterLayer : public ContainerLayer { public: - ColorFilterLayer(sk_sp filter); + explicit ColorFilterLayer(sk_sp filter); void Diff(DiffContext* context, const Layer* old_layer) override; diff --git a/engine/src/flutter/flow/layers/image_filter_layer.h b/engine/src/flutter/flow/layers/image_filter_layer.h index 488baa9242..48a0760d4b 100644 --- a/engine/src/flutter/flow/layers/image_filter_layer.h +++ b/engine/src/flutter/flow/layers/image_filter_layer.h @@ -12,7 +12,7 @@ namespace flutter { class ImageFilterLayer : public MergedContainerLayer { public: - ImageFilterLayer(sk_sp filter); + explicit ImageFilterLayer(sk_sp filter); void Diff(DiffContext* context, const Layer* old_layer) override; diff --git a/engine/src/flutter/flow/layers/transform_layer.h b/engine/src/flutter/flow/layers/transform_layer.h index d73c59a4b5..72ad561acd 100644 --- a/engine/src/flutter/flow/layers/transform_layer.h +++ b/engine/src/flutter/flow/layers/transform_layer.h @@ -13,7 +13,7 @@ namespace flutter { // at all. Hence |set_transform| must be called with an initialized SkMatrix. class TransformLayer : public ContainerLayer { public: - TransformLayer(const SkMatrix& transform); + explicit TransformLayer(const SkMatrix& transform); void Diff(DiffContext* context, const Layer* old_layer) override; diff --git a/engine/src/flutter/flow/testing/gl_context_switch_test.h b/engine/src/flutter/flow/testing/gl_context_switch_test.h index e2cd8b96c0..f3d06daf6b 100644 --- a/engine/src/flutter/flow/testing/gl_context_switch_test.h +++ b/engine/src/flutter/flow/testing/gl_context_switch_test.h @@ -20,7 +20,7 @@ class GLContextSwitchTest : public ::testing::Test { /// The renderer context used for testing class TestSwitchableGLContext : public SwitchableGLContext { public: - TestSwitchableGLContext(int context); + explicit TestSwitchableGLContext(int context); ~TestSwitchableGLContext() override; diff --git a/engine/src/flutter/flow/testing/mock_layer.h b/engine/src/flutter/flow/testing/mock_layer.h index a56c778593..77a01854a0 100644 --- a/engine/src/flutter/flow/testing/mock_layer.h +++ b/engine/src/flutter/flow/testing/mock_layer.h @@ -16,10 +16,10 @@ namespace testing { // verify the data against expected values. class MockLayer : public Layer { public: - MockLayer(SkPath path, - SkPaint paint = SkPaint(), - bool fake_has_platform_view = false, - bool fake_reads_surface = false); + explicit MockLayer(SkPath path, + SkPaint paint = SkPaint(), + bool fake_has_platform_view = false, + bool fake_reads_surface = false); void Preroll(PrerollContext* context, const SkMatrix& matrix) override; void Paint(PaintContext& context) const override; diff --git a/engine/src/flutter/flow/testing/mock_raster_cache.h b/engine/src/flutter/flow/testing/mock_raster_cache.h index 835e58c3b2..f51f700b3d 100644 --- a/engine/src/flutter/flow/testing/mock_raster_cache.h +++ b/engine/src/flutter/flow/testing/mock_raster_cache.h @@ -24,7 +24,7 @@ namespace testing { */ class MockRasterCacheResult : public RasterCacheResult { public: - MockRasterCacheResult(SkIRect device_rect); + explicit MockRasterCacheResult(SkIRect device_rect); void draw(SkCanvas& canvas, const SkPaint* paint = nullptr) const override{}; diff --git a/engine/src/flutter/fml/closure.h b/engine/src/flutter/fml/closure.h index ca7f60fdbb..7631f3a7be 100644 --- a/engine/src/flutter/fml/closure.h +++ b/engine/src/flutter/fml/closure.h @@ -33,7 +33,8 @@ class ScopedCleanupClosure { public: ScopedCleanupClosure() = default; - ScopedCleanupClosure(const fml::closure& closure) : closure_(closure) {} + explicit ScopedCleanupClosure(const fml::closure& closure) + : closure_(closure) {} ~ScopedCleanupClosure() { if (closure_) { diff --git a/engine/src/flutter/fml/concurrent_message_loop.h b/engine/src/flutter/fml/concurrent_message_loop.h index ebd8de9835..b79f309176 100644 --- a/engine/src/flutter/fml/concurrent_message_loop.h +++ b/engine/src/flutter/fml/concurrent_message_loop.h @@ -46,7 +46,7 @@ class ConcurrentMessageLoop std::map> thread_tasks_; bool shutdown_ = false; - ConcurrentMessageLoop(size_t worker_count); + explicit ConcurrentMessageLoop(size_t worker_count); void WorkerMain(); @@ -61,7 +61,7 @@ class ConcurrentMessageLoop class ConcurrentTaskRunner : public BasicTaskRunner { public: - ConcurrentTaskRunner(std::weak_ptr weak_loop); + explicit ConcurrentTaskRunner(std::weak_ptr weak_loop); virtual ~ConcurrentTaskRunner(); diff --git a/engine/src/flutter/fml/log_settings.h b/engine/src/flutter/fml/log_settings.h index 2921ebe8cc..6a3664f0d3 100644 --- a/engine/src/flutter/fml/log_settings.h +++ b/engine/src/flutter/fml/log_settings.h @@ -37,7 +37,7 @@ int GetMinLogLevel(); class ScopedSetLogSettings { public: - ScopedSetLogSettings(const LogSettings& settings); + explicit ScopedSetLogSettings(const LogSettings& settings); ~ScopedSetLogSettings(); private: diff --git a/engine/src/flutter/fml/mapping.h b/engine/src/flutter/fml/mapping.h index 741199126b..fd46eb728c 100644 --- a/engine/src/flutter/fml/mapping.h +++ b/engine/src/flutter/fml/mapping.h @@ -44,9 +44,9 @@ class FileMapping final : public Mapping { kExecute, }; - FileMapping(const fml::UniqueFD& fd, - std::initializer_list protection = { - Protection::kRead}); + explicit FileMapping(const fml::UniqueFD& fd, + std::initializer_list protection = { + Protection::kRead}); ~FileMapping() override; @@ -91,9 +91,9 @@ class FileMapping final : public Mapping { class DataMapping final : public Mapping { public: - DataMapping(std::vector data); + explicit DataMapping(std::vector data); - DataMapping(const std::string& string); + explicit DataMapping(const std::string& string); ~DataMapping() override; diff --git a/engine/src/flutter/fml/memory/ref_ptr.h b/engine/src/flutter/fml/memory/ref_ptr.h index 1c8efd4e0c..c426a4901d 100644 --- a/engine/src/flutter/fml/memory/ref_ptr.h +++ b/engine/src/flutter/fml/memory/ref_ptr.h @@ -65,8 +65,8 @@ template class RefPtr final { public: RefPtr() : ptr_(nullptr) {} - RefPtr(std::nullptr_t) - : ptr_(nullptr) {} // NOLINT(google-explicit-constructor) + RefPtr(std::nullptr_t) // NOLINT(google-explicit-constructor) + : ptr_(nullptr) {} // Explicit constructor from a plain pointer (to an object that must have // already been adopted). (Note that in |T::T()|, references to |this| cannot @@ -80,22 +80,25 @@ class RefPtr final { } // Copy constructor. - RefPtr(const RefPtr& r) : ptr_(r.ptr_) { + RefPtr(const RefPtr& r) // NOLINT(google-explicit-constructor) + : ptr_(r.ptr_) { if (ptr_) { ptr_->AddRef(); } } template - RefPtr(const RefPtr& r) - : ptr_(r.ptr_) { // NOLINT(google-explicit-constructor) + RefPtr(const RefPtr& r) // NOLINT(google-explicit-constructor) + : ptr_(r.ptr_) { if (ptr_) { ptr_->AddRef(); } } // Move constructor. - RefPtr(RefPtr&& r) : ptr_(r.ptr_) { r.ptr_ = nullptr; } + RefPtr(RefPtr&& r) : ptr_(r.ptr_) { // NOLINT(google-explicit-constructor) + r.ptr_ = nullptr; + } template RefPtr(RefPtr&& r) : ptr_(r.ptr_) { // NOLINT(google-explicit-constructor) diff --git a/engine/src/flutter/fml/memory/weak_ptr.h b/engine/src/flutter/fml/memory/weak_ptr.h index caaecaff2f..2ff448ea36 100644 --- a/engine/src/flutter/fml/memory/weak_ptr.h +++ b/engine/src/flutter/fml/memory/weak_ptr.h @@ -49,17 +49,18 @@ class WeakPtr { WeakPtr() : ptr_(nullptr) {} // Copy constructor. - explicit WeakPtr(const WeakPtr& r) = default; + // NOLINTNEXTLINE(google-explicit-constructor) + WeakPtr(const WeakPtr& r) = default; template - WeakPtr(const WeakPtr& r) + WeakPtr(const WeakPtr& r) // NOLINT(google-explicit-constructor) : ptr_(static_cast(r.ptr_)), flag_(r.flag_), checker_(r.checker_) {} // Move constructor. WeakPtr(WeakPtr&& r) = default; template - WeakPtr(WeakPtr&& r) + WeakPtr(WeakPtr&& r) // NOLINT(google-explicit-constructor) : ptr_(static_cast(r.ptr_)), flag_(std::move(r.flag_)), checker_(r.checker_) {} @@ -155,12 +156,14 @@ class TaskRunnerAffineWeakPtr : public WeakPtr { TaskRunnerAffineWeakPtr(const TaskRunnerAffineWeakPtr& r) = default; template + // NOLINTNEXTLINE(google-explicit-constructor) TaskRunnerAffineWeakPtr(const TaskRunnerAffineWeakPtr& r) : WeakPtr(r), checker_(r.checker_) {} TaskRunnerAffineWeakPtr(TaskRunnerAffineWeakPtr&& r) = default; template + // NOLINTNEXTLINE(google-explicit-constructor) TaskRunnerAffineWeakPtr(TaskRunnerAffineWeakPtr&& r) : WeakPtr(r), checker_(r.checker_) {} diff --git a/engine/src/flutter/fml/native_library.h b/engine/src/flutter/fml/native_library.h index a6174b9eb6..175afed3ed 100644 --- a/engine/src/flutter/fml/native_library.h +++ b/engine/src/flutter/fml/native_library.h @@ -56,7 +56,7 @@ class NativeLibrary : public fml::RefCountedThreadSafe { Handle handle_ = nullptr; bool close_handle_ = true; - NativeLibrary(const char* path); + explicit NativeLibrary(const char* path); NativeLibrary(Handle handle, bool close_handle); diff --git a/engine/src/flutter/fml/synchronization/atomic_object.h b/engine/src/flutter/fml/synchronization/atomic_object.h index 9fdbe19c82..c5c25cb27c 100644 --- a/engine/src/flutter/fml/synchronization/atomic_object.h +++ b/engine/src/flutter/fml/synchronization/atomic_object.h @@ -14,7 +14,7 @@ template class AtomicObject { public: AtomicObject() = default; - AtomicObject(T object) : object_(object) {} + explicit AtomicObject(T object) : object_(object) {} T Load() const { std::scoped_lock lock(mutex_); diff --git a/engine/src/flutter/fml/synchronization/count_down_latch.h b/engine/src/flutter/fml/synchronization/count_down_latch.h index 4fd4377a0d..314db8d6e0 100644 --- a/engine/src/flutter/fml/synchronization/count_down_latch.h +++ b/engine/src/flutter/fml/synchronization/count_down_latch.h @@ -14,7 +14,7 @@ namespace fml { class CountDownLatch { public: - CountDownLatch(size_t count); + explicit CountDownLatch(size_t count); ~CountDownLatch(); diff --git a/engine/src/flutter/fml/task_queue_id.h b/engine/src/flutter/fml/task_queue_id.h index 2395f9db92..3b37e16bd9 100644 --- a/engine/src/flutter/fml/task_queue_id.h +++ b/engine/src/flutter/fml/task_queue_id.h @@ -21,7 +21,9 @@ class TaskQueueId { /// Intializes a task queue with the given value as it's ID. explicit TaskQueueId(size_t value) : value_(value) {} - operator size_t() const { return value_; } + operator size_t() const { // NOLINT(google-explicit-constructor) + return value_; + } private: size_t value_ = kUnmerged; diff --git a/engine/src/flutter/fml/task_runner.h b/engine/src/flutter/fml/task_runner.h index d65c3e919b..cdab31181e 100644 --- a/engine/src/flutter/fml/task_runner.h +++ b/engine/src/flutter/fml/task_runner.h @@ -63,7 +63,7 @@ class TaskRunner : public fml::RefCountedThreadSafe, const fml::closure& task); protected: - TaskRunner(fml::RefPtr loop); + explicit TaskRunner(fml::RefPtr loop); private: fml::RefPtr loop_; diff --git a/engine/src/flutter/fml/thread_local.h b/engine/src/flutter/fml/thread_local.h index 72ef80c8eb..ed6336c961 100644 --- a/engine/src/flutter/fml/thread_local.h +++ b/engine/src/flutter/fml/thread_local.h @@ -26,7 +26,7 @@ namespace internal { class ThreadLocalPointer { public: - ThreadLocalPointer(void (*destroy)(void*)); + explicit ThreadLocalPointer(void (*destroy)(void*)); ~ThreadLocalPointer(); void* get() const; diff --git a/engine/src/flutter/fml/trace_event.h b/engine/src/flutter/fml/trace_event.h index 13e60cb511..38a3ea2a9b 100644 --- a/engine/src/flutter/fml/trace_event.h +++ b/engine/src/flutter/fml/trace_event.h @@ -343,7 +343,7 @@ void TraceEventFlowEnd0(TraceArg category_group, TraceArg name, TraceIDArg id); class ScopedInstantEnd { public: - ScopedInstantEnd(const char* str) : label_(str) {} + explicit ScopedInstantEnd(const char* str) : label_(str) {} ~ScopedInstantEnd() { TraceEventEnd(label_); } @@ -360,7 +360,7 @@ class ScopedInstantEnd { // leads to corrupted or missing traces in the UI. class TraceFlow { public: - TraceFlow(const char* label) : label_(label), nonce_(TraceNonce()) { + explicit TraceFlow(const char* label) : label_(label), nonce_(TraceNonce()) { TraceEventFlowBegin0("flutter", label_, nonce_); } diff --git a/engine/src/flutter/lib/ui/painting/fragment_shader.h b/engine/src/flutter/lib/ui/painting/fragment_shader.h index 905711e24d..446116a2ed 100644 --- a/engine/src/flutter/lib/ui/painting/fragment_shader.h +++ b/engine/src/flutter/lib/ui/painting/fragment_shader.h @@ -37,7 +37,7 @@ class FragmentShader : public Shader { static void RegisterNatives(tonic::DartLibraryNatives* natives); private: - FragmentShader(sk_sp shader); + explicit FragmentShader(sk_sp shader); sk_sp shader_; }; diff --git a/engine/src/flutter/lib/ui/painting/image_generator.h b/engine/src/flutter/lib/ui/painting/image_generator.h index ae58163744..c3ed972259 100644 --- a/engine/src/flutter/lib/ui/painting/image_generator.h +++ b/engine/src/flutter/lib/ui/painting/image_generator.h @@ -133,7 +133,8 @@ class BuiltinSkiaImageGenerator : public ImageGenerator { public: ~BuiltinSkiaImageGenerator(); - BuiltinSkiaImageGenerator(std::unique_ptr generator); + explicit BuiltinSkiaImageGenerator( + std::unique_ptr generator); // |ImageGenerator| const SkImageInfo& GetInfo() override; @@ -171,9 +172,9 @@ class BuiltinSkiaCodecImageGenerator : public ImageGenerator { public: ~BuiltinSkiaCodecImageGenerator(); - BuiltinSkiaCodecImageGenerator(std::unique_ptr codec); + explicit BuiltinSkiaCodecImageGenerator(std::unique_ptr codec); - BuiltinSkiaCodecImageGenerator(sk_sp buffer); + explicit BuiltinSkiaCodecImageGenerator(sk_sp buffer); // |ImageGenerator| const SkImageInfo& GetInfo() override; diff --git a/engine/src/flutter/lib/ui/painting/multi_frame_codec.h b/engine/src/flutter/lib/ui/painting/multi_frame_codec.h index 187bd59f72..0072131ad4 100644 --- a/engine/src/flutter/lib/ui/painting/multi_frame_codec.h +++ b/engine/src/flutter/lib/ui/painting/multi_frame_codec.h @@ -13,7 +13,7 @@ namespace flutter { class MultiFrameCodec : public Codec { public: - MultiFrameCodec(std::shared_ptr generator); + explicit MultiFrameCodec(std::shared_ptr generator); ~MultiFrameCodec() override; @@ -37,7 +37,7 @@ class MultiFrameCodec : public Codec { // shares it with the IO task runner's decoding work, and sets the live_ // member to false when it is destructed. struct State { - State(std::shared_ptr generator); + explicit State(std::shared_ptr generator); const std::shared_ptr generator_; const int frameCount_; diff --git a/engine/src/flutter/lib/ui/painting/picture.h b/engine/src/flutter/lib/ui/painting/picture.h index bcaf4ebbc8..8752cc83bd 100644 --- a/engine/src/flutter/lib/ui/painting/picture.h +++ b/engine/src/flutter/lib/ui/painting/picture.h @@ -58,8 +58,8 @@ class Picture : public RefCountedDartWrappable { Dart_Handle raw_image_callback); private: - Picture(flutter::SkiaGPUObject picture); - Picture(flutter::SkiaGPUObject display_list); + explicit Picture(flutter::SkiaGPUObject picture); + explicit Picture(flutter::SkiaGPUObject display_list); flutter::SkiaGPUObject picture_; flutter::SkiaGPUObject display_list_; diff --git a/engine/src/flutter/lib/ui/text/asset_manager_font_provider.h b/engine/src/flutter/lib/ui/text/asset_manager_font_provider.h index ef4d272664..5ffbf897cd 100644 --- a/engine/src/flutter/lib/ui/text/asset_manager_font_provider.h +++ b/engine/src/flutter/lib/ui/text/asset_manager_font_provider.h @@ -44,7 +44,7 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { std::string family_name_; struct TypefaceAsset { - TypefaceAsset(std::string a); + explicit TypefaceAsset(std::string a); TypefaceAsset(const TypefaceAsset& other); @@ -60,7 +60,8 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { class AssetManagerFontProvider : public txt::FontAssetProvider { public: - AssetManagerFontProvider(std::shared_ptr asset_manager); + explicit AssetManagerFontProvider( + std::shared_ptr asset_manager); ~AssetManagerFontProvider() override; diff --git a/engine/src/flutter/lib/ui/ui_dart_state.h b/engine/src/flutter/lib/ui/ui_dart_state.h index f79d584ad0..df0460b914 100644 --- a/engine/src/flutter/lib/ui/ui_dart_state.h +++ b/engine/src/flutter/lib/ui/ui_dart_state.h @@ -41,7 +41,7 @@ class UIDartState : public tonic::DartState { /// UIDartState, a pointer to the resource can be added to this /// struct with appropriate default construction. struct Context { - Context(const TaskRunners& task_runners); + explicit Context(const TaskRunners& task_runners); Context(const TaskRunners& task_runners, fml::WeakPtr snapshot_delegate, diff --git a/engine/src/flutter/runtime/dart_isolate.h b/engine/src/flutter/runtime/dart_isolate.h index 44f3969b31..8e81577f9a 100644 --- a/engine/src/flutter/runtime/dart_isolate.h +++ b/engine/src/flutter/runtime/dart_isolate.h @@ -415,7 +415,7 @@ class DartIsolate : public UIDartState { friend class IsolateConfiguration; class AutoFireClosure { public: - AutoFireClosure(const fml::closure& closure); + explicit AutoFireClosure(const fml::closure& closure); ~AutoFireClosure(); diff --git a/engine/src/flutter/runtime/dart_vm_lifecycle.cc b/engine/src/flutter/runtime/dart_vm_lifecycle.cc index e621f00655..c033cabe39 100644 --- a/engine/src/flutter/runtime/dart_vm_lifecycle.cc +++ b/engine/src/flutter/runtime/dart_vm_lifecycle.cc @@ -82,7 +82,7 @@ DartVMRef DartVMRef::Create(Settings settings, if (!vm) { FML_LOG(ERROR) << "Could not create Dart VM instance."; - return {nullptr}; + return DartVMRef{nullptr}; } gVMData = vm->GetVMData(); diff --git a/engine/src/flutter/runtime/dart_vm_lifecycle.h b/engine/src/flutter/runtime/dart_vm_lifecycle.h index 7c32882459..2573fa50fc 100644 --- a/engine/src/flutter/runtime/dart_vm_lifecycle.h +++ b/engine/src/flutter/runtime/dart_vm_lifecycle.h @@ -49,7 +49,7 @@ class DartVMRef { static std::shared_ptr GetIsolateNameServer(); - operator bool() const { return static_cast(vm_); } + explicit operator bool() const { return static_cast(vm_); } DartVM* get() { FML_DCHECK(vm_); @@ -81,7 +81,7 @@ class DartVMRef { std::shared_ptr vm_; - DartVMRef(std::shared_ptr vm); + explicit DartVMRef(std::shared_ptr vm); // Only used by Dart Isolate to register itself with the VM. static DartVM* GetRunningVM(); diff --git a/engine/src/flutter/runtime/embedder_resources.h b/engine/src/flutter/runtime/embedder_resources.h index 859268d9dc..e6dca91ac6 100644 --- a/engine/src/flutter/runtime/embedder_resources.h +++ b/engine/src/flutter/runtime/embedder_resources.h @@ -21,7 +21,7 @@ namespace flutter { class EmbedderResources { public: - EmbedderResources(runtime::ResourcesEntry* resources_table); + explicit EmbedderResources(runtime::ResourcesEntry* resources_table); static const int kNoSuchInstance; diff --git a/engine/src/flutter/runtime/skia_concurrent_executor.h b/engine/src/flutter/runtime/skia_concurrent_executor.h index 87dde23936..0753206beb 100644 --- a/engine/src/flutter/runtime/skia_concurrent_executor.h +++ b/engine/src/flutter/runtime/skia_concurrent_executor.h @@ -37,7 +37,7 @@ class SkiaConcurrentExecutor : public SkExecutor { /// /// @param[in] on_work The work callback. /// - SkiaConcurrentExecutor(const OnWorkCallback& on_work); + explicit SkiaConcurrentExecutor(const OnWorkCallback& on_work); // |SkExecutor| ~SkiaConcurrentExecutor() override; diff --git a/engine/src/flutter/shell/common/canvas_spy.h b/engine/src/flutter/shell/common/canvas_spy.h index 3d88b9d91b..ed9b5e0728 100644 --- a/engine/src/flutter/shell/common/canvas_spy.h +++ b/engine/src/flutter/shell/common/canvas_spy.h @@ -24,7 +24,7 @@ class DidDrawCanvas; /// are specific to empty canvases. class CanvasSpy { public: - CanvasSpy(SkCanvas* target_canvas); + explicit CanvasSpy(SkCanvas* target_canvas); //---------------------------------------------------------------------------- /// @brief Returns true if any non transparent content has been drawn diff --git a/engine/src/flutter/shell/common/pipeline.h b/engine/src/flutter/shell/common/pipeline.h index f51f41e942..1bc43d0cf5 100644 --- a/engine/src/flutter/shell/common/pipeline.h +++ b/engine/src/flutter/shell/common/pipeline.h @@ -71,7 +71,7 @@ class Pipeline { return result; } - operator bool() const { return continuation_ != nullptr; } + explicit operator bool() const { return continuation_ != nullptr; } private: friend class Pipeline; diff --git a/engine/src/flutter/shell/common/pointer_data_dispatcher.h b/engine/src/flutter/shell/common/pointer_data_dispatcher.h index 567ed5e525..bfbf3a235c 100644 --- a/engine/src/flutter/shell/common/pointer_data_dispatcher.h +++ b/engine/src/flutter/shell/common/pointer_data_dispatcher.h @@ -84,7 +84,8 @@ class PointerDataDispatcher { /// class DefaultPointerDataDispatcher : public PointerDataDispatcher { public: - DefaultPointerDataDispatcher(Delegate& delegate) : delegate_(delegate) {} + explicit DefaultPointerDataDispatcher(Delegate& delegate) + : delegate_(delegate) {} // |PointerDataDispatcer| void DispatchPacket(std::unique_ptr packet, @@ -138,7 +139,7 @@ class DefaultPointerDataDispatcher : public PointerDataDispatcher { /// See also input_events_unittests.cc where we test all our claims above. class SmoothPointerDataDispatcher : public DefaultPointerDataDispatcher { public: - SmoothPointerDataDispatcher(Delegate& delegate); + explicit SmoothPointerDataDispatcher(Delegate& delegate); // |PointerDataDispatcer| void DispatchPacket(std::unique_ptr packet, diff --git a/engine/src/flutter/shell/common/rasterizer.h b/engine/src/flutter/shell/common/rasterizer.h index 4d25d3b16c..6fe2ffb5f9 100644 --- a/engine/src/flutter/shell/common/rasterizer.h +++ b/engine/src/flutter/shell/common/rasterizer.h @@ -105,7 +105,7 @@ class Rasterizer final : public SnapshotDelegate { /// /// @param[in] delegate The rasterizer delegate. /// - Rasterizer(Delegate& delegate); + explicit Rasterizer(Delegate& delegate); //---------------------------------------------------------------------------- /// @brief Destroys the rasterizer. This must happen on the raster task diff --git a/engine/src/flutter/shell/common/run_configuration.h b/engine/src/flutter/shell/common/run_configuration.h index cb5a5b531d..2a223efc1d 100644 --- a/engine/src/flutter/shell/common/run_configuration.h +++ b/engine/src/flutter/shell/common/run_configuration.h @@ -66,7 +66,8 @@ class RunConfiguration { /// /// @param[in] configuration The configuration /// - RunConfiguration(std::unique_ptr configuration); + explicit RunConfiguration( + std::unique_ptr configuration); //---------------------------------------------------------------------------- /// @brief Creates a run configuration with the specified isolate diff --git a/engine/src/flutter/shell/common/vsync_waiters_test.h b/engine/src/flutter/shell/common/vsync_waiters_test.h index f2d313621a..66f474b765 100644 --- a/engine/src/flutter/shell/common/vsync_waiters_test.h +++ b/engine/src/flutter/shell/common/vsync_waiters_test.h @@ -49,7 +49,7 @@ class ConstantFiringVsyncWaiter : public VsyncWaiter { static constexpr fml::TimePoint frame_target_time = fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromSeconds(100)); - ConstantFiringVsyncWaiter(TaskRunners task_runners) + explicit ConstantFiringVsyncWaiter(TaskRunners task_runners) : VsyncWaiter(std::move(task_runners)) {} protected: diff --git a/engine/src/flutter/shell/platform/android/platform_view_android_delegate/platform_view_android_delegate.h b/engine/src/flutter/shell/platform/android/platform_view_android_delegate/platform_view_android_delegate.h index 3f76f34c51..e1e55a2300 100644 --- a/engine/src/flutter/shell/platform/android/platform_view_android_delegate/platform_view_android_delegate.h +++ b/engine/src/flutter/shell/platform/android/platform_view_android_delegate/platform_view_android_delegate.h @@ -16,7 +16,7 @@ namespace flutter { class PlatformViewAndroidDelegate { public: - PlatformViewAndroidDelegate( + explicit PlatformViewAndroidDelegate( std::shared_ptr jni_facade); void UpdateSemantics(flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions); diff --git a/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h b/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h index dec1bdfc4b..3b46f99f63 100644 --- a/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h +++ b/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h @@ -63,7 +63,9 @@ class CustomEncodableValue { ~CustomEncodableValue() = default; // Allow implicit conversion to std::any to allow direct use of any_cast. + // NOLINTNEXTLINE(google-explicit-constructor) operator std::any&() { return value_; } + // NOLINTNEXTLINE(google-explicit-constructor) operator const std::any&() const { return value_; } #if defined(FLUTTER_ENABLE_RTTI) && FLUTTER_ENABLE_RTTI @@ -182,6 +184,7 @@ class EncodableValue : public internal::EncodableValueVariant { // to use it with EncodableValue, so the risk of unintended conversions is // minimal, and it avoids the need for the verbose: // EncodableValue(CustomEncodableValue(...)). + // NOLINTNEXTLINE(google-explicit-constructor) EncodableValue(const CustomEncodableValue& v) : super(v) {} // Override the conversion constructors from std::variant to make them diff --git a/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/engine_method_result.h b/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/engine_method_result.h index c29ff09b77..3cc8b6a22c 100644 --- a/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/engine_method_result.h +++ b/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/engine_method_result.h @@ -21,7 +21,7 @@ namespace internal { // vary based on the template type. class ReplyManager { public: - ReplyManager(BinaryReply reply_handler_); + explicit ReplyManager(BinaryReply reply_handler_); ~ReplyManager(); // Prevent copying. diff --git a/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/texture_registrar.h b/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/texture_registrar.h index 5b59829f24..6aa2c6b1d8 100644 --- a/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/texture_registrar.h +++ b/engine/src/flutter/shell/platform/common/client_wrapper/include/flutter/texture_registrar.h @@ -27,7 +27,7 @@ class PixelBufferTexture { // As the callback is usually invoked from the render thread, the callee must // take care of proper synchronization. It also needs to be ensured that the // returned buffer isn't released prior to unregistering this texture. - PixelBufferTexture(CopyBufferCallback copy_buffer_callback) + explicit PixelBufferTexture(CopyBufferCallback copy_buffer_callback) : copy_buffer_callback_(copy_buffer_callback) {} // Returns the callback-provided FlutterDesktopPixelBuffer that contains the diff --git a/engine/src/flutter/shell/platform/common/client_wrapper/testing/stub_flutter_api.h b/engine/src/flutter/shell/platform/common/client_wrapper/testing/stub_flutter_api.h index 71edec1bc1..6d40719fd4 100644 --- a/engine/src/flutter/shell/platform/common/client_wrapper/testing/stub_flutter_api.h +++ b/engine/src/flutter/shell/platform/common/client_wrapper/testing/stub_flutter_api.h @@ -87,7 +87,7 @@ class StubFlutterApi { class ScopedStubFlutterApi { public: // Calls SetTestFlutterStub with |stub|. - ScopedStubFlutterApi(std::unique_ptr stub); + explicit ScopedStubFlutterApi(std::unique_ptr stub); // Restores the previous test stub. ~ScopedStubFlutterApi(); diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_view.h b/engine/src/flutter/shell/platform/embedder/embedder_external_view.h index 261d4db2b1..59fcf4260b 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_view.h +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_view.h @@ -26,7 +26,8 @@ class EmbedderExternalView { ViewIdentifier() {} - ViewIdentifier(PlatformViewID view_id) : platform_view_id(view_id) {} + explicit ViewIdentifier(PlatformViewID view_id) + : platform_view_id(view_id) {} struct Hash { constexpr std::size_t operator()(const ViewIdentifier& desc) const { diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_view_embedder.cc b/engine/src/flutter/shell/platform/embedder/embedder_external_view_embedder.cc index a890260887..14927f4833 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_view_embedder.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_view_embedder.cc @@ -72,15 +72,16 @@ void EmbedderExternalViewEmbedder::BeginFrame( void EmbedderExternalViewEmbedder::PrerollCompositeEmbeddedView( int view_id, std::unique_ptr params) { - FML_DCHECK(pending_views_.count(view_id) == 0); + auto vid = EmbedderExternalView::ViewIdentifier(view_id); + FML_DCHECK(pending_views_.count(vid) == 0); - pending_views_[view_id] = std::make_unique( + pending_views_[vid] = std::make_unique( pending_frame_size_, // frame size pending_surface_transformation_, // surface xformation - view_id, // view identifier + vid, // view identifier std::move(params) // embedded view params ); - composition_order_.push_back(view_id); + composition_order_.push_back(vid); } // |ExternalViewEmbedder| @@ -111,7 +112,8 @@ std::vector EmbedderExternalViewEmbedder::GetCurrentCanvases() { // |ExternalViewEmbedder| SkCanvas* EmbedderExternalViewEmbedder::CompositeEmbeddedView(int view_id) { - auto found = pending_views_.find(view_id); + auto vid = EmbedderExternalView::ViewIdentifier(view_id); + auto found = pending_views_.find(vid); if (found == pending_views_.end()) { FML_DCHECK(false) << "Attempted to composite a view that was not " "pre-rolled."; diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.h b/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.h index 17a1dd4161..ee1fb514bb 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.h +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.h @@ -36,9 +36,10 @@ class EmbedderConfigBuilder { kNoInitialize, }; - EmbedderConfigBuilder(EmbedderTestContext& context, - InitializationPreference preference = - InitializationPreference::kSnapshotsInitialize); + explicit EmbedderConfigBuilder( + EmbedderTestContext& context, + InitializationPreference preference = + InitializationPreference::kSnapshotsInitialize); ~EmbedderConfigBuilder(); diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_software.h b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_software.h index 8c38c86079..ffd007fff0 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_software.h +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_software.h @@ -12,7 +12,7 @@ namespace testing { class EmbedderTestCompositorSoftware : public EmbedderTestCompositor { public: - EmbedderTestCompositorSoftware(SkISize surface_size); + explicit EmbedderTestCompositorSoftware(SkISize surface_size); ~EmbedderTestCompositorSoftware() override; diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context.h b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context.h index 6efca542be..3f4f6d06b9 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context.h +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context.h @@ -48,7 +48,7 @@ enum class EmbedderTestContextType { class EmbedderTestContext { public: - EmbedderTestContext(std::string assets_path = ""); + explicit EmbedderTestContext(std::string assets_path = ""); virtual ~EmbedderTestContext(); diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_gl.h b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_gl.h index 6ab911f079..65e2c34c35 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_gl.h +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_gl.h @@ -16,7 +16,7 @@ class EmbedderTestContextGL : public EmbedderTestContext { using GLGetFBOCallback = std::function; using GLPresentCallback = std::function; - EmbedderTestContextGL(std::string assets_path = ""); + explicit EmbedderTestContextGL(std::string assets_path = ""); ~EmbedderTestContextGL() override; diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_software.h b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_software.h index 7f5b815c29..f8690484d0 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_software.h +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_context_software.h @@ -12,7 +12,7 @@ namespace testing { class EmbedderTestContextSoftware : public EmbedderTestContext { public: - EmbedderTestContextSoftware(std::string assets_path = ""); + explicit EmbedderTestContextSoftware(std::string assets_path = ""); ~EmbedderTestContextSoftware() override; diff --git a/engine/src/flutter/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h b/engine/src/flutter/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h index fd96dd4bec..b654063995 100644 --- a/engine/src/flutter/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h +++ b/engine/src/flutter/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h @@ -98,7 +98,7 @@ class StubFlutterGlfwApi { class ScopedStubFlutterGlfwApi { public: // Calls SetTestFlutterStub with |stub|. - ScopedStubFlutterGlfwApi(std::unique_ptr stub); + explicit ScopedStubFlutterGlfwApi(std::unique_ptr stub); // Restores the previous test stub. ~ScopedStubFlutterGlfwApi(); diff --git a/engine/src/flutter/testing/test_gl_surface.h b/engine/src/flutter/testing/test_gl_surface.h index ee339eb453..b5c7632b58 100644 --- a/engine/src/flutter/testing/test_gl_surface.h +++ b/engine/src/flutter/testing/test_gl_surface.h @@ -15,7 +15,7 @@ namespace testing { class TestGLSurface { public: - TestGLSurface(SkISize surface_size); + explicit TestGLSurface(SkISize surface_size); ~TestGLSurface(); diff --git a/engine/src/flutter/testing/test_timeout_listener.h b/engine/src/flutter/testing/test_timeout_listener.h index 37e2c23a2f..e6f466d92d 100644 --- a/engine/src/flutter/testing/test_timeout_listener.h +++ b/engine/src/flutter/testing/test_timeout_listener.h @@ -19,7 +19,7 @@ class PendingTests; class TestTimeoutListener : public ::testing::EmptyTestEventListener { public: - TestTimeoutListener(fml::TimeDelta timeout); + explicit TestTimeoutListener(fml::TimeDelta timeout); ~TestTimeoutListener(); diff --git a/engine/src/flutter/third_party/tonic/dart_args.h b/engine/src/flutter/third_party/tonic/dart_args.h index ec1f623589..cb9d0e3d27 100644 --- a/engine/src/flutter/third_party/tonic/dart_args.h +++ b/engine/src/flutter/third_party/tonic/dart_args.h @@ -16,7 +16,7 @@ namespace tonic { class DartArgIterator { public: - DartArgIterator(Dart_NativeArguments args, int start_index = 1) + explicit DartArgIterator(Dart_NativeArguments args, int start_index = 1) : args_(args), index_(start_index), had_exception_(false) {} template diff --git a/engine/src/flutter/third_party/tonic/dart_state.h b/engine/src/flutter/third_party/tonic/dart_state.h index 19dd9a5aee..bc859fb69f 100644 --- a/engine/src/flutter/third_party/tonic/dart_state.h +++ b/engine/src/flutter/third_party/tonic/dart_state.h @@ -38,8 +38,9 @@ class DartState : public std::enable_shared_from_this { DartApiScope api_scope_; }; - DartState(int dirfd = -1, - std::function message_epilogue = nullptr); + explicit DartState( + int dirfd = -1, + std::function message_epilogue = nullptr); virtual ~DartState(); static DartState* From(Dart_Isolate isolate); diff --git a/engine/src/flutter/third_party/tonic/file_loader/file_loader.h b/engine/src/flutter/third_party/tonic/file_loader/file_loader.h index 978d370fb8..8b887416b9 100644 --- a/engine/src/flutter/third_party/tonic/file_loader/file_loader.h +++ b/engine/src/flutter/third_party/tonic/file_loader/file_loader.h @@ -18,7 +18,7 @@ namespace tonic { class FileLoader { public: - FileLoader(int dirfd = -1); + explicit FileLoader(int dirfd = -1); ~FileLoader(); bool LoadPackagesMap(const std::string& packages); diff --git a/engine/src/flutter/third_party/txt/src/minikin/FontFamily.h b/engine/src/flutter/third_party/txt/src/minikin/FontFamily.h index aac7a0d62b..b82e80ea22 100644 --- a/engine/src/flutter/third_party/txt/src/minikin/FontFamily.h +++ b/engine/src/flutter/third_party/txt/src/minikin/FontFamily.h @@ -41,7 +41,7 @@ class FontStyle { : FontStyle(0 /* variant */, 4 /* weight */, false /* italic */) {} FontStyle(int weight, bool italic) : FontStyle(0 /* variant */, weight, italic) {} - FontStyle(uint32_t langListId) // NOLINT(implicit) + FontStyle(uint32_t langListId) // NOLINT(google-explicit-constructor) : FontStyle(langListId, 0 /* variant */, 4 /* weight */, diff --git a/engine/src/flutter/third_party/txt/src/minikin/Hyphenator.h b/engine/src/flutter/third_party/txt/src/minikin/Hyphenator.h index 637c35e20f..26b898ed24 100644 --- a/engine/src/flutter/third_party/txt/src/minikin/Hyphenator.h +++ b/engine/src/flutter/third_party/txt/src/minikin/Hyphenator.h @@ -110,7 +110,8 @@ class HyphenEdit { static uint32_t editForNextLine(HyphenationType type); HyphenEdit() : hyphen(NO_EDIT) {} - HyphenEdit(uint32_t hyphenInt) : hyphen(hyphenInt) {} // NOLINT(implicit) + HyphenEdit(uint32_t hyphenInt) // NOLINT(google-explicit-constructor) + : hyphen(hyphenInt) {} uint32_t getHyphen() const { return hyphen; } bool operator==(const HyphenEdit& other) const { return hyphen == other.hyphen; diff --git a/engine/src/flutter/third_party/txt/src/txt/asset_font_manager.h b/engine/src/flutter/third_party/txt/src/txt/asset_font_manager.h index 68f9eca316..41648a0a49 100644 --- a/engine/src/flutter/third_party/txt/src/txt/asset_font_manager.h +++ b/engine/src/flutter/third_party/txt/src/txt/asset_font_manager.h @@ -29,7 +29,7 @@ namespace txt { class AssetFontManager : public SkFontMgr { public: - AssetFontManager(std::unique_ptr font_provider); + explicit AssetFontManager(std::unique_ptr font_provider); ~AssetFontManager() override; diff --git a/engine/src/flutter/third_party/txt/src/txt/run_metrics.h b/engine/src/flutter/third_party/txt/src/txt/run_metrics.h index 934bff3f10..aa43793208 100644 --- a/engine/src/flutter/third_party/txt/src/txt/run_metrics.h +++ b/engine/src/flutter/third_party/txt/src/txt/run_metrics.h @@ -25,7 +25,7 @@ namespace txt { // Contains the font metrics and TextStyle of a unique run. class RunMetrics { public: - RunMetrics(const TextStyle* style) : text_style(style) {} + explicit RunMetrics(const TextStyle* style) : text_style(style) {} RunMetrics(const TextStyle* style, const SkFontMetrics& metrics) : text_style(style), font_metrics(metrics) {}