|
Chromium Embedded Framework (CEF)
145.0.1+g472e75d+chromium-145.0.7632.5
|
base::BindOnce() and base::BindRepeating() are helpers for creating base::OnceCallback and base::RepeatingCallback objects respectively. More...
#include <functional>#include <memory>#include <type_traits>#include <utility>#include "include/base/cef_build.h"#include "include/base/cef_compiler_specific.h"#include "include/base/internal/cef_bind_internal.h"Namespaces | |
| base | |
Functions | |
| template<typename Functor , typename... Args> | |
| auto | base::BindOnce (Functor &&functor, Args &&... args) |
| Bind as OnceCallback. More... | |
| template<typename Functor , typename... Args> | |
| auto | base::BindRepeating (Functor &&functor, Args &&... args) |
| Bind as RepeatingCallback. More... | |
| BindFailedCheckPreviousErrors | base::BindOnce (...) |
| BindFailedCheckPreviousErrors | base::BindRepeating (...) |
| template<typename T > | |
| cef_internal::UnretainedWrapper< T > | base::Unretained (T *o) |
| Unretained() allows binding a non-refcounted class, and to disable refcounting on arguments that are refcounted. More... | |
| template<typename T > | |
| cef_internal::RetainedRefWrapper< T > | base::RetainedRef (T *o) |
| RetainedRef() accepts a ref counted object and retains a reference to it. More... | |
| template<typename T > | |
| cef_internal::RetainedRefWrapper< T > | base::RetainedRef (scoped_refptr< T > o) |
| template<typename T > | |
| cef_internal::OwnedWrapper< T > | base::Owned (T *o) |
| Owned() transfers ownership of an object to the callback resulting from bind; the object will be deleted when the callback is deleted. More... | |
| template<typename T , typename Deleter > | |
| cef_internal::OwnedWrapper< T, Deleter > | base::Owned (std::unique_ptr< T, Deleter > &&ptr) |
| template<typename T > | |
| cef_internal::OwnedRefWrapper< std::decay_t< T > > | base::OwnedRef (T &&t) |
| OwnedRef() stores an object in the callback resulting from bind and passes a reference to the object to the bound function. More... | |
| template<typename T > | |
| base::requires (!std::is_lvalue_reference_v< T >) inline cef_internal | |
| Passed() is for transferring movable-but-not-copyable types (eg. More... | |
| template<typename T > | |
| cef_internal::PassedWrapper< T > | base::Passed (T *scoper) |
| template<typename T > | |
| cef_internal::IgnoreResultHelper< T > | base::IgnoreResult (T data) |
| IgnoreResult() is used to adapt a function or callback with a return type to one with a void return. More... | |
base::BindOnce() and base::BindRepeating() are helpers for creating base::OnceCallback and base::RepeatingCallback objects respectively.
For a runnable object of n-arity, the base::Bind*() family allows partial application of the first m arguments. The remaining n - m arguments must be passed when invoking the callback with Run().
// The first argument is bound at callback creation; the remaining // two must be passed when calling Run() on the callback object. base::OnceCallback<long(int, long)> cb = base::BindOnce( [](short x, int y, long z) { return x * y * z; }, 42);
When binding to a method, the receiver object must also be specified at callback creation time. When Run() is invoked, the method will be invoked on the specified receiver object.
class C : public base::RefCounted<C> { void F(); };
auto instance = base::MakeRefCounted<C>();
auto cb = base::BindOnce(&C::F, instance);
std::move(cb).Run(); // Identical to instance->F()
See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md for the full documentation.