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

@ -54,9 +54,6 @@
// auto cb = base::BindOnce(&C::F, instance);
// std::move(cb).Run(); // Identical to instance->F()
//
// base::Bind is currently a type alias for base::BindRepeating(). In the
// future, we expect to flip this to default to base::BindOnce().
//
// See //docs/callback.md for the full documentation.
//
// -----------------------------------------------------------------------------
@ -126,17 +123,6 @@ BindRepeating(Functor&& functor, Args&&... args) {
std::forward<Args>(args)...);
}
// Unannotated Bind.
// TODO(tzik): Deprecate this and migrate to OnceCallback and
// RepeatingCallback, once they get ready.
template <typename Functor, typename... Args>
inline Callback<internal::MakeUnboundRunType<Functor, Args...>> Bind(
Functor&& functor,
Args&&... args) {
return base::BindRepeating(std::forward<Functor>(functor),
std::forward<Args>(args)...);
}
// Special cases for binding to a base::Callback without extra bound arguments.
// We CHECK() the validity of callback to guard against null pointers
// accidentally ending up in posted tasks, causing hard-to-debug crashes.
@ -159,12 +145,6 @@ RepeatingCallback<Signature> BindRepeating(
return callback;
}
template <typename Signature>
Callback<Signature> Bind(Callback<Signature> callback) {
CHECK(callback);
return callback;
}
// Unretained() allows binding a non-refcounted class, and to disable
// refcounting on arguments that are refcounted objects.
//