Chromium Embedded Framework (CEF)
121.0.1+g7a4b55f+chromium-121.0.6167.16
|
Namespaces | |
cef_internal | |
PlatformThread | |
A namespace for low-level thread functions. | |
Classes | |
class | AtomicFlag |
A flag that can safely be set from one thread and read from other threads. More... | |
class | AtomicRefCount |
class | AutoReset |
class | OnceCallback< R(Args...)> |
class | RepeatingCallback< R(Args...)> |
class | OnceCallback |
class | RepeatingCallback |
class | ScopedClosureRunner |
ScopedClosureRunner is akin to std::unique_ptr<> for Closures. More... | |
class | NullCallback |
Creates a null callback. More... | |
class | DoNothing |
Creates a callback that does nothing when called. More... | |
class | OnceCallbackList |
class | RepeatingCallbackList |
class | CallbackListSubscription |
class | PlatformThreadRef |
Used for thread checking and debugging. More... | |
class | RefCounted |
A base class for reference counted classes. More... | |
struct | DefaultRefCountedTraits |
Default traits for RefCounted<T>. More... | |
class | RefCountedThreadSafe |
A thread-safe variant of RefCounted<T> More... | |
struct | DefaultRefCountedThreadSafeTraits |
Default traits for RefCountedThreadSafe<T>. More... | |
class | RefCountedData |
A thread-safe wrapper for some piece of data so we can place other things in scoped_refptrs<>. More... | |
struct | ScopedTypeRefTraits |
class | ScopedTypeRef |
ScopedTypeRef<> is patterned after std::unique_ptr<>, but maintains ownership of a reference to any type that is maintained by Retain and Release methods. More... | |
class | ThreadChecker |
ThreadChecker is a helper class used to help verify that some methods of a class are called from the same thread. More... | |
class | SupportsWeakPtr |
A class may extend from SupportsWeakPtr to let others take weak pointers to it. More... | |
class | WeakPtr |
The WeakPtr class holds a weak reference to |T*|. More... | |
class | WeakPtrFactory |
A class may be composed of a WeakPtrFactory and thereby control how it exposes weak pointers to itself. More... | |
Typedefs | |
using | OnceClosure = OnceCallback< void()> |
Syntactic sugar to make OnceClosure<void()> and RepeatingClosure<void()> easier to declare since they will be used in a lot of APIs with delayed execution. More... | |
using | RepeatingClosure = RepeatingCallback< void()> |
template<typename T > | |
using | IsBaseCallback = internal::IsBaseCallbackImpl< std::decay_t< T > > |
IsBaseCallback<T>::value is true when T is any of the Closure or Callback family of types. More... | |
template<typename T > | |
using | IsOnceCallback = internal::IsOnceCallbackImpl< std::decay_t< T > > |
IsOnceCallback<T>::value is true when T is a OnceClosure or OnceCallback type. More... | |
template<template< typename > class CallbackType> | |
using | EnableIfIsBaseCallback = std::enable_if_t< IsBaseCallback< CallbackType< void()> >::value > |
SFINAE friendly enabler allowing to overload methods for both Repeating and OnceCallbacks. More... | |
using | OnceClosureList = OnceCallbackList< void()> |
Syntactic sugar to parallel that used for Callbacks. More... | |
using | RepeatingClosureList = RepeatingCallbackList< void()> |
template<typename Signature > | |
using | CancelableOnceCallback = internal::CancelableCallbackImpl< OnceCallback< Signature > > |
Consider using base::WeakPtr directly instead of base::CancelableCallback for the task cancellation. More... | |
using | CancelableOnceClosure = CancelableOnceCallback< void()> |
template<typename Signature > | |
using | CancelableRepeatingCallback = internal::CancelableCallbackImpl< RepeatingCallback< Signature > > |
using | CancelableRepeatingClosure = CancelableRepeatingCallback< void()> |
typedef cef_platform_thread_id_t | PlatformThreadId |
Used for logging. More... | |
using | ScopedAllowCrossThreadRefCountAccess = cef_subtle::ScopedAllowCrossThreadRefCountAccess |
Functions | |
template<typename Functor , typename... Args> | |
OnceCallback< cef_internal::MakeUnboundRunType< Functor, Args... > > | BindOnce (Functor &&functor, Args &&... args) |
Bind as OnceCallback. More... | |
template<typename Functor , typename... Args> | |
RepeatingCallback< cef_internal::MakeUnboundRunType< Functor, Args... > > | BindRepeating (Functor &&functor, Args &&... args) |
Bind as RepeatingCallback. More... | |
template<typename Signature > | |
OnceCallback< Signature > | BindOnce (OnceCallback< Signature > callback) |
Special cases for binding to a base::Callback without extra bound arguments. More... | |
template<typename Signature > | |
OnceCallback< Signature > | BindOnce (RepeatingCallback< Signature > callback) |
template<typename Signature > | |
RepeatingCallback< Signature > | BindRepeating (RepeatingCallback< Signature > callback) |
template<typename T > | |
cef_internal::UnretainedWrapper< T > | Unretained (T *o) |
Unretained() allows binding a non-refcounted class, and to disable refcounting on arguments that are refcounted objects. More... | |
template<typename T > | |
cef_internal::RetainedRefWrapper< T > | RetainedRef (T *o) |
RetainedRef() accepts a ref counted object and retains a reference to it. More... | |
template<typename T > | |
cef_internal::RetainedRefWrapper< T > | RetainedRef (scoped_refptr< T > o) |
template<typename T > | |
cef_internal::OwnedWrapper< T > | 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 > | Owned (std::unique_ptr< T, Deleter > &&ptr) |
template<typename T > | |
cef_internal::OwnedRefWrapper< std::decay_t< T > > | 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 , std::enable_if_t<!std::is_lvalue_reference< T >::value > * = nullptr> | |
cef_internal::PassedWrapper< T > | Passed (T &&scoper) |
Passed() is for transferring movable-but-not-copyable types (eg. More... | |
template<typename T > | |
cef_internal::PassedWrapper< T > | Passed (T *scoper) |
template<typename T > | |
cef_internal::IgnoreResultHelper< T > | IgnoreResult (T data) |
IgnoreResult() is used to adapt a function or callback with a return type to one with a void return. More... | |
template<typename... Args> | |
RepeatingCallback< void(Args...)> | AdaptCallbackForRepeating (OnceCallback< void(Args...)> callback) |
Wraps the given OnceCallback into a RepeatingCallback that relays its invocation to the original OnceCallback on the first invocation. More... | |
template<typename... Args> | |
std::pair< OnceCallback< void(Args...)>, OnceCallback< void(Args...)> > | SplitOnceCallback (OnceCallback< void(Args...)> callback) |
Wraps the given OnceCallback and returns two OnceCallbacks with an identical signature. More... | |
template<typename T > | |
void | DeletePointer (T *obj) |
Useful for creating a Closure that will delete a pointer when invoked. More... | |
template<typename T > | |
std::unique_ptr< T > | WrapUnique (T *ptr) |
Helper to transfer ownership of a raw pointer to a std::unique_ptr<T>. More... | |
template<typename T > | |
bool | operator== (const RefCountedData< T > &lhs, const RefCountedData< T > &rhs) |
template<typename T > | |
bool | operator!= (const RefCountedData< T > &lhs, const RefCountedData< T > &rhs) |
template<typename T > | |
scoped_refptr< T > | AdoptRef (T *t) |
template<typename T , typename... Args> | |
scoped_refptr< T > | MakeRefCounted (Args &&... args) |
template<typename T > | |
scoped_refptr< T > | WrapRefCounted (T *t) |
template<typename ObjT , typename Method , typename Tuple , size_t... Ns> | |
void | DispatchToMethodImpl (const ObjT &obj, Method method, Tuple &&args, std::index_sequence< Ns... >) |
template<typename ObjT , typename Method , typename Tuple > | |
void | DispatchToMethod (const ObjT &obj, Method method, Tuple &&args) |
template<typename Function , typename Tuple , size_t... Ns> | |
void | DispatchToFunctionImpl (Function function, Tuple &&args, std::index_sequence< Ns... >) |
template<typename Function , typename Tuple > | |
void | DispatchToFunction (Function function, Tuple &&args) |
template<typename ObjT , typename Method , typename InTuple , typename OutTuple , size_t... InNs, size_t... OutNs> | |
void | DispatchToMethodImpl (const ObjT &obj, Method method, InTuple &&in, OutTuple *out, std::index_sequence< InNs... >, std::index_sequence< OutNs... >) |
template<typename ObjT , typename Method , typename InTuple , typename OutTuple > | |
void | DispatchToMethod (const ObjT &obj, Method method, InTuple &&in, OutTuple *out) |
template<class T > | |
bool | operator!= (const WeakPtr< T > &weak_ptr, std::nullptr_t) |
Allow callers to compare WeakPtrs against nullptr to test validity. More... | |
template<class T > | |
bool | operator!= (std::nullptr_t, const WeakPtr< T > &weak_ptr) |
template<class T > | |
bool | operator== (const WeakPtr< T > &weak_ptr, std::nullptr_t) |
template<class T > | |
bool | operator== (std::nullptr_t, const WeakPtr< T > &weak_ptr) |
template<typename Derived > | |
WeakPtr< Derived > | AsWeakPtr (Derived *t) |
Helper function that uses type deduction to safely return a WeakPtr<Derived> when Derived doesn't directly extend SupportsWeakPtr<Derived>, instead it extends a Base that extends SupportsWeakPtr<Base>. More... | |
using base::CancelableOnceCallback = typedef internal::CancelableCallbackImpl<OnceCallback<Signature> > |
Consider using base::WeakPtr directly instead of base::CancelableCallback for the task cancellation.
using base::CancelableOnceClosure = typedef CancelableOnceCallback<void()> |
using base::CancelableRepeatingCallback = typedef internal::CancelableCallbackImpl<RepeatingCallback<Signature> > |
using base::CancelableRepeatingClosure = typedef CancelableRepeatingCallback<void()> |
using base::EnableIfIsBaseCallback = typedef std::enable_if_t<IsBaseCallback<CallbackType<void()> >::value> |
SFINAE friendly enabler allowing to overload methods for both Repeating and OnceCallbacks.
Usage:
template <template <typename> class CallbackType, ... other template args ..., typename = EnableIfIsBaseCallback<CallbackType>> void DoStuff(CallbackType<...> cb, ...);
using base::IsBaseCallback = typedef internal::IsBaseCallbackImpl<std::decay_t<T> > |
IsBaseCallback<T>::value is true when T is any of the Closure or Callback family of types.
using base::IsOnceCallback = typedef internal::IsOnceCallbackImpl<std::decay_t<T> > |
IsOnceCallback<T>::value is true when T is a OnceClosure or OnceCallback type.
using base::OnceClosure = typedef OnceCallback<void()> |
Syntactic sugar to make OnceClosure<void()> and RepeatingClosure<void()> easier to declare since they will be used in a lot of APIs with delayed execution.
using base::OnceClosureList = typedef OnceCallbackList<void()> |
Syntactic sugar to parallel that used for Callbacks.
typedef cef_platform_thread_id_t base::PlatformThreadId |
Used for logging.
Always an integer value.
using base::RepeatingClosure = typedef RepeatingCallback<void()> |
using base::RepeatingClosureList = typedef RepeatingCallbackList<void()> |
using base::ScopedAllowCrossThreadRefCountAccess = typedef cef_subtle::ScopedAllowCrossThreadRefCountAccess |
RepeatingCallback<void(Args...)> base::AdaptCallbackForRepeating | ( | OnceCallback< void(Args...)> | callback | ) |
Wraps the given OnceCallback into a RepeatingCallback that relays its invocation to the original OnceCallback on the first invocation.
The following invocations are just ignored.
Note that this deliberately subverts the Once/Repeating paradigm of Callbacks but helps ease the migration from old-style Callbacks. Avoid if possible; use if necessary for migration.
scoped_refptr< T > base::AdoptRef | ( | T * | t | ) |
WeakPtr<Derived> base::AsWeakPtr | ( | Derived * | t | ) |
Helper function that uses type deduction to safely return a WeakPtr<Derived> when Derived doesn't directly extend SupportsWeakPtr<Derived>, instead it extends a Base that extends SupportsWeakPtr<Base>.
EXAMPLE:
class Base : public base::SupportsWeakPtr<Producer> {}; class Derived : public Base {}; Derived derived; base::WeakPtr<Derived> ptr = base::AsWeakPtr(&derived);
Note that the following doesn't work (invalid type conversion) since Derived::AsWeakPtr() is WeakPtr<Base> SupportsWeakPtr<Base>::AsWeakPtr(), and there's no way to safely cast WeakPtr<Base> to WeakPtr<Derived> at the caller.
base::WeakPtr<Derived> ptr = derived.AsWeakPtr(); // Fails.
|
inline |
Bind as OnceCallback.
OnceCallback<Signature> base::BindOnce | ( | OnceCallback< Signature > | callback | ) |
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.
OnceCallback<Signature> base::BindOnce | ( | RepeatingCallback< Signature > | callback | ) |
|
inline |
Bind as RepeatingCallback.
RepeatingCallback<Signature> base::BindRepeating | ( | RepeatingCallback< Signature > | callback | ) |
void base::DeletePointer | ( | T * | obj | ) |
Useful for creating a Closure that will delete a pointer when invoked.
Only use this when necessary. In most cases MessageLoop::DeleteSoon() is a better fit.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
IgnoreResult() is used to adapt a function or callback with a return type to one with a void return.
This is most useful if you have a function with, say, a pesky ignorable bool return that you want to use with PostTask or something else that expect a callback with a void return.
EXAMPLE OF IgnoreResult():
int DoSomething(int arg) { cout << arg << endl; } // Assign to a callback with a void return type. OnceCallback<void(int)> cb = BindOnce(IgnoreResult(&DoSomething)); std::move(cb).Run(1); // Prints "1". // Prints "2" on |ml|. ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 2);
scoped_refptr<T> base::MakeRefCounted | ( | Args &&... | args | ) |
bool base::operator!= | ( | const RefCountedData< T > & | lhs, |
const RefCountedData< T > & | rhs | ||
) |
bool base::operator!= | ( | const WeakPtr< T > & | weak_ptr, |
std::nullptr_t | |||
) |
Allow callers to compare WeakPtrs against nullptr to test validity.
bool base::operator!= | ( | std::nullptr_t | , |
const WeakPtr< T > & | weak_ptr | ||
) |
bool base::operator== | ( | const RefCountedData< T > & | lhs, |
const RefCountedData< T > & | rhs | ||
) |
bool base::operator== | ( | const WeakPtr< T > & | weak_ptr, |
std::nullptr_t | |||
) |
bool base::operator== | ( | std::nullptr_t | , |
const WeakPtr< T > & | weak_ptr | ||
) |
|
inline |
|
inline |
Owned() transfers ownership of an object to the callback resulting from bind; the object will be deleted when the callback is deleted.
EXAMPLE OF Owned():
void foo(int* arg) { cout << *arg << endl } int* pn = new int(1); RepeatingClosure foo_callback = BindRepeating(&foo, Owned(pn)); foo_callback.Run(); // Prints "1" foo_callback.Run(); // Prints "1" *pn = 2; foo_callback.Run(); // Prints "2" foo_callback.Reset(); // |pn| is deleted. Also will happen when // |foo_callback| goes out of scope.
Without Owned(), someone would have to know to delete |pn| when the last reference to the callback is deleted.
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.
EXAMPLE OF OwnedRef():
void foo(int& arg) { cout << ++arg << endl } int counter = 0; RepeatingClosure foo_callback = BindRepeating(&foo, OwnedRef(counter)); foo_callback.Run(); // Prints "1" foo_callback.Run(); // Prints "2" foo_callback.Run(); // Prints "3" cout << counter; // Prints "0", OwnedRef creates a copy of counter.
Supports OnceCallbacks as well, useful to pass placeholder arguments:
void bar(int& ignore, const std::string& s) { cout << s << endl } OnceClosure bar_callback = BindOnce(&bar, OwnedRef(0), "Hello"); std::move(bar_callback).Run(); // Prints "Hello"
Without OwnedRef() it would not be possible to pass a mutable reference to an object owned by the callback.
|
inline |
Passed() is for transferring movable-but-not-copyable types (eg.
unique_ptr) through a RepeatingCallback. Logically, this signifies a destructive transfer of the state of the argument into the target function. Invoking RepeatingCallback::Run() twice on a callback that was created with a Passed() argument will CHECK() because the first invocation would have already transferred ownership to the target function.
Note that Passed() is not necessary with BindOnce(), as std::move() does the same thing. Avoid Passed() in favor of std::move() with BindOnce().
EXAMPLE OF Passed():
void TakesOwnership(std::unique_ptr<Foo> arg) { } std::unique_ptr<Foo> CreateFoo() { return std::make_unique<Foo>(); } auto f = std::make_unique<Foo>(); // |cb| is given ownership of Foo(). |f| is now NULL. // You can use std::move(f) in place of &f, but it's more verbose. RepeatingClosure cb = BindRepeating(&TakesOwnership, Passed(&f)); // Run was never called so |cb| still owns Foo() and deletes // it on Reset(). cb.Reset(); // |cb| is given a new Foo created by CreateFoo(). cb = BindRepeating(&TakesOwnership, Passed(CreateFoo())); // |arg| in TakesOwnership() is given ownership of Foo(). |cb| // no longer owns Foo() and, if reset, would not delete Foo(). cb.Run(); // Foo() is now transferred to |arg| and deleted. cb.Run(); // This CHECK()s since Foo() already been used once.
We offer 2 syntaxes for calling Passed(). The first takes an rvalue and is best suited for use with the return value of a function or other temporary rvalues. The second takes a pointer to the scoper and is just syntactic sugar to avoid having to write Passed(std::move(scoper)).
Both versions of Passed() prevent T from being an lvalue reference. The first via use of enable_if, and the second takes a T* which will not bind to T&.
|
inline |
|
inline |
|
inline |
RetainedRef() accepts a ref counted object and retains a reference to it.
When the callback is called, the object is passed as a raw pointer.
EXAMPLE OF RetainedRef():
void foo(RefCountedBytes* bytes) {} scoped_refptr<RefCountedBytes> bytes = ...; OnceClosure callback = BindOnce(&foo, base::RetainedRef(bytes)); std::move(callback).Run();
Without RetainedRef, the scoped_refptr would try to implicitly convert to a raw pointer and fail compilation:
OnceClosure callback = BindOnce(&foo, bytes); // ERROR!
std::pair<OnceCallback<void(Args...)>, OnceCallback<void(Args...)> > base::SplitOnceCallback | ( | OnceCallback< void(Args...)> | callback | ) |
Wraps the given OnceCallback and returns two OnceCallbacks with an identical signature.
On first invokation of either returned callbacks, the original callback is invoked. Invoking the remaining callback results in a crash.
|
inline |
Unretained() allows binding a non-refcounted class, and to disable refcounting on arguments that are refcounted objects.
EXAMPLE OF Unretained():
class Foo { public: void func() { cout << "Foo:f" << endl; } }; // In some function somewhere. Foo foo; OnceClosure foo_callback = BindOnce(&Foo::func, Unretained(&foo)); std::move(foo_callback).Run(); // Prints "Foo:f".
Without the Unretained() wrapper on |&foo|, the above call would fail to compile because Foo does not support the AddRef() and Release() methods.
scoped_refptr<T> base::WrapRefCounted | ( | T * | t | ) |
std::unique_ptr<T> base::WrapUnique | ( | T * | ptr | ) |
Helper to transfer ownership of a raw pointer to a std::unique_ptr<T>.
Note that std::unique_ptr<T> has very different semantics from std::unique_ptr<T[]>: do not use this helper for array allocations.