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

Commit d61bf8e

Browse files
authored
Add 'explicit' to darwin embedder constructors (#29827)
1 parent 88948de commit d61bf8e

File tree

8 files changed

+15
-8
lines changed

8 files changed

+15
-8
lines changed

fml/platform/darwin/cf_utils.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class CFRef {
1616
public:
1717
CFRef() : instance_(nullptr) {}
1818

19+
// NOLINTNEXTLINE(google-explicit-constructor)
1920
CFRef(T instance) : instance_(instance) {}
2021

2122
CFRef(const CFRef& other) : instance_(other.instance_) {
@@ -54,9 +55,10 @@ class CFRef {
5455
return instance;
5556
}
5657

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

59-
operator bool() const { return instance_ != nullptr; }
61+
explicit operator bool() const { return instance_ != nullptr; }
6062

6163
private:
6264
T instance_;

fml/platform/darwin/scoped_block.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class ScopedBlock {
6767

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

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

7273
B get() const { return block_; }

fml/platform/darwin/scoped_nsobject.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class scoped_nsprotocol {
4545
scoped_nsprotocol(const scoped_nsprotocol<NST>& that) : object_([that.object_ retain]) {}
4646

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

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

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

7172
NST get() const { return object_; }
7273

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

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

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

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

138141
scoped_nsobject& operator=(const scoped_nsobject<id>& that) {

shell/platform/common/accessibility_bridge.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ class AccessibilityBridge
106106
/// @param[in] user_data A custom pointer to the data of your
107107
/// choice. This pointer can be retrieve later
108108
/// through GetUserData().
109-
AccessibilityBridge(std::unique_ptr<AccessibilityBridgeDelegate> delegate);
109+
explicit AccessibilityBridge(
110+
std::unique_ptr<AccessibilityBridgeDelegate> delegate);
110111
~AccessibilityBridge();
111112

112113
//------------------------------------------------------------------------------

shell/platform/common/text_editing_delta.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ struct TextEditingDelta {
2323
TextRange range,
2424
const std::string& text);
2525

26-
TextEditingDelta(const std::u16string& text);
26+
explicit TextEditingDelta(const std::u16string& text);
2727

28-
TextEditingDelta(const std::string& text);
28+
explicit TextEditingDelta(const std::string& text);
2929

3030
virtual ~TextEditingDelta() = default;
3131

shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace flutter {
4040

4141
class VsyncWaiterIOS final : public VsyncWaiter {
4242
public:
43-
VsyncWaiterIOS(flutter::TaskRunners task_runners);
43+
explicit VsyncWaiterIOS(flutter::TaskRunners task_runners);
4444

4545
~VsyncWaiterIOS() override;
4646

shell/platform/darwin/ios/ios_switchable_gl_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace flutter {
2626
/// |GLContextSwitch| and should be destroyed when The |GLContectSwitch| destroys.
2727
class IOSSwitchableGLContext final : public SwitchableGLContext {
2828
public:
29-
IOSSwitchableGLContext(EAGLContext* context);
29+
explicit IOSSwitchableGLContext(EAGLContext* context);
3030

3131
bool SetCurrent() override;
3232

shell/platform/darwin/macos/framework/Source/FlutterCompositor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace flutter {
1919
// Platform views are not yet supported.
2020
class FlutterCompositor {
2121
public:
22-
FlutterCompositor(FlutterViewController* view_controller);
22+
explicit FlutterCompositor(FlutterViewController* view_controller);
2323

2424
virtual ~FlutterCompositor() = default;
2525

0 commit comments

Comments
 (0)