Remove deprecated base::Bind APIs (see issue #3140)

This CL removes the following deprecated APIs:

- base::Bind()
- base::Callback
- base::Closure
- base::CancelableCallback
- base::CancelableClosure

The behavior that these APIs provided is still available using the *Repeating*
variants. However, consider strongly whether using these variants is actually
necessary in your case or whether the *Once* variants will suffice: unless your
callback *objects* (note: not variables!) need to be called multiple times,
they most likely can and should be the Once variants.

This applies the same changes as https://crrev.com/6cc94b5339.
This commit is contained in:
Marshall Greenblatt
2021-10-05 15:08:43 +03:00
parent f3ed6619da
commit 07bc800f00
4 changed files with 5 additions and 38 deletions

View File

@ -60,9 +60,6 @@
// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct:
// simply cancelling a callback will not also make it null.
//
// base::Callback is currently a type alias for base::RepeatingCallback. In the
// future, we expect to flip this to default to base::OnceCallback.
//
// See https://chromium.googlesource.com/chromium/src/+/HEAD/docs/callback.md
// for the full documentation.
@ -115,7 +112,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
return *this;
}
R Run(Args... args) const & {
R Run(Args... args) const& {
static_assert(!sizeof(*this),
"OnceCallback::Run() may only be invoked on a non-const "
"rvalue, i.e. std::move(callback).Run().");
@ -195,7 +192,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
return !operator==(other);
}
R Run(Args... args) const & {
R Run(Args... args) const& {
PolymorphicInvoke f =
reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke());
return f(this->bind_state_.get(), std::forward<Args>(args)...);