Inline small constructors of CallbackBase
Some of CallbackBase constructors has small bodies that is even smaller
than their size of the invocation set up.
This CL marks such constructors as inline for smaller binary size, and
reduces the stripped binary size of chrome on linux by 156kB.
Change-Id: I95999f4aebda6bc886dcfb66bc284ec0d42ccc86
Reviewed-on: https://chromium-review.googlesource.com/1113088
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#570053}
diff --git a/base/callback_internal.cc b/base/callback_internal.cc
index 6cef841..dd000ca 100644
--- a/base/callback_internal.cc
+++ b/base/callback_internal.cc
@@ -33,7 +33,6 @@
destructor_(destructor),
is_cancelled_(is_cancelled) {}
-CallbackBase::CallbackBase(CallbackBase&& c) noexcept = default;
CallbackBase& CallbackBase::operator=(CallbackBase&& c) noexcept = default;
CallbackBase::CallbackBase(const CallbackBaseCopyable& c)
: bind_state_(c.bind_state_) {}
@@ -66,21 +65,12 @@
return bind_state_ == other.bind_state_;
}
-CallbackBase::CallbackBase(BindStateBase* bind_state)
- : bind_state_(bind_state ? AdoptRef(bind_state) : nullptr) {
- DCHECK(!bind_state_.get() || bind_state_->HasOneRef());
-}
-
CallbackBase::~CallbackBase() = default;
-CallbackBaseCopyable::CallbackBaseCopyable(const CallbackBaseCopyable& c)
- : CallbackBase(nullptr) {
+CallbackBaseCopyable::CallbackBaseCopyable(const CallbackBaseCopyable& c) {
bind_state_ = c.bind_state_;
}
-CallbackBaseCopyable::CallbackBaseCopyable(CallbackBaseCopyable&& c) noexcept =
- default;
-
CallbackBaseCopyable& CallbackBaseCopyable::operator=(
const CallbackBaseCopyable& c) {
bind_state_ = c.bind_state_;