Home | History | Annotate | Download | only in base

Lines Matching refs:Callback

11 // NOTE: Header files that do not require the full definition of Callback or
18 // The templated Callback class is a generalized function object. Together
28 // A callback with no unbound input parameters (base::Callback<void()>)
35 // The Callback objects themselves should be passed by const-reference, and
50 // base::Callback<int()> func_cb = base::Bind(&Return5);
64 // base::Callback<void()> ref_cb = base::Bind(&Ref::Foo, ref);
72 // RUNNING A CALLBACK
75 // signature as the template argument to the callback.
77 // void DoSomething(const base::Callback<void(int, std::string)>& callback) {
78 // callback.Run(5, "hello");
84 // void DoSomething(const base::Callback<double(double)>& callback) {
85 // double myresult = callback.Run(3.14159);
86 // myresult += callback.Run(2.71828);
91 // Unbound parameters are specified at the time a callback is Run(). They are
92 // specified in the Callback template type:
95 // base::Callback<void(int, const std::string&)> cb = base::Bind(&MyFunc);
100 // Bound parameters are specified when you create thee callback as arguments
102 // callback doesn't see those values or even know that the function it's
106 // base::Callback<void()> cb = base::Bind(&MyFunc, 23, "hello world");
109 // A callback with no unbound input parameters (base::Callback<void()>)
121 // You can specify some parameters when you create the callback, and specify
122 // the rest when you execute the callback.
125 // base::Callback<void(const std::string&)> cb = base::Bind(&MyFunc, 23);
140 // The callback will not be run if the object has already been destroyed.
152 // BINDING A CLASS METHOD AND HAVING THE CALLBACK OWN THE CLASS
157 // The object will be deleted when the callback is destroyed, even if it's
163 // Sometimes you want to call a function that returns a value in a callback
167 // base::Callback<void(int)> cb =
176 // function. A callback with no parameters or no unbound parameters is called a
177 // Closure (base::Callback<void()> and base::Closure are the same thing).
179 // PASSING PARAMETERS OWNED BY THE CALLBACK
185 // The parameter will be deleted when the callback is destroyed, even if it's
195 // Ownership of the parameter will be with the callback until the it is run,
196 // when ownership is passed to the callback function. This means the callback
197 // can only be run once. If the callback is never run, it will delete the
224 // that you must ensure the object outlives the callback!
233 // The design Callback and Bind is heavily influenced by C++'s
234 // tr1::function/tr1::bind, and by the "Google Callback" system used inside
241 // 1) The Callback classes.
245 // The Callback classes represent a generic function pointer. Internally,
247 // and all its bound parameters. Each Callback specialization has a templated
253 // Callback's constructor takes the BindState<>* that has the full static type
267 // - Returning an Callback<> with an arity matching the number of unbound
310 // Furthermore, in Chromium, it is desirable for the Callback to take a
328 // The Google callback system also does not support refcounting. Furthermore,
344 // If you are thinking of forward declaring Callback in your own header file,
350 class Callback<R(Args...), copy_mode>
360 Callback() : internal::CallbackBase<copy_mode>(nullptr) {}
362 Callback(internal::BindStateBase* bind_state,
371 bool Equals(const Callback& other) const {
382 // Callback::Run() to the target function. Perfect Forwarding requires
384 // InvokerType::Run() needs to be fixed in the callback constructor, so Run()