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

Add 'explicit' to darwin embedder constructors #29827

Merged
merged 3 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion fml/platform/darwin/cf_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CFRef {
public:
CFRef() : instance_(nullptr) {}

// NOLINTNEXTLINE(google-explicit-constructor)
CFRef(T instance) : instance_(instance) {}

CFRef(const CFRef& other) : instance_(other.instance_) {
Expand Down Expand Up @@ -54,9 +55,10 @@ class CFRef {
return instance;
}

// NOLINTNEXTLINE(google-explicit-constructor)
operator T() const { return instance_; }

operator bool() const { return instance_ != nullptr; }
explicit operator bool() const { return instance_ != nullptr; }

private:
T instance_;
Expand Down
1 change: 1 addition & 0 deletions fml/platform/darwin/scoped_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class ScopedBlock {

bool operator!=(B that) const { return block_ != that; }

// NOLINTNEXTLINE(google-explicit-constructor)
operator B() const { return block_; }

B get() const { return block_; }
Expand Down
5 changes: 4 additions & 1 deletion fml/platform/darwin/scoped_nsobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class scoped_nsprotocol {
scoped_nsprotocol(const scoped_nsprotocol<NST>& that) : object_([that.object_ retain]) {}

template <typename NSU>
// NOLINTNEXTLINE(google-explicit-constructor)
scoped_nsprotocol(const scoped_nsprotocol<NSU>& that) : object_([that.get() retain]) {}

~scoped_nsprotocol() { [object_ release]; }
Expand All @@ -66,7 +67,7 @@ class scoped_nsprotocol {
bool operator==(NST that) const { return object_ == that; }
bool operator!=(NST that) const { return object_ != that; }

operator NST() const { return object_; }
operator NST() const { return object_; } // NOLINT(google-explicit-constructor)

NST get() const { return object_; }

Expand Down Expand Up @@ -116,6 +117,7 @@ class scoped_nsobject : public scoped_nsprotocol<NST*> {
scoped_nsobject(const scoped_nsobject<NST>& that) : scoped_nsprotocol<NST*>(that) {}

template <typename NSU>
// NOLINTNEXTLINE(google-explicit-constructor)
scoped_nsobject(const scoped_nsobject<NSU>& that) : scoped_nsprotocol<NST*>(that) {}

scoped_nsobject& operator=(const scoped_nsobject<NST>& that) {
Expand All @@ -133,6 +135,7 @@ class scoped_nsobject<id> : public scoped_nsprotocol<id> {
scoped_nsobject(const scoped_nsobject<id>& that) : scoped_nsprotocol<id>(that) {}

template <typename NSU>
// NOLINTNEXTLINE(google-explicit-constructor)
scoped_nsobject(const scoped_nsobject<NSU>& that) : scoped_nsprotocol<id>(that) {}

scoped_nsobject& operator=(const scoped_nsobject<id>& that) {
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/common/accessibility_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class AccessibilityBridge
/// @param[in] user_data A custom pointer to the data of your
/// choice. This pointer can be retrieve later
/// through GetUserData().
AccessibilityBridge(std::unique_ptr<AccessibilityBridgeDelegate> delegate);
explicit AccessibilityBridge(
std::unique_ptr<AccessibilityBridgeDelegate> delegate);
~AccessibilityBridge();

//------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/common/text_editing_delta.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ struct TextEditingDelta {
TextRange range,
const std::string& text);

TextEditingDelta(const std::u16string& text);
explicit TextEditingDelta(const std::u16string& text);

TextEditingDelta(const std::string& text);
explicit TextEditingDelta(const std::string& text);

virtual ~TextEditingDelta() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace flutter {

class VsyncWaiterIOS final : public VsyncWaiter {
public:
VsyncWaiterIOS(flutter::TaskRunners task_runners);
explicit VsyncWaiterIOS(flutter::TaskRunners task_runners);

~VsyncWaiterIOS() override;

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/darwin/ios/ios_switchable_gl_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace flutter {
/// |GLContextSwitch| and should be destroyed when The |GLContectSwitch| destroys.
class IOSSwitchableGLContext final : public SwitchableGLContext {
public:
IOSSwitchableGLContext(EAGLContext* context);
explicit IOSSwitchableGLContext(EAGLContext* context);

bool SetCurrent() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace flutter {
// Platform views are not yet supported.
class FlutterCompositor {
public:
FlutterCompositor(FlutterViewController* view_controller);
explicit FlutterCompositor(FlutterViewController* view_controller);

virtual ~FlutterCompositor() = default;

Expand Down