Home | History | Annotate | Download | only in base

Lines Matching refs:Callback

12 // NOTE: Header files that do not require the full definition of Callback or
19 // The templated Callback class is a generalized function object. Together
29 // A callback with no unbound input parameters (base::Callback<void()>)
36 // The Callback objects themselves should be passed by const-reference, and
51 // base::Callback<int()> func_cb = base::Bind(&Return5);
65 // base::Callback<void()> ref_cb = base::Bind(&Ref::Foo, ref);
73 // RUNNING A CALLBACK
76 // signature as the template argument to the callback.
78 // void DoSomething(const base::Callback<void(int, std::string)>& callback) {
79 // callback.Run(5, "hello");
85 // void DoSomething(const base::Callback<double(double)>& callback) {
86 // double myresult = callback.Run(3.14159);
87 // myresult += callback.Run(2.71828);
92 // Unbound parameters are specified at the time a callback is Run(). They are
93 // specified in the Callback template type:
96 // base::Callback<void(int, const std::string&)> cb = base::Bind(&MyFunc);
101 // Bound parameters are specified when you create thee callback as arguments
103 // callback doesn't see those values or even know that the function it's
107 // base::Callback<void()> cb = base::Bind(&MyFunc, 23, "hello world");
110 // A callback with no unbound input parameters (base::Callback<void()>)
122 // You can specify some parameters when you create the callback, and specify
123 // the rest when you execute the callback.
126 // base::Callback<void(const std::string&)> cb = base::Bind(&MyFunc, 23);
141 // The callback will not be run if the object has already been destroyed.
153 // BINDING A CLASS METHOD AND HAVING THE CALLBACK OWN THE CLASS
158 // The object will be deleted when the callback is destroyed, even if it's
164 // Sometimes you want to call a function that returns a value in a callback
168 // base::Callback<void(int)> cb =
177 // function. A callback with no parameters or no unbound parameters is called a
178 // Closure (base::Callback<void()> and base::Closure are the same thing).
180 // PASSING PARAMETERS OWNED BY THE CALLBACK
186 // The parameter will be deleted when the callback is destroyed, even if it's
196 // Ownership of the parameter will be with the callback until the it is run,
197 // when ownership is passed to the callback function. This means the callback
198 // can only be run once. If the callback is never run, it will delete the
225 // that you must ensure the object outlives the callback!
234 // The design Callback and Bind is heavily influenced by C++'s
235 // tr1::function/tr1::bind, and by the "Google Callback" system used inside
242 // 1) The Callback classes.
246 // The Callback classes represent a generic function pointer. Internally,
248 // and all its bound parameters. Each Callback specialization has a templated
254 // Callback's constructor takes the BindState<>* that has the full static type
268 // - Returning an Callback<> with an arity matching the number of unbound
311 // Furthermore, in Chromium, it is desirable for the Callback to take a
329 // The Google callback system also does not support refcounting. Furthermore,
347 // First, we forward declare the Callback class template. This informs the
349 // signature that the Callback is representing.
355 // If you are thinking of forward declaring Callback in your own header file,
364 class Callback<R(Args...)> : public internal::CallbackBase {
370 Callback() : CallbackBase(nullptr) { }
373 explicit Callback(
385 bool Equals(const Callback& other) const {