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 {
using PolymorphicInvoke = R (*)(internal::BindStateBase*,
internal::PassingTraitsType<Args>...);
OnceCallback() : internal::CallbackBase(nullptr) {}
constexpr OnceCallback() = default;
explicit OnceCallback(internal::BindStateBase* bind_state)
: internal::CallbackBase(bind_state) {}
......@@ -103,7 +103,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
using PolymorphicInvoke = R (*)(internal::BindStateBase*,
internal::PassingTraitsType<Args>...);
RepeatingCallback() : internal::CallbackBaseCopyable(nullptr) {}
constexpr RepeatingCallback() = default;
explicit RepeatingCallback(internal::BindStateBase* bind_state)
: internal::CallbackBaseCopyable(bind_state) {}
......
......@@ -134,6 +134,8 @@ class BASE_EXPORT CallbackBase {
// Returns true if this callback equals |other|. |other| may be null.
bool EqualsInternal(const CallbackBase& other) const;
constexpr inline CallbackBase();
// Allow initializing of |bind_state_| via the constructor to avoid default
// initialization of the scoped_refptr.
explicit CallbackBase(BindStateBase* bind_state);
......@@ -150,6 +152,8 @@ class BASE_EXPORT CallbackBase {
scoped_refptr<BindStateBase> bind_state_;
};
constexpr CallbackBase::CallbackBase() = default;
// CallbackBase<Copyable> is a direct base class of Copyable Callbacks.
class BASE_EXPORT CallbackBaseCopyable : public CallbackBase {
public:
......@@ -159,6 +163,7 @@ class BASE_EXPORT CallbackBaseCopyable : public CallbackBase {
CallbackBaseCopyable& operator=(CallbackBaseCopyable&& c);
protected:
constexpr CallbackBaseCopyable() = default;
explicit CallbackBaseCopyable(BindStateBase* bind_state)
: CallbackBase(bind_state) {}
~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