Commit 10e783d6 authored by tzik's avatar tzik Committed by Commit Bot

Mark base::Callback default constructor as constexpr

Change-Id: If9fec539c2fc140d755033a1ed5dbaff141230d4
Reviewed-on: https://chromium-review.googlesource.com/974725Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545013}
parent 9d98811e
...@@ -56,7 +56,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase { ...@@ -56,7 +56,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
using PolymorphicInvoke = R (*)(internal::BindStateBase*, using PolymorphicInvoke = R (*)(internal::BindStateBase*,
internal::PassingTraitsType<Args>...); internal::PassingTraitsType<Args>...);
OnceCallback() : internal::CallbackBase(nullptr) {} constexpr OnceCallback() = default;
explicit OnceCallback(internal::BindStateBase* bind_state) explicit OnceCallback(internal::BindStateBase* bind_state)
: internal::CallbackBase(bind_state) {} : internal::CallbackBase(bind_state) {}
...@@ -103,7 +103,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable { ...@@ -103,7 +103,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
using PolymorphicInvoke = R (*)(internal::BindStateBase*, using PolymorphicInvoke = R (*)(internal::BindStateBase*,
internal::PassingTraitsType<Args>...); internal::PassingTraitsType<Args>...);
RepeatingCallback() : internal::CallbackBaseCopyable(nullptr) {} constexpr RepeatingCallback() = default;
explicit RepeatingCallback(internal::BindStateBase* bind_state) explicit RepeatingCallback(internal::BindStateBase* bind_state)
: internal::CallbackBaseCopyable(bind_state) {} : internal::CallbackBaseCopyable(bind_state) {}
......
...@@ -134,6 +134,8 @@ class BASE_EXPORT CallbackBase { ...@@ -134,6 +134,8 @@ class BASE_EXPORT CallbackBase {
// Returns true if this callback equals |other|. |other| may be null. // Returns true if this callback equals |other|. |other| may be null.
bool EqualsInternal(const CallbackBase& other) const; bool EqualsInternal(const CallbackBase& other) const;
constexpr inline CallbackBase();
// Allow initializing of |bind_state_| via the constructor to avoid default // Allow initializing of |bind_state_| via the constructor to avoid default
// initialization of the scoped_refptr. // initialization of the scoped_refptr.
explicit CallbackBase(BindStateBase* bind_state); explicit CallbackBase(BindStateBase* bind_state);
...@@ -150,6 +152,8 @@ class BASE_EXPORT CallbackBase { ...@@ -150,6 +152,8 @@ class BASE_EXPORT CallbackBase {
scoped_refptr<BindStateBase> bind_state_; scoped_refptr<BindStateBase> bind_state_;
}; };
constexpr CallbackBase::CallbackBase() = default;
// CallbackBase<Copyable> is a direct base class of Copyable Callbacks. // CallbackBase<Copyable> is a direct base class of Copyable Callbacks.
class BASE_EXPORT CallbackBaseCopyable : public CallbackBase { class BASE_EXPORT CallbackBaseCopyable : public CallbackBase {
public: public:
...@@ -159,6 +163,7 @@ class BASE_EXPORT CallbackBaseCopyable : public CallbackBase { ...@@ -159,6 +163,7 @@ class BASE_EXPORT CallbackBaseCopyable : public CallbackBase {
CallbackBaseCopyable& operator=(CallbackBaseCopyable&& c); CallbackBaseCopyable& operator=(CallbackBaseCopyable&& c);
protected: protected:
constexpr CallbackBaseCopyable() = default;
explicit CallbackBaseCopyable(BindStateBase* bind_state) explicit CallbackBaseCopyable(BindStateBase* bind_state)
: CallbackBase(bind_state) {} : CallbackBase(bind_state) {}
~CallbackBaseCopyable() = default; ~CallbackBaseCopyable() = default;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment