| Chromium Embedded Framework (CEF)
    128.0.1+gc234e7f+chromium-128.0.6613.7
    | 
CancelableCallback is a wrapper around base::Callback that allows cancellation of a callback. More...
#include <utility>#include "include/base/cef_bind.h"#include "include/base/cef_callback.h"#include "include/base/cef_compiler_specific.h"#include "include/base/cef_logging.h"#include "include/base/cef_weak_ptr.h"#include "include/base/internal/cef_callback_internal.h"| Namespaces | |
| base | |
| Typedefs | |
| template<typename Signature > | |
| using | base::CancelableOnceCallback = internal::CancelableCallbackImpl< OnceCallback< Signature > > | 
| Consider using base::WeakPtr directly instead of base::CancelableCallback for the task cancellation.  More... | |
| using | base::CancelableOnceClosure = CancelableOnceCallback< void()> | 
| template<typename Signature > | |
| using | base::CancelableRepeatingCallback = internal::CancelableCallbackImpl< RepeatingCallback< Signature > > | 
| using | base::CancelableRepeatingClosure = CancelableRepeatingCallback< void()> | 
CancelableCallback is a wrapper around base::Callback that allows cancellation of a callback.
CancelableCallback takes a reference on the wrapped callback until this object is destroyed or Reset()/Cancel() are called.
NOTE:
Calling CancelableCallback::Cancel() brings the object back to its natural, default-constructed state, i.e., CancelableCallback::callback() will return a null callback.
THREAD-SAFETY:
CancelableCallback objects must be created on, posted to, cancelled on, and destroyed on the same thread.
EXAMPLE USAGE:
In the following example, the test is verifying that RunIntensiveTest() Quit()s the message loop within 4 seconds. The cancelable callback is posted to the message loop, the intensive test runs, the message loop is run, then the callback is cancelled.
  RunLoop run_loop;
  void TimeoutCallback(const std::string& timeout_message) {
    FAIL() << timeout_message;
    run_loop.QuitWhenIdle();
  }
  CancelableOnceClosure timeout(
      base::BindOnce(&TimeoutCallback, "Test timed out."));
  ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE,
                                                 timeout.callback(),
                                                 TimeDelta::FromSeconds(4));
  RunIntensiveTest();
  run_loop.Run();
  // Hopefully this is hit before the timeout callback runs.
  timeout.Cancel();