diff options
author | Denis Brockus <dbrockus@google.com> | 2023-02-08 10:45:59 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-02-23 15:47:36 +0000 |
commit | 72b9a85bcd1d30071106a23701c7a67f6d50a1e5 (patch) | |
tree | 1c46f6cef0dacb139bdb38164ad7fdcca77835c5 | |
parent | ebe1f3fed44b84cc60294d76a680bb741876b3bd (diff) | |
download | libchrome-gestures-72b9a85bcd1d30071106a23701c7a67f6d50a1e5.tar.gz |
Remove duplicate Property constructors
Using a default value for the delegate of NULL serves the same
purpose of duplicating each one.
Changed the test to use the default NULL delegate, so don't
specifically include that as a parameter.
BUG=b:253585974
TEST=USE="coverage" FEATURES="test noclean" emerge-brya chromeos-base/gestures
Change-Id: I332d0ac3e401c25b3a44e608fb9308efa493b0b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/gestures/+/4283085
Code-Coverage: Denis Brockus <dbrockus@chromium.org>
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Kenneth Albanowski <kenalba@google.com>
Tested-by: Kenneth Albanowski <kenalba@google.com>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Code-Coverage: Kenneth Albanowski <kenalba@google.com>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | include/prop_registry.h | 56 | ||||
-rw-r--r-- | src/prop_registry_unittest.cc | 2 |
2 files changed, 10 insertions, 48 deletions
diff --git a/include/prop_registry.h b/include/prop_registry.h index f2766e9..8d57de1 100644 --- a/include/prop_registry.h +++ b/include/prop_registry.h @@ -46,9 +46,8 @@ class PropertyDelegate; class Property { public: - Property(PropRegistry* parent, const char* name) - : gprop_(NULL), parent_(parent), delegate_(NULL), name_(name) {} - Property(PropRegistry* parent, const char* name, PropertyDelegate* delegate) + Property(PropRegistry* parent, const char* name, + PropertyDelegate* delegate) : gprop_(NULL), parent_(parent), delegate_(delegate), name_(name) {} virtual ~Property() { @@ -89,13 +88,8 @@ class Property { class BoolProperty : public Property { public: - BoolProperty(PropRegistry* reg, const char* name, GesturesPropBool val) - : Property(reg, name), val_(val) { - if (parent_) - parent_->Register(this); - } BoolProperty(PropRegistry* reg, const char* name, GesturesPropBool val, - PropertyDelegate* delegate) + PropertyDelegate* delegate = NULL) : Property(reg, name, delegate), val_(val) { if (parent_) parent_->Register(this); @@ -111,13 +105,7 @@ class BoolProperty : public Property { class BoolArrayProperty : public Property { public: BoolArrayProperty(PropRegistry* reg, const char* name, GesturesPropBool* vals, - size_t count) - : Property(reg, name), vals_(vals), count_(count) { - if (parent_) - parent_->Register(this); - } - BoolArrayProperty(PropRegistry* reg, const char* name, GesturesPropBool* vals, - size_t count, PropertyDelegate* delegate) + size_t count, PropertyDelegate* delegate = NULL) : Property(reg, name, delegate), vals_(vals), count_(count) { if (parent_) parent_->Register(this); @@ -133,13 +121,8 @@ class BoolArrayProperty : public Property { class DoubleProperty : public Property { public: - DoubleProperty(PropRegistry* reg, const char* name, double val) - : Property(reg, name), val_(val) { - if (parent_) - parent_->Register(this); - } DoubleProperty(PropRegistry* reg, const char* name, double val, - PropertyDelegate* delegate) + PropertyDelegate* delegate = NULL) : Property(reg, name, delegate), val_(val) { if (parent_) parent_->Register(this); @@ -155,13 +138,7 @@ class DoubleProperty : public Property { class DoubleArrayProperty : public Property { public: DoubleArrayProperty(PropRegistry* reg, const char* name, double* vals, - size_t count) - : Property(reg, name), vals_(vals), count_(count) { - if (parent_) - parent_->Register(this); - } - DoubleArrayProperty(PropRegistry* reg, const char* name, double* vals, - size_t count, PropertyDelegate* delegate) + size_t count, PropertyDelegate* delegate = NULL) : Property(reg, name, delegate), vals_(vals), count_(count) { if (parent_) parent_->Register(this); @@ -177,13 +154,8 @@ class DoubleArrayProperty : public Property { class IntProperty : public Property { public: - IntProperty(PropRegistry* reg, const char* name, int val) - : Property(reg, name), val_(val) { - if (parent_) - parent_->Register(this); - } IntProperty(PropRegistry* reg, const char* name, int val, - PropertyDelegate* delegate) + PropertyDelegate* delegate = NULL) : Property(reg, name, delegate), val_(val) { if (parent_) parent_->Register(this); @@ -198,13 +170,8 @@ class IntProperty : public Property { class IntArrayProperty : public Property { public: - IntArrayProperty(PropRegistry* reg, const char* name, int* vals, size_t count) - : Property(reg, name), vals_(vals), count_(count) { - if (parent_) - parent_->Register(this); - } IntArrayProperty(PropRegistry* reg, const char* name, int* vals, size_t count, - PropertyDelegate* delegate) + PropertyDelegate* delegate = NULL) : Property(reg, name, delegate), vals_(vals), count_(count) { if (parent_) parent_->Register(this); @@ -220,13 +187,8 @@ class IntArrayProperty : public Property { class StringProperty : public Property { public: - StringProperty(PropRegistry* reg, const char* name, const char* val) - : Property(reg, name), val_(val) { - if (parent_) - parent_->Register(this); - } StringProperty(PropRegistry* reg, const char* name, const char* val, - PropertyDelegate* delegate) + PropertyDelegate* delegate = NULL) : Property(reg, name, delegate), val_(val) { if (parent_) parent_->Register(this); diff --git a/src/prop_registry_unittest.cc b/src/prop_registry_unittest.cc index 1b994fb..66a7f6c 100644 --- a/src/prop_registry_unittest.cc +++ b/src/prop_registry_unittest.cc @@ -129,7 +129,7 @@ TEST(PropRegistryTest, PropChangeTest) { ActivityLog log(®); reg.set_activity_log(&log); - DoubleProperty dp(®, "hi", 1234.0, NULL); + DoubleProperty dp(®, "hi", 1234.0); EXPECT_EQ(0, log.size()); dp.HandleGesturesPropWritten(); EXPECT_EQ(1, log.size()); |