forked from firka/flutter
Add 'explicit' to header files (flutter/engine#29741)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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<SwitchableGLContext> context);
|
||||
explicit GLContextSwitch(std::unique_ptr<SwitchableGLContext> context);
|
||||
|
||||
~GLContextSwitch() override;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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<DisplayList> display_list)
|
||||
explicit DrawDisplayListOp(const sk_sp<DisplayList> display_list)
|
||||
: display_list(std::move(display_list)) {}
|
||||
|
||||
sk_sp<DisplayList> display_list;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<DisplayListBuilder> builder() { return builder_; }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace flutter {
|
||||
|
||||
class ColorFilterLayer : public ContainerLayer {
|
||||
public:
|
||||
ColorFilterLayer(sk_sp<SkColorFilter> filter);
|
||||
explicit ColorFilterLayer(sk_sp<SkColorFilter> filter);
|
||||
|
||||
void Diff(DiffContext* context, const Layer* old_layer) override;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace flutter {
|
||||
|
||||
class ImageFilterLayer : public MergedContainerLayer {
|
||||
public:
|
||||
ImageFilterLayer(sk_sp<SkImageFilter> filter);
|
||||
explicit ImageFilterLayer(sk_sp<SkImageFilter> filter);
|
||||
|
||||
void Diff(DiffContext* context, const Layer* old_layer) override;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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{};
|
||||
|
||||
|
||||
@@ -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_) {
|
||||
|
||||
@@ -46,7 +46,7 @@ class ConcurrentMessageLoop
|
||||
std::map<std::thread::id, std::vector<fml::closure>> 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<ConcurrentMessageLoop> weak_loop);
|
||||
explicit ConcurrentTaskRunner(std::weak_ptr<ConcurrentMessageLoop> weak_loop);
|
||||
|
||||
virtual ~ConcurrentTaskRunner();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ int GetMinLogLevel();
|
||||
|
||||
class ScopedSetLogSettings {
|
||||
public:
|
||||
ScopedSetLogSettings(const LogSettings& settings);
|
||||
explicit ScopedSetLogSettings(const LogSettings& settings);
|
||||
~ScopedSetLogSettings();
|
||||
|
||||
private:
|
||||
|
||||
@@ -44,9 +44,9 @@ class FileMapping final : public Mapping {
|
||||
kExecute,
|
||||
};
|
||||
|
||||
FileMapping(const fml::UniqueFD& fd,
|
||||
std::initializer_list<Protection> protection = {
|
||||
Protection::kRead});
|
||||
explicit FileMapping(const fml::UniqueFD& fd,
|
||||
std::initializer_list<Protection> protection = {
|
||||
Protection::kRead});
|
||||
|
||||
~FileMapping() override;
|
||||
|
||||
@@ -91,9 +91,9 @@ class FileMapping final : public Mapping {
|
||||
|
||||
class DataMapping final : public Mapping {
|
||||
public:
|
||||
DataMapping(std::vector<uint8_t> data);
|
||||
explicit DataMapping(std::vector<uint8_t> data);
|
||||
|
||||
DataMapping(const std::string& string);
|
||||
explicit DataMapping(const std::string& string);
|
||||
|
||||
~DataMapping() override;
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ template <typename T>
|
||||
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<T>& r) : ptr_(r.ptr_) {
|
||||
RefPtr(const RefPtr<T>& r) // NOLINT(google-explicit-constructor)
|
||||
: ptr_(r.ptr_) {
|
||||
if (ptr_) {
|
||||
ptr_->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
RefPtr(const RefPtr<U>& r)
|
||||
: ptr_(r.ptr_) { // NOLINT(google-explicit-constructor)
|
||||
RefPtr(const RefPtr<U>& r) // NOLINT(google-explicit-constructor)
|
||||
: ptr_(r.ptr_) {
|
||||
if (ptr_) {
|
||||
ptr_->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
// Move constructor.
|
||||
RefPtr(RefPtr<T>&& r) : ptr_(r.ptr_) { r.ptr_ = nullptr; }
|
||||
RefPtr(RefPtr<T>&& r) : ptr_(r.ptr_) { // NOLINT(google-explicit-constructor)
|
||||
r.ptr_ = nullptr;
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
RefPtr(RefPtr<U>&& r) : ptr_(r.ptr_) { // NOLINT(google-explicit-constructor)
|
||||
|
||||
@@ -49,17 +49,18 @@ class WeakPtr {
|
||||
WeakPtr() : ptr_(nullptr) {}
|
||||
|
||||
// Copy constructor.
|
||||
explicit WeakPtr(const WeakPtr<T>& r) = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
WeakPtr(const WeakPtr<T>& r) = default;
|
||||
|
||||
template <typename U>
|
||||
WeakPtr(const WeakPtr<U>& r)
|
||||
WeakPtr(const WeakPtr<U>& r) // NOLINT(google-explicit-constructor)
|
||||
: ptr_(static_cast<T*>(r.ptr_)), flag_(r.flag_), checker_(r.checker_) {}
|
||||
|
||||
// Move constructor.
|
||||
WeakPtr(WeakPtr<T>&& r) = default;
|
||||
|
||||
template <typename U>
|
||||
WeakPtr(WeakPtr<U>&& r)
|
||||
WeakPtr(WeakPtr<U>&& r) // NOLINT(google-explicit-constructor)
|
||||
: ptr_(static_cast<T*>(r.ptr_)),
|
||||
flag_(std::move(r.flag_)),
|
||||
checker_(r.checker_) {}
|
||||
@@ -155,12 +156,14 @@ class TaskRunnerAffineWeakPtr : public WeakPtr<T> {
|
||||
TaskRunnerAffineWeakPtr(const TaskRunnerAffineWeakPtr<T>& r) = default;
|
||||
|
||||
template <typename U>
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
TaskRunnerAffineWeakPtr(const TaskRunnerAffineWeakPtr<U>& r)
|
||||
: WeakPtr<T>(r), checker_(r.checker_) {}
|
||||
|
||||
TaskRunnerAffineWeakPtr(TaskRunnerAffineWeakPtr<T>&& r) = default;
|
||||
|
||||
template <typename U>
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
TaskRunnerAffineWeakPtr(TaskRunnerAffineWeakPtr<U>&& r)
|
||||
: WeakPtr<T>(r), checker_(r.checker_) {}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class NativeLibrary : public fml::RefCountedThreadSafe<NativeLibrary> {
|
||||
Handle handle_ = nullptr;
|
||||
bool close_handle_ = true;
|
||||
|
||||
NativeLibrary(const char* path);
|
||||
explicit NativeLibrary(const char* path);
|
||||
|
||||
NativeLibrary(Handle handle, bool close_handle);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ template <typename T>
|
||||
class AtomicObject {
|
||||
public:
|
||||
AtomicObject() = default;
|
||||
AtomicObject(T object) : object_(object) {}
|
||||
explicit AtomicObject(T object) : object_(object) {}
|
||||
|
||||
T Load() const {
|
||||
std::scoped_lock lock(mutex_);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace fml {
|
||||
|
||||
class CountDownLatch {
|
||||
public:
|
||||
CountDownLatch(size_t count);
|
||||
explicit CountDownLatch(size_t count);
|
||||
|
||||
~CountDownLatch();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -63,7 +63,7 @@ class TaskRunner : public fml::RefCountedThreadSafe<TaskRunner>,
|
||||
const fml::closure& task);
|
||||
|
||||
protected:
|
||||
TaskRunner(fml::RefPtr<MessageLoopImpl> loop);
|
||||
explicit TaskRunner(fml::RefPtr<MessageLoopImpl> loop);
|
||||
|
||||
private:
|
||||
fml::RefPtr<MessageLoopImpl> loop_;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace internal {
|
||||
|
||||
class ThreadLocalPointer {
|
||||
public:
|
||||
ThreadLocalPointer(void (*destroy)(void*));
|
||||
explicit ThreadLocalPointer(void (*destroy)(void*));
|
||||
~ThreadLocalPointer();
|
||||
|
||||
void* get() const;
|
||||
|
||||
@@ -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_);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class FragmentShader : public Shader {
|
||||
static void RegisterNatives(tonic::DartLibraryNatives* natives);
|
||||
|
||||
private:
|
||||
FragmentShader(sk_sp<SkShader> shader);
|
||||
explicit FragmentShader(sk_sp<SkShader> shader);
|
||||
|
||||
sk_sp<SkShader> shader_;
|
||||
};
|
||||
|
||||
@@ -133,7 +133,8 @@ class BuiltinSkiaImageGenerator : public ImageGenerator {
|
||||
public:
|
||||
~BuiltinSkiaImageGenerator();
|
||||
|
||||
BuiltinSkiaImageGenerator(std::unique_ptr<SkImageGenerator> generator);
|
||||
explicit BuiltinSkiaImageGenerator(
|
||||
std::unique_ptr<SkImageGenerator> generator);
|
||||
|
||||
// |ImageGenerator|
|
||||
const SkImageInfo& GetInfo() override;
|
||||
@@ -171,9 +172,9 @@ class BuiltinSkiaCodecImageGenerator : public ImageGenerator {
|
||||
public:
|
||||
~BuiltinSkiaCodecImageGenerator();
|
||||
|
||||
BuiltinSkiaCodecImageGenerator(std::unique_ptr<SkCodec> codec);
|
||||
explicit BuiltinSkiaCodecImageGenerator(std::unique_ptr<SkCodec> codec);
|
||||
|
||||
BuiltinSkiaCodecImageGenerator(sk_sp<SkData> buffer);
|
||||
explicit BuiltinSkiaCodecImageGenerator(sk_sp<SkData> buffer);
|
||||
|
||||
// |ImageGenerator|
|
||||
const SkImageInfo& GetInfo() override;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace flutter {
|
||||
|
||||
class MultiFrameCodec : public Codec {
|
||||
public:
|
||||
MultiFrameCodec(std::shared_ptr<ImageGenerator> generator);
|
||||
explicit MultiFrameCodec(std::shared_ptr<ImageGenerator> 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<ImageGenerator> generator);
|
||||
explicit State(std::shared_ptr<ImageGenerator> generator);
|
||||
|
||||
const std::shared_ptr<ImageGenerator> generator_;
|
||||
const int frameCount_;
|
||||
|
||||
@@ -58,8 +58,8 @@ class Picture : public RefCountedDartWrappable<Picture> {
|
||||
Dart_Handle raw_image_callback);
|
||||
|
||||
private:
|
||||
Picture(flutter::SkiaGPUObject<SkPicture> picture);
|
||||
Picture(flutter::SkiaGPUObject<DisplayList> display_list);
|
||||
explicit Picture(flutter::SkiaGPUObject<SkPicture> picture);
|
||||
explicit Picture(flutter::SkiaGPUObject<DisplayList> display_list);
|
||||
|
||||
flutter::SkiaGPUObject<SkPicture> picture_;
|
||||
flutter::SkiaGPUObject<DisplayList> display_list_;
|
||||
|
||||
@@ -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<AssetManager> asset_manager);
|
||||
explicit AssetManagerFontProvider(
|
||||
std::shared_ptr<AssetManager> asset_manager);
|
||||
|
||||
~AssetManagerFontProvider() override;
|
||||
|
||||
|
||||
@@ -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<SnapshotDelegate> snapshot_delegate,
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -49,7 +49,7 @@ class DartVMRef {
|
||||
|
||||
static std::shared_ptr<IsolateNameServer> GetIsolateNameServer();
|
||||
|
||||
operator bool() const { return static_cast<bool>(vm_); }
|
||||
explicit operator bool() const { return static_cast<bool>(vm_); }
|
||||
|
||||
DartVM* get() {
|
||||
FML_DCHECK(vm_);
|
||||
@@ -81,7 +81,7 @@ class DartVMRef {
|
||||
|
||||
std::shared_ptr<DartVM> vm_;
|
||||
|
||||
DartVMRef(std::shared_ptr<DartVM> vm);
|
||||
explicit DartVMRef(std::shared_ptr<DartVM> vm);
|
||||
|
||||
// Only used by Dart Isolate to register itself with the VM.
|
||||
static DartVM* GetRunningVM();
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace flutter {
|
||||
|
||||
class EmbedderResources {
|
||||
public:
|
||||
EmbedderResources(runtime::ResourcesEntry* resources_table);
|
||||
explicit EmbedderResources(runtime::ResourcesEntry* resources_table);
|
||||
|
||||
static const int kNoSuchInstance;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<PointerDataPacket> 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<PointerDataPacket> packet,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -66,7 +66,8 @@ class RunConfiguration {
|
||||
///
|
||||
/// @param[in] configuration The configuration
|
||||
///
|
||||
RunConfiguration(std::unique_ptr<IsolateConfiguration> configuration);
|
||||
explicit RunConfiguration(
|
||||
std::unique_ptr<IsolateConfiguration> configuration);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Creates a run configuration with the specified isolate
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace flutter {
|
||||
|
||||
class PlatformViewAndroidDelegate {
|
||||
public:
|
||||
PlatformViewAndroidDelegate(
|
||||
explicit PlatformViewAndroidDelegate(
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade);
|
||||
void UpdateSemantics(flutter::SemanticsNodeUpdates update,
|
||||
flutter::CustomAccessibilityActionUpdates actions);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -87,7 +87,7 @@ class StubFlutterApi {
|
||||
class ScopedStubFlutterApi {
|
||||
public:
|
||||
// Calls SetTestFlutterStub with |stub|.
|
||||
ScopedStubFlutterApi(std::unique_ptr<StubFlutterApi> stub);
|
||||
explicit ScopedStubFlutterApi(std::unique_ptr<StubFlutterApi> stub);
|
||||
|
||||
// Restores the previous test stub.
|
||||
~ScopedStubFlutterApi();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -72,15 +72,16 @@ void EmbedderExternalViewEmbedder::BeginFrame(
|
||||
void EmbedderExternalViewEmbedder::PrerollCompositeEmbeddedView(
|
||||
int view_id,
|
||||
std::unique_ptr<EmbeddedViewParams> 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<EmbedderExternalView>(
|
||||
pending_views_[vid] = std::make_unique<EmbedderExternalView>(
|
||||
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<SkCanvas*> 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.";
|
||||
|
||||
@@ -36,9 +36,10 @@ class EmbedderConfigBuilder {
|
||||
kNoInitialize,
|
||||
};
|
||||
|
||||
EmbedderConfigBuilder(EmbedderTestContext& context,
|
||||
InitializationPreference preference =
|
||||
InitializationPreference::kSnapshotsInitialize);
|
||||
explicit EmbedderConfigBuilder(
|
||||
EmbedderTestContext& context,
|
||||
InitializationPreference preference =
|
||||
InitializationPreference::kSnapshotsInitialize);
|
||||
|
||||
~EmbedderConfigBuilder();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace testing {
|
||||
|
||||
class EmbedderTestCompositorSoftware : public EmbedderTestCompositor {
|
||||
public:
|
||||
EmbedderTestCompositorSoftware(SkISize surface_size);
|
||||
explicit EmbedderTestCompositorSoftware(SkISize surface_size);
|
||||
|
||||
~EmbedderTestCompositorSoftware() override;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ enum class EmbedderTestContextType {
|
||||
|
||||
class EmbedderTestContext {
|
||||
public:
|
||||
EmbedderTestContext(std::string assets_path = "");
|
||||
explicit EmbedderTestContext(std::string assets_path = "");
|
||||
|
||||
virtual ~EmbedderTestContext();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class EmbedderTestContextGL : public EmbedderTestContext {
|
||||
using GLGetFBOCallback = std::function<void(FlutterFrameInfo frame_info)>;
|
||||
using GLPresentCallback = std::function<void(uint32_t fbo_id)>;
|
||||
|
||||
EmbedderTestContextGL(std::string assets_path = "");
|
||||
explicit EmbedderTestContextGL(std::string assets_path = "");
|
||||
|
||||
~EmbedderTestContextGL() override;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace testing {
|
||||
|
||||
class EmbedderTestContextSoftware : public EmbedderTestContext {
|
||||
public:
|
||||
EmbedderTestContextSoftware(std::string assets_path = "");
|
||||
explicit EmbedderTestContextSoftware(std::string assets_path = "");
|
||||
|
||||
~EmbedderTestContextSoftware() override;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class StubFlutterGlfwApi {
|
||||
class ScopedStubFlutterGlfwApi {
|
||||
public:
|
||||
// Calls SetTestFlutterStub with |stub|.
|
||||
ScopedStubFlutterGlfwApi(std::unique_ptr<StubFlutterGlfwApi> stub);
|
||||
explicit ScopedStubFlutterGlfwApi(std::unique_ptr<StubFlutterGlfwApi> stub);
|
||||
|
||||
// Restores the previous test stub.
|
||||
~ScopedStubFlutterGlfwApi();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace testing {
|
||||
|
||||
class TestGLSurface {
|
||||
public:
|
||||
TestGLSurface(SkISize surface_size);
|
||||
explicit TestGLSurface(SkISize surface_size);
|
||||
|
||||
~TestGLSurface();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class PendingTests;
|
||||
|
||||
class TestTimeoutListener : public ::testing::EmptyTestEventListener {
|
||||
public:
|
||||
TestTimeoutListener(fml::TimeDelta timeout);
|
||||
explicit TestTimeoutListener(fml::TimeDelta timeout);
|
||||
|
||||
~TestTimeoutListener();
|
||||
|
||||
|
||||
@@ -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 <typename T>
|
||||
|
||||
@@ -38,8 +38,9 @@ class DartState : public std::enable_shared_from_this<DartState> {
|
||||
DartApiScope api_scope_;
|
||||
};
|
||||
|
||||
DartState(int dirfd = -1,
|
||||
std::function<void(Dart_Handle)> message_epilogue = nullptr);
|
||||
explicit DartState(
|
||||
int dirfd = -1,
|
||||
std::function<void(Dart_Handle)> message_epilogue = nullptr);
|
||||
virtual ~DartState();
|
||||
|
||||
static DartState* From(Dart_Isolate isolate);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace txt {
|
||||
|
||||
class AssetFontManager : public SkFontMgr {
|
||||
public:
|
||||
AssetFontManager(std::unique_ptr<FontAssetProvider> font_provider);
|
||||
explicit AssetFontManager(std::unique_ptr<FontAssetProvider> font_provider);
|
||||
|
||||
~AssetFontManager() override;
|
||||
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user