YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/gutil/callback.h
Line
Count
Source (jump to first uncovered line)
1
// This file was GENERATED by command:
2
//     pump.py callback.h.pump
3
// DO NOT EDIT BY HAND!!!
4
5
6
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
7
// Use of this source code is governed by a BSD-style license that can be
8
// found in the LICENSE file.
9
//
10
// The following only applies to changes made to this file as part of YugaByte development.
11
//
12
// Portions Copyright (c) YugaByte, Inc.
13
//
14
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
15
// in compliance with the License.  You may obtain a copy of the License at
16
//
17
// http://www.apache.org/licenses/LICENSE-2.0
18
//
19
// Unless required by applicable law or agreed to in writing, software distributed under the License
20
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
21
// or implied.  See the License for the specific language governing permissions and limitations
22
// under the License.
23
//
24
25
#ifndef YB_GUTIL_CALLBACK_H_
26
#define YB_GUTIL_CALLBACK_H_
27
28
#include "yb/gutil/callback_forward.h"
29
#include "yb/gutil/callback_internal.h"
30
#include "yb/gutil/template_util.h"
31
32
// NOTE: Header files that do not require the full definition of Callback or
33
// Closure should #include "yb/gutil/callback_forward.h" instead of this file.
34
35
// -----------------------------------------------------------------------------
36
// Introduction
37
// -----------------------------------------------------------------------------
38
//
39
// The templated Callback class is a generalized function object. Together
40
// with the Bind() function in bind.h, they provide a type-safe method for
41
// performing partial application of functions.
42
//
43
// Partial application (or "currying") is the process of binding a subset of
44
// a function's arguments to produce another function that takes fewer
45
// arguments. This can be used to pass around a unit of delayed execution,
46
// much like lexical closures are used in other languages. For example, it
47
// is used in Chromium code to schedule tasks on different MessageLoops.
48
//
49
// A callback with no unbound input parameters (yb::Callback<void(void)>)
50
// is called a yb::Closure. Note that this is NOT the same as what other
51
// languages refer to as a closure -- it does not retain a reference to its
52
// enclosing environment.
53
//
54
// MEMORY MANAGEMENT AND PASSING
55
//
56
// The Callback objects themselves should be passed by const-reference, and
57
// stored by copy. They internally store their state via a refcounted class
58
// and thus do not need to be deleted.
59
//
60
// The reason to pass via a const-reference is to avoid unnecessary
61
// AddRef/Release pairs to the internal state.
62
//
63
//
64
// -----------------------------------------------------------------------------
65
// Quick reference for basic stuff
66
// -----------------------------------------------------------------------------
67
//
68
// BINDING A BARE FUNCTION
69
//
70
//   int Return5() { return 5; }
71
//   yb::Callback<int(void)> func_cb = yb::Bind(&Return5);
72
//   LOG(INFO) << func_cb.Run();  // Prints 5.
73
//
74
// BINDING A CLASS METHOD
75
//
76
//   The first argument to bind is the member function to call, the second is
77
//   the object on which to call it.
78
//
79
//   class Ref : public yb::RefCountedThreadSafe<Ref> {
80
//    public:
81
//     int Foo() { return 3; }
82
//     void PrintBye() { LOG(INFO) << "bye."; }
83
//   };
84
//   scoped_refptr<Ref> ref = new Ref();
85
//   yb::Callback<void(void)> ref_cb = yb::Bind(&Ref::Foo, ref);
86
//   LOG(INFO) << ref_cb.Run();  // Prints out 3.
87
//
88
//   By default the object must support RefCounted or you will get a compiler
89
//   error. If you're passing between threads, be sure it's
90
//   RefCountedThreadSafe! See "Advanced binding of member functions" below if
91
//   you don't want to use reference counting.
92
//
93
// RUNNING A CALLBACK
94
//
95
//   Callbacks can be run with their "Run" method, which has the same
96
//   signature as the template argument to the callback.
97
//
98
//   void DoSomething(const yb::Callback<void(int, std::string)>& callback) {
99
//     callback.Run(5, "hello");
100
//   }
101
//
102
//   Callbacks can be run more than once (they don't get deleted or marked when
103
//   run). However, this precludes using yb::Passed (see below).
104
//
105
//   void DoSomething(const yb::Callback<double(double)>& callback) {
106
//     double myresult = callback.Run(3.14159);
107
//     myresult += callback.Run(2.71828);
108
//   }
109
//
110
// PASSING UNBOUND INPUT PARAMETERS
111
//
112
//   Unbound parameters are specified at the time a callback is Run(). They are
113
//   specified in the Callback template type:
114
//
115
//   void MyFunc(int i, const std::string& str) {}
116
//   yb::Callback<void(int, const std::string&)> cb = yb::Bind(&MyFunc);
117
//   cb.Run(23, "hello, world");
118
//
119
// PASSING BOUND INPUT PARAMETERS
120
//
121
//   Bound parameters are specified when you create the callback as arguments
122
//   to Bind(). They will be passed to the function and the Run()ner of the
123
//   callback doesn't see those values or even know that the function it's
124
//   calling.
125
//
126
//   void MyFunc(int i, const std::string& str) {}
127
//   yb::Callback<void(void)> cb = yb::Bind(&MyFunc, 23, "hello world");
128
//   cb.Run();
129
//
130
//   A callback with no unbound input parameters (yb::Callback<void(void)>)
131
//   is called a yb::Closure. So we could have also written:
132
//
133
//   yb::Closure cb = yb::Bind(&MyFunc, 23, "hello world");
134
//
135
//   When calling member functions, bound parameters just go after the object
136
//   pointer.
137
//
138
//   yb::Closure cb = yb::Bind(&MyClass::MyFunc, this, 23, "hello world");
139
//
140
// PARTIAL BINDING OF PARAMETERS
141
//
142
//   You can specify some parameters when you create the callback, and specify
143
//   the rest when you execute the callback.
144
//
145
//   void MyFunc(int i, const std::string& str) {}
146
//   yb::Callback<void(const std::string&)> cb = yb::Bind(&MyFunc, 23);
147
//   cb.Run("hello world");
148
//
149
//   When calling a function bound parameters are first, followed by unbound
150
//   parameters.
151
//
152
//
153
// -----------------------------------------------------------------------------
154
// Quick reference for advanced binding
155
// -----------------------------------------------------------------------------
156
//
157
// BINDING A CLASS METHOD WITH WEAK POINTERS
158
//
159
//   yb::Bind(&MyClass::Foo, GetWeakPtr());
160
//
161
//   The callback will not be issued if the object is destroyed at the time
162
//   it's issued. DANGER: weak pointers are not threadsafe, so don't use this
163
//   when passing between threads!
164
//
165
// BINDING A CLASS METHOD WITH MANUAL LIFETIME MANAGEMENT
166
//
167
//   yb::Bind(&MyClass::Foo, yb::Unretained(this));
168
//
169
//   This disables all lifetime management on the object. You're responsible
170
//   for making sure the object is alive at the time of the call. You break it,
171
//   you own it!
172
//
173
// BINDING A CLASS METHOD AND HAVING THE CALLBACK OWN THE CLASS
174
//
175
//   MyClass* myclass = new MyClass;
176
//   yb::Bind(&MyClass::Foo, yb::Owned(myclass));
177
//
178
//   The object will be deleted when the callback is destroyed, even if it's
179
//   not run (like if you post a task during shutdown). Potentially useful for
180
//   "fire and forget" cases.
181
//
182
// IGNORING RETURN VALUES
183
//
184
//   Sometimes you want to call a function that returns a value in a callback
185
//   that doesn't expect a return value.
186
//
187
//   int DoSomething(int arg) { cout << arg << endl; }
188
//   yb::Callback<void<int>) cb =
189
//       yb::Bind(yb::IgnoreResult(&DoSomething));
190
//
191
//
192
// -----------------------------------------------------------------------------
193
// Quick reference for binding parameters to Bind()
194
// -----------------------------------------------------------------------------
195
//
196
// Bound parameters are specified as arguments to Bind() and are passed to the
197
// function. A callback with no parameters or no unbound parameters is called a
198
// Closure (yb::Callback<void(void)> and yb::Closure are the same thing).
199
//
200
// PASSING PARAMETERS OWNED BY THE CALLBACK
201
//
202
//   void Foo(int* arg) { cout << *arg << endl; }
203
//   int* pn = new int(1);
204
//   yb::Closure foo_callback = yb::Bind(&foo, yb::Owned(pn));
205
//
206
//   The parameter will be deleted when the callback is destroyed, even if it's
207
//   not run (like if you post a task during shutdown).
208
//
209
// PASSING PARAMETERS AS A scoped_ptr
210
//
211
//   void TakesOwnership(scoped_ptr<Foo> arg) {}
212
//   scoped_ptr<Foo> f(new Foo);
213
//   // f becomes null during the following call.
214
//   yb::Closure cb = yb::Bind(&TakesOwnership, yb::Passed(&f));
215
//
216
//   Ownership of the parameter will be with the callback until the it is run,
217
//   when ownership is passed to the callback function. This means the callback
218
//   can only be run once. If the callback is never run, it will delete the
219
//   object when it's destroyed.
220
//
221
// PASSING PARAMETERS AS A scoped_refptr
222
//
223
//   void TakesOneRef(scoped_refptr<Foo> arg) {}
224
//   scoped_refptr<Foo> f(new Foo)
225
//   yb::Closure cb = yb::Bind(&TakesOneRef, f);
226
//
227
//   This should "just work." The closure will take a reference as long as it
228
//   is alive, and another reference will be taken for the called function.
229
//
230
// PASSING PARAMETERS BY REFERENCE
231
//
232
//   void foo(int arg) { cout << arg << endl }
233
//   int n = 1;
234
//   yb::Closure has_ref = yb::Bind(&foo, yb::ConstRef(n));
235
//   n = 2;
236
//   has_ref.Run();  // Prints "2"
237
//
238
//   Normally parameters are copied in the closure. DANGER: ConstRef stores a
239
//   const reference instead, referencing the original parameter. This means
240
//   that you must ensure the object outlives the callback!
241
//
242
//
243
// -----------------------------------------------------------------------------
244
// Implementation notes
245
// -----------------------------------------------------------------------------
246
//
247
// WHERE IS THIS DESIGN FROM:
248
//
249
// The design Callback and Bind is heavily influenced by C++'s
250
// tr1::function/tr1::bind, and by the "Google Callback" system used inside
251
// Google.
252
//
253
//
254
// HOW THE IMPLEMENTATION WORKS:
255
//
256
// There are three main components to the system:
257
//   1) The Callback classes.
258
//   2) The Bind() functions.
259
//   3) The arguments wrappers (e.g., Unretained() and ConstRef()).
260
//
261
// The Callback classes represent a generic function pointer. Internally,
262
// it stores a refcounted piece of state that represents the target function
263
// and all its bound parameters.  Each Callback specialization has a templated
264
// constructor that takes an BindState<>*.  In the context of the constructor,
265
// the static type of this BindState<> pointer uniquely identifies the
266
// function it is representing, all its bound parameters, and a Run() method
267
// that is capable of invoking the target.
268
//
269
// Callback's constructor takes the BindState<>* that has the full static type
270
// and erases the target function type as well as the types of the bound
271
// parameters.  It does this by storing a pointer to the specific Run()
272
// function, and upcasting the state of BindState<>* to a
273
// BindStateBase*. This is safe as long as this BindStateBase pointer
274
// is only used with the stored Run() pointer.
275
//
276
// To BindState<> objects are created inside the Bind() functions.
277
// These functions, along with a set of internal templates, are responsible for
278
//
279
//  - Unwrapping the function signature into return type, and parameters
280
//  - Determining the number of parameters that are bound
281
//  - Creating the BindState storing the bound parameters
282
//  - Performing compile-time asserts to avoid error-prone behavior
283
//  - Returning an Callback<> with an arity matching the number of unbound
284
//    parameters and that knows the correct refcounting semantics for the
285
//    target object if we are binding a method.
286
//
287
// The Bind functions do the above using type-inference, and template
288
// specializations.
289
//
290
// By default Bind() will store copies of all bound parameters, and attempt
291
// to refcount a target object if the function being bound is a class method.
292
// These copies are created even if the function takes parameters as const
293
// references. (Binding to non-const references is forbidden, see bind.h.)
294
//
295
// To change this behavior, we introduce a set of argument wrappers
296
// (e.g., Unretained(), and ConstRef()).  These are simple container templates
297
// that are passed by value, and wrap a pointer to argument.  See the
298
// file-level comment in yb/gutil/bind_helpers.h for more info.
299
//
300
// These types are passed to the Unwrap() functions, and the MaybeRefcount()
301
// functions respectively to modify the behavior of Bind().  The Unwrap()
302
// and MaybeRefcount() functions change behavior by doing partial
303
// specialization based on whether or not a parameter is a wrapper type.
304
//
305
// ConstRef() is similar to tr1::cref.  Unretained() is specific to Chromium.
306
//
307
//
308
// WHY NOT TR1 FUNCTION/BIND?
309
//
310
// Direct use of tr1::function and tr1::bind was considered, but ultimately
311
// rejected because of the number of copy constructors invocations involved
312
// in the binding of arguments during construction, and the forwarding of
313
// arguments during invocation.  These copies will no longer be an issue in
314
// C++0x because C++0x will support rvalue reference allowing for the compiler
315
// to avoid these copies.  However, waiting for C++0x is not an option.
316
//
317
// Measured with valgrind on gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5), the
318
// tr1::bind call itself will invoke a non-trivial copy constructor three times
319
// for each bound parameter.  Also, each when passing a tr1::function, each
320
// bound argument will be copied again.
321
//
322
// In addition to the copies taken at binding and invocation, copying a
323
// tr1::function causes a copy to be made of all the bound parameters and
324
// state.
325
//
326
// Furthermore, in Chromium, it is desirable for the Callback to take a
327
// reference on a target object when representing a class method call.  This
328
// is not supported by tr1.
329
//
330
// Lastly, tr1::function and tr1::bind has a more general and flexible API.
331
// This includes things like argument reordering by use of
332
// tr1::bind::placeholder, support for non-const reference parameters, and some
333
// limited amount of subtyping of the tr1::function object (e.g.,
334
// tr1::function<int(int)> is convertible to tr1::function<void(int)>).
335
//
336
// These are not features that are required in Chromium. Some of them, such as
337
// allowing for reference parameters, and subtyping of functions, may actually
338
// become a source of errors. Removing support for these features actually
339
// allows for a simpler implementation, and a terser Currying API.
340
//
341
//
342
// WHY NOT GOOGLE CALLBACKS?
343
//
344
// The Google callback system also does not support refcounting.  Furthermore,
345
// its implementation has a number of strange edge cases with respect to type
346
// conversion of its arguments.  In particular, the argument's constness must
347
// at times match exactly the function signature, or the type-inference might
348
// break.  Given the above, writing a custom solution was easier.
349
//
350
//
351
// MISSING FUNCTIONALITY
352
//  - Invoking the return of Bind.  Bind(&foo).Run() does not work;
353
//  - Binding arrays to functions that take a non-const pointer.
354
//    Example:
355
//      void Foo(const char* ptr);
356
//      void Bar(char* ptr);
357
//      Bind(&Foo, "test");
358
//      Bind(&Bar, "test");  // This fails because ptr is not const.
359
360
namespace yb {
361
362
// First, we forward declare the Callback class template. This informs the
363
// compiler that the template only has 1 type parameter which is the function
364
// signature that the Callback is representing.
365
//
366
// After this, create template specializations for 0-7 parameters. Note that
367
// even though the template typelist grows, the specialization still
368
// only has one type: the function signature.
369
//
370
// If you are thinking of forward declaring Callback in your own header file,
371
// please include "base/callback_forward.h" instead.
372
template <typename Sig>
373
class Callback;
374
375
namespace internal {
376
template <typename Runnable, typename RunType, typename BoundArgsType>
377
struct BindState;
378
}  // namespace internal
379
380
template <typename R>
381
class Callback<R(void)> : public internal::CallbackBase {
382
 public:
383
  typedef R(RunType)();
384
385
16.2k
  Callback() : CallbackBase(NULL) { }
386
387
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
388
  // return the exact Callback<> type.  See base/bind.h for details.
389
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
390
  Callback(internal::BindState<Runnable, BindRunType,
391
           BoundArgsType>* bind_state)
392
15.5M
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
15.5M
    PolymorphicInvoke invoke_func =
398
15.5M
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
15.5M
            ::InvokerType::Run;
400
15.5M
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
15.5M
  }
_ZN2yb8CallbackIFivEEC2INS_8internal15RunnableAdapterIPS1_EES1_FvvEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
1
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
1
    PolymorphicInvoke invoke_func =
398
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
1
            ::InvokerType::Run;
400
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
1
  }
_ZN2yb8CallbackIFivEEC2INS_8internal15RunnableAdapterIMNS_3RefEFivEEEFiPS6_EFv13scoped_refptrIS6_EEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
1
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
1
    PolymorphicInvoke invoke_func =
398
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
1
            ::InvokerType::Run;
400
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
1
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIMNS_12RefCountableEKFvvEEEFvPKS6_EFvPS6_EEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
1
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
1
    PolymorphicInvoke invoke_func =
398
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
1
            ::InvokerType::Run;
400
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
1
  }
_ZN2yb8CallbackIFxvEEC2INS_8internal15RunnableAdapterIPFxPiEEES7_FvNS4_17UnretainedWrapperIiEEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
3
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
3
    PolymorphicInvoke invoke_func =
398
3
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
3
            ::InvokerType::Run;
400
3
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
3
  }
_ZN2yb8CallbackIFxvEEC2INS_8internal15RunnableAdapterIPFxxEEES6_FvxEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
133
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
133
    PolymorphicInvoke invoke_func =
398
133
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
133
            ::InvokerType::Run;
400
133
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
133
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIPFvPNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPKcEEESG_FvSD_NS4_17UnretainedWrapperISE_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
2
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
2
    PolymorphicInvoke invoke_func =
398
2
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
2
            ::InvokerType::Run;
400
2
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
2
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIPFviPiEEES7_S7_EEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
1
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
1
    PolymorphicInvoke invoke_func =
398
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
1
            ::InvokerType::Run;
400
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
1
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIMNS_7PromiseIiEEFvRKiEEEFvPS7_S9_EFvNS4_17UnretainedWrapperIS7_EEiEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
1
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
1
    PolymorphicInvoke invoke_func =
398
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
1
            ::InvokerType::Run;
400
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
1
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIMNS_9consensus16PeerMessageQueueEFvRKNS6_22MajorityReplicatedDataEEEEFvPS7_SA_EFvNS4_17UnretainedWrapperIS7_EES8_EEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
15.1M
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
15.1M
    PolymorphicInvoke invoke_func =
398
15.1M
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
15.1M
            ::InvokerType::Run;
400
15.1M
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
15.1M
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIMNS_3log3LogEFvvEEEFvPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
96.9k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
96.9k
    PolymorphicInvoke invoke_func =
398
96.9k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
96.9k
            ::InvokerType::Run;
400
96.9k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
96.9k
  }
_ZN2yb8CallbackIFNS_6StatusEvEEC2INS_8internal15RunnableAdapterIMNS_6master14CatalogManagerEFS1_vEEEFS1_PS8_EFvNS5_17UnretainedWrapperIS8_EEEEEPNS5_9BindStateIT_T0_T1_EE
Line
Count
Source
392
5.45k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
5.45k
    PolymorphicInvoke invoke_func =
398
5.45k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
5.45k
            ::InvokerType::Run;
400
5.45k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
5.45k
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIMNS_6master14CatalogManagerEFvvEEEFvPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
2.01k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
2.01k
    PolymorphicInvoke invoke_func =
398
2.01k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
2.01k
            ::InvokerType::Run;
400
2.01k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
2.01k
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIMNS_6master6MasterEFvvEEEFvPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
5.42k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
5.42k
    PolymorphicInvoke invoke_func =
398
5.42k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
5.42k
            ::InvokerType::Run;
400
5.42k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
5.42k
  }
_ZN2yb8CallbackIFyvEEC2INS_8internal15RunnableAdapterIMNS_6server11HybridClockEFyvEEEFyPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
34.2k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
34.2k
    PolymorphicInvoke invoke_func =
398
34.2k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
34.2k
            ::InvokerType::Run;
400
34.2k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
34.2k
  }
_ZN2yb8CallbackIFyvEEC2INS_8internal15RunnableAdapterIPFyyEEES6_FvyEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
286
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
286
    PolymorphicInvoke invoke_func =
398
286
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
286
            ::InvokerType::Run;
400
286
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
286
  }
_ZN2yb8CallbackIFxvEEC2INS_8internal15RunnableAdapterIMNS_6server11HybridClockEFxvEEEFxPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
17.1k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
17.1k
    PolymorphicInvoke invoke_func =
398
17.1k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
17.1k
            ::InvokerType::Run;
400
17.1k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
17.1k
  }
_ZN2yb8CallbackIFyvEEC2INS_8internal15RunnableAdapterIMNS_6server12LogicalClockEFyvEEEFyPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
72
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
72
    PolymorphicInvoke invoke_func =
398
72
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
72
            ::InvokerType::Run;
400
72
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
72
  }
_ZN2yb8CallbackIFyvEEC2INS_8internal15RunnableAdapterIPFyPKcEEES8_FvNS4_17UnretainedWrapperIS6_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
105k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
105k
    PolymorphicInvoke invoke_func =
398
105k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
105k
            ::InvokerType::Run;
400
105k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
105k
  }
read_query.cc:_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIPFvPNS_6tablet14AbstractTabletENSt3__16chrono10time_pointINS_15CoarseMonoClockENSA_8durationIxNS9_5ratioILl1ELl1000000000EEEEEEERKNS_14ReadHybridTimeERKNS_18RedisReadRequestPBEPNS_15RedisResponsePBERKNS9_8functionIFvRKNS_6StatusEEEEEEESY_FvNS4_17UnretainedWrapperIS7_EESH_SI_SL_NS11_ISO_EEZNS_7tserver12_GLOBAL__N_19ReadQuery10DoReadImplEvE3$_1EEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
42.9k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
42.9k
    PolymorphicInvoke invoke_func =
398
42.9k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
42.9k
            ::InvokerType::Run;
400
42.9k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
42.9k
  }
_ZN2yb8CallbackIFvvEEC2INS_8internal15RunnableAdapterIMNS_5debug8TraceLogEFvvEEEFvPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
8
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
8
    PolymorphicInvoke invoke_func =
398
8
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
8
            ::InvokerType::Run;
400
8
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
8
  }
_ZN2yb8CallbackIFyvEEC2INS_8internal15RunnableAdapterIPS1_EES1_FvvEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
87.5k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
87.5k
    PolymorphicInvoke invoke_func =
398
87.5k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
87.5k
            ::InvokerType::Run;
400
87.5k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
87.5k
  }
thread.cc:_ZN2yb8CallbackIFyvEEC2INS_8internal15RunnableAdapterIMNS_12_GLOBAL__N_19ThreadMgrEFyvEEEFyPS7_EFvNS4_17UnretainedWrapperIS7_EEEEEPNS4_9BindStateIT_T0_T1_EE
Line
Count
Source
392
35.0k
      : CallbackBase(bind_state) {
393
394
    // Force the assignment to a local variable of PolymorphicInvoke
395
    // so the compiler will typecheck that the passed in Run() method has
396
    // the correct type.
397
35.0k
    PolymorphicInvoke invoke_func =
398
35.0k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
399
35.0k
            ::InvokerType::Run;
400
35.0k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
401
35.0k
  }
402
403
  bool Equals(const Callback& other) const {
404
    return CallbackBase::Equals(other);
405
  }
406
407
15.5M
  R Run() const {
408
15.5M
    PolymorphicInvoke f =
409
15.5M
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
410
411
15.5M
    return f(bind_state_.get());
412
15.5M
  }
_ZNK2yb8CallbackIFivEE3RunEv
Line
Count
Source
407
2
  R Run() const {
408
2
    PolymorphicInvoke f =
409
2
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
410
411
2
    return f(bind_state_.get());
412
2
  }
_ZNK2yb8CallbackIFvvEE3RunEv
Line
Count
Source
407
15.3M
  R Run() const {
408
15.3M
    PolymorphicInvoke f =
409
15.3M
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
410
411
15.3M
    return f(bind_state_.get());
412
15.3M
  }
_ZNK2yb8CallbackIFxvEE3RunEv
Line
Count
Source
407
15.3k
  R Run() const {
408
15.3k
    PolymorphicInvoke f =
409
15.3k
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
410
411
15.3k
    return f(bind_state_.get());
412
15.3k
  }
_ZNK2yb8CallbackIFNS_6StatusEvEE3RunEv
Line
Count
Source
407
2.01k
  R Run() const {
408
2.01k
    PolymorphicInvoke f =
409
2.01k
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
410
411
2.01k
    return f(bind_state_.get());
412
2.01k
  }
_ZNK2yb8CallbackIFyvEE3RunEv
Line
Count
Source
407
227k
  R Run() const {
408
227k
    PolymorphicInvoke f =
409
227k
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
410
411
227k
    return f(bind_state_.get());
412
227k
  }
413
414
 private:
415
  typedef R(*PolymorphicInvoke)(
416
      internal::BindStateBase*);
417
418
};
419
420
template <typename R, typename A1>
421
class Callback<R(A1)> : public internal::CallbackBase {
422
 public:
423
  typedef R(RunType)(A1);
424
425
14.8M
  Callback() : CallbackBase(NULL) { }
426
427
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
428
  // return the exact Callback<> type.  See base/bind.h for details.
429
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
430
  Callback(internal::BindState<Runnable, BindRunType,
431
           BoundArgsType>* bind_state)
432
27.2M
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
27.2M
    PolymorphicInvoke invoke_func =
438
27.2M
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
27.2M
            ::InvokerType::Run;
440
27.2M
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
27.2M
  }
_ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIPFvRKNSt3__110shared_ptrINS_9consensus12ReplicateMsgEEES3_EEESG_FvSD_EEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
432
250
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
250
    PolymorphicInvoke invoke_func =
438
250
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
250
            ::InvokerType::Run;
440
250
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
250
  }
_ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIPS4_EES4_FvvEEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
432
191
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
191
    PolymorphicInvoke invoke_func =
438
191
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
191
            ::InvokerType::Run;
440
191
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
191
  }
mt-log-test.cc:_ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_3log12_GLOBAL__N_119CustomLatchCallbackEFvS3_EEEFvPSB_S3_EFvSF_EEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
432
2.00k
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
2.00k
    PolymorphicInvoke invoke_func =
438
2.00k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
2.00k
            ::InvokerType::Run;
440
2.00k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
2.00k
  }
_ZN2yb8CallbackIFvNSt3__110shared_ptrINS_9consensus18StateChangeContextEEEEEC2INS_8internal15RunnableAdapterIPS6_EES6_FvvEEEPNS9_9BindStateIT_T0_T1_EE
Line
Count
Source
432
29
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
29
    PolymorphicInvoke invoke_func =
438
29
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
29
            ::InvokerType::Run;
440
29
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
29
  }
_ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_12SynchronizerEFvS3_EEEFvPS9_S3_EFvNS7_17UnretainedWrapperIS9_EEEEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
432
854k
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
854k
    PolymorphicInvoke invoke_func =
438
854k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
854k
            ::InvokerType::Run;
440
854k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
854k
  }
_ZN2yb8CallbackIFvNSt3__110shared_ptrINS_9consensus18StateChangeContextEEEEEC2INS_8internal15RunnableAdapterIMNS_6tablet14TabletPeerTestEFvRKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES5_EEEFvPSC_SK_S5_EFvNS9_17UnretainedWrapperISC_EESI_EEEPNS9_9BindStateIT_T0_T1_EE
Line
Count
Source
432
4
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
4
    PolymorphicInvoke invoke_func =
438
4
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
4
            ::InvokerType::Run;
440
4
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
4
  }
_ZN2yb8CallbackIFiPKcEEC2INS_8internal15RunnableAdapterIPFiiS2_EEES8_FviEEEPNS6_9BindStateIT_T0_T1_EE
Line
Count
Source
432
1
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
1
    PolymorphicInvoke invoke_func =
438
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
1
            ::InvokerType::Run;
440
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
1
  }
_ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_9consensus16PeerMessageQueueEFvRKNS_4OpIdES3_EEEFvPSA_SD_S3_EFvNS7_17UnretainedWrapperISA_EESB_EEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
432
13.1M
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
13.1M
    PolymorphicInvoke invoke_func =
438
13.1M
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
13.1M
            ::InvokerType::Run;
440
13.1M
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
13.1M
  }
_ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_9consensus8LogCacheEFvxRKS5_S3_EEEFvPSA_xSC_S3_EFvNS7_17UnretainedWrapperISA_EExS5_EEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
432
13.1M
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
13.1M
    PolymorphicInvoke invoke_func =
438
13.1M
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
13.1M
            ::InvokerType::Run;
440
13.1M
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
13.1M
  }
_ZN2yb8CallbackIFvNSt3__110shared_ptrINS_9consensus18StateChangeContextEEEEEC2INS_8internal15RunnableAdapterIMNS_6master15SysCatalogTableEFvRKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES5_EEEFvPSC_SK_S5_EFvNS9_17UnretainedWrapperISC_EESI_EEEPNS9_9BindStateIT_T0_T1_EE
Line
Count
Source
432
5.35k
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
5.35k
    PolymorphicInvoke invoke_func =
438
5.35k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
5.35k
            ::InvokerType::Run;
440
5.35k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
5.35k
  }
Unexecuted instantiation: _ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_6master10enterprise14CatalogManagerEFvRKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEERKNSC_10shared_ptrINSC_6vectorINS_6client11YBTableInfoENSG_ISO_EEEEEERKNSC_13unordered_mapISI_SI_NSC_4hashISI_EENSC_8equal_toISI_EENSG_INSC_4pairISJ_SI_EEEEEES3_EEEFvPSB_SK_ST_S14_S3_EFvNS7_17UnretainedWrapperISB_EESI_SR_S12_EEEPNS7_9BindStateIT_T0_T1_EE
Unexecuted instantiation: _ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_6master10enterprise14CatalogManagerEFvRKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEERKNSC_10shared_ptrINSC_6vectorINS_6client11YBTableInfoENSG_ISO_EEEEEESK_RKNSC_13unordered_mapISI_SI_NSC_4hashISI_EENSC_8equal_toISI_EENSG_INSC_4pairISJ_SI_EEEEEES3_EEEFvPSB_SK_ST_SK_S14_S3_EFvNS7_17UnretainedWrapperISB_EESI_SR_SI_S12_EEEPNS7_9BindStateIT_T0_T1_EE
Unexecuted instantiation: _ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_6master10enterprise14CatalogManagerEFvRKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEERKNSC_10shared_ptrINS_6client11YBTableInfoEEERKNSC_13unordered_mapISI_SI_NSC_4hashISI_EENSC_8equal_toISI_EENSG_INSC_4pairISJ_SI_EEEEEES3_EEEFvPSB_SK_SQ_S11_S3_EFvNS7_17UnretainedWrapperISB_EESI_SO_SZ_EEEPNS7_9BindStateIT_T0_T1_EE
_ZN2yb8CallbackIFvNSt3__110shared_ptrINS_9consensus18StateChangeContextEEEEEC2INS_8internal15RunnableAdapterIMNS_7tserver15TSTabletManagerEFvRKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES5_EEEFvPSC_SK_S5_EFvNS9_17UnretainedWrapperISC_EESI_EEEPNS9_9BindStateIT_T0_T1_EE
Line
Count
Source
432
83.3k
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
83.3k
    PolymorphicInvoke invoke_func =
438
83.3k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
83.3k
            ::InvokerType::Run;
440
83.3k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
83.3k
  }
_ZN2yb8CallbackIFvNSt3__110shared_ptrINS_9consensus18StateChangeContextEEEEEC2INS_8internal15RunnableAdapterIMNS_7tserver26RemoteBootstrapSessionTestEFvRKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES5_EEEFvPSC_SK_S5_EFvNS9_17UnretainedWrapperISC_EESI_EEEPNS9_9BindStateIT_T0_T1_EE
Line
Count
Source
432
4
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
4
    PolymorphicInvoke invoke_func =
438
4
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
4
            ::InvokerType::Run;
440
4
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
4
  }
_ZN2yb8CallbackIFvPNS_5debug15TraceBucketDataEEEC2INS_8internal15RunnableAdapterIPS4_EES4_FvvEEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
432
3
      : CallbackBase(bind_state) {
433
434
    // Force the assignment to a local variable of PolymorphicInvoke
435
    // so the compiler will typecheck that the passed in Run() method has
436
    // the correct type.
437
3
    PolymorphicInvoke invoke_func =
438
3
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
439
3
            ::InvokerType::Run;
440
3
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
441
3
  }
Unexecuted instantiation: _ZN2yb8CallbackIFvRKNS_6StatusEEEC2INS_8internal15RunnableAdapterIPFvNSt3__18weak_ptrINS_12SynchronizerEEES3_EEESD_FvSC_EEEPNS7_9BindStateIT_T0_T1_EE
442
443
  bool Equals(const Callback& other) const {
444
    return CallbackBase::Equals(other);
445
  }
446
447
27.4M
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1) const {
448
27.4M
    PolymorphicInvoke f =
449
27.4M
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
450
451
27.4M
    return f(bind_state_.get(), internal::CallbackForward(a1));
452
27.4M
  }
_ZNK2yb8CallbackIFvRKNS_6StatusEEE3RunES3_
Line
Count
Source
447
27.1M
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1) const {
448
27.1M
    PolymorphicInvoke f =
449
27.1M
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
450
451
27.1M
    return f(bind_state_.get(), internal::CallbackForward(a1));
452
27.1M
  }
_ZNK2yb8CallbackIFiPKcEE3RunERKS2_
Line
Count
Source
447
1
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1) const {
448
1
    PolymorphicInvoke f =
449
1
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
450
451
1
    return f(bind_state_.get(), internal::CallbackForward(a1));
452
1
  }
_ZNK2yb8CallbackIFvNSt3__110shared_ptrINS_9consensus18StateChangeContextEEEEE3RunERKS5_
Line
Count
Source
447
358k
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1) const {
448
358k
    PolymorphicInvoke f =
449
358k
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
450
451
358k
    return f(bind_state_.get(), internal::CallbackForward(a1));
452
358k
  }
_ZNK2yb8CallbackIFvPNS_5debug15TraceBucketDataEEE3RunERKS3_
Line
Count
Source
447
303
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1) const {
448
303
    PolymorphicInvoke f =
449
303
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
450
451
303
    return f(bind_state_.get(), internal::CallbackForward(a1));
452
303
  }
453
454
 private:
455
  typedef R(*PolymorphicInvoke)(
456
      internal::BindStateBase*,
457
          typename internal::CallbackParamTraits<A1>::ForwardType);
458
459
};
460
461
template <typename R, typename A1, typename A2>
462
class Callback<R(A1, A2)> : public internal::CallbackBase {
463
 public:
464
  typedef R(RunType)(A1, A2);
465
466
34.1k
  Callback() : CallbackBase(NULL) { }
_ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2Ev
Line
Count
Source
466
34.1k
  Callback() : CallbackBase(NULL) { }
_ZN2yb8CallbackIFvRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_6StatusEEEC2Ev
Line
Count
Source
466
1
  Callback() : CallbackBase(NULL) { }
467
468
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
469
  // return the exact Callback<> type.  See base/bind.h for details.
470
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
471
  Callback(internal::BindState<Runnable, BindRunType,
472
           BoundArgsType>* bind_state)
473
966k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
966k
    PolymorphicInvoke invoke_func =
479
966k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
966k
            ::InvokerType::Run;
481
966k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
966k
  }
_ZN2yb8CallbackIFvRKNS_6StatusERKNS_8HostPortEEEC2INS_8internal15RunnableAdapterIPFvPNS_12SynchronizerES3_S6_EEESE_FvSD_EEEPNSA_9BindStateIT_T0_T1_EE
Line
Count
Source
473
395k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
395k
    PolymorphicInvoke invoke_func =
479
395k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
395k
            ::InvokerType::Run;
481
395k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
395k
  }
_ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2INS_8internal15RunnableAdapterIMNS_6master25SystemTableFaultToleranceEFvNS0_IFvS3_EEES3_SA_EEEFvPSH_SJ_S3_SA_EFvNSE_17UnretainedWrapperINSG_49SystemTableFaultTolerance_TestFaultTolerance_TestEEESJ_EEEPNSE_9BindStateIT_T0_T1_EE
Line
Count
Source
473
1
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
1
    PolymorphicInvoke invoke_func =
479
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
1
            ::InvokerType::Run;
481
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
1
  }
Unexecuted instantiation: _ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2INS_8internal15RunnableAdapterIMNS6_15TestQLStatementEFvNS0_IFvS3_EEES3_SA_EEEFvPSG_SI_S3_SA_EFvNSE_17UnretainedWrapperISG_EESI_EEEPNSE_9BindStateIT_T0_T1_EE
_ZN2yb8CallbackIFvRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_6StatusEEEC2INS_8internal15RunnableAdapterIMNS_19FailureDetectorTestEFvS9_SC_EEEFvPSI_S9_SC_EFvNSG_17UnretainedWrapperINS_43FailureDetectorTest_TestDetectsFailure_TestEEEEEEPNSG_9BindStateIT_T0_T1_EE
Line
Count
Source
473
1
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
1
    PolymorphicInvoke invoke_func =
479
1
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
1
            ::InvokerType::Run;
481
1
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
1
  }
_ZN2yb8CallbackIFvRKNS_6StatusERKNS_8HostPortEEEC2INS_8internal15RunnableAdapterIPFvPS4_PNS_12SynchronizerES3_S6_EEESF_FvSC_SE_EEEPNSA_9BindStateIT_T0_T1_EE
Line
Count
Source
473
2.28k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
2.28k
    PolymorphicInvoke invoke_func =
479
2.28k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
2.28k
            ::InvokerType::Run;
481
2.28k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
2.28k
  }
_ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2INS_8internal15RunnableAdapterIMNS6_11QLProcessorEFvRKNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERKNS6_19StatementParametersEPKNS6_9ParseTreeESC_S3_SA_EEEFvPSG_SO_SR_SU_SC_S3_SA_EFvNSE_17UnretainedWrapperISG_EENSE_15ConstRefWrapperISM_EENS12_ISP_EENSE_12OwnedWrapperIST_EESC_EEEPNSE_9BindStateIT_T0_T1_EE
Line
Count
Source
473
331k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
331k
    PolymorphicInvoke invoke_func =
479
331k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
331k
            ::InvokerType::Run;
481
331k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
331k
  }
Unexecuted instantiation: _ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2INS_8internal15RunnableAdapterIMNS6_15TestQLProcessorEFvNS0_IFvS3_EEES3_SA_EEEFvPSG_SI_S3_SA_EFvNSE_17UnretainedWrapperISG_EESI_EEEPNSE_9BindStateIT_T0_T1_EE
Unexecuted instantiation: _ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2INS_8internal15RunnableAdapterIMNS6_11QLProcessorEFvRKNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERKNS6_19StatementParametersEPKNS6_9ParseTreeESC_S3_SA_EEEFvPSG_SO_SR_SU_SC_S3_SA_EFvNSE_17UnretainedWrapperISG_EENSE_15ConstRefWrapperISM_EENS12_ISP_EENS10_ISS_EESC_EEEPNSE_9BindStateIT_T0_T1_EE
heartbeater.cc:_ZN2yb8CallbackIFvRKNS_6StatusERKNS_8HostPortEEEC2INS_8internal15RunnableAdapterIPFvRKNSt3__110shared_ptrINS_7tserver12_GLOBAL__N_120FindLeaderMasterDataEEES3_S6_EEESK_FvSH_EEEPNSA_9BindStateIT_T0_T1_EE
Line
Count
Source
473
5.72k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
5.72k
    PolymorphicInvoke invoke_func =
479
5.72k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
5.72k
            ::InvokerType::Run;
481
5.72k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
5.72k
  }
_ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2INS_8internal15RunnableAdapterIMNS_9cqlserver12CQLProcessorEFvS3_SA_EEEFvPSH_S3_SA_EFvNSE_17UnretainedWrapperISH_EEEEEPNSE_9BindStateIT_T0_T1_EE
Line
Count
Source
473
17.0k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
17.0k
    PolymorphicInvoke invoke_func =
479
17.0k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
17.0k
            ::InvokerType::Run;
481
17.0k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
17.0k
  }
_ZN2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEC2INS_8internal15RunnableAdapterIPFvPNS_12SynchronizerEPS8_S3_SA_EEESJ_FvSH_SI_EEEPNSE_9BindStateIT_T0_T1_EE
Line
Count
Source
473
181k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
181k
    PolymorphicInvoke invoke_func =
479
181k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
181k
            ::InvokerType::Run;
481
181k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
181k
  }
_ZN2yb8CallbackIFvRKNS_6StatusERKNS_8HostPortEEEC2INS_8internal15RunnableAdapterIMNS_6client8YBClient4DataEFvS3_S6_EEEFvPSE_S3_S6_EFvNSA_17UnretainedWrapperISE_EEEEEPNSA_9BindStateIT_T0_T1_EE
Line
Count
Source
473
28.9k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
28.9k
    PolymorphicInvoke invoke_func =
479
28.9k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
28.9k
            ::InvokerType::Run;
481
28.9k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
28.9k
  }
_ZN2yb8CallbackIFvRK13scoped_refptrINS_16RefCountedStringEEbEEC2INS_8internal15RunnableAdapterIMNS_5debug17TraceResultBufferEFvS5_bEEEFvPSC_S5_bEFvNS9_17UnretainedWrapperISC_EEEEEPNS9_9BindStateIT_T0_T1_EE
Line
Count
Source
473
23
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
23
    PolymorphicInvoke invoke_func =
479
23
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
23
            ::InvokerType::Run;
481
23
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
23
  }
_ZN2yb8CallbackIFvRKNS_6StatusEyEEC2INS_8internal15RunnableAdapterIPFvRK13scoped_refptrINS_5tools22ChecksumResultReporterEERKNSt3__110shared_ptrINSA_16YsckTabletServerEEERKNSG_INS_13BlockingQueueINSF_4pairINS_6SchemaENSF_12basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEEENS_18DefaultLogicalSizeEEEEERKST_RKNSA_15ChecksumOptionsES3_yEEES15_FvSC_SI_SX_ST_S12_EEEPNS7_9BindStateIT_T0_T1_EE
Line
Count
Source
473
4.19k
      : CallbackBase(bind_state) {
474
475
    // Force the assignment to a local variable of PolymorphicInvoke
476
    // so the compiler will typecheck that the passed in Run() method has
477
    // the correct type.
478
4.19k
    PolymorphicInvoke invoke_func =
479
4.19k
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
480
4.19k
            ::InvokerType::Run;
481
4.19k
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
482
4.19k
  }
483
484
  bool Equals(const Callback& other) const {
485
    return CallbackBase::Equals(other);
486
  }
487
488
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
489
5.48M
        typename internal::CallbackParamTraits<A2>::ForwardType a2) const {
490
5.48M
    PolymorphicInvoke f =
491
5.48M
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
492
493
5.48M
    return f(bind_state_.get(), internal::CallbackForward(a1),
494
5.48M
             internal::CallbackForward(a2));
495
5.48M
  }
_ZNK2yb8CallbackIFvRKNS_6StatusEyEE3RunES3_RKy
Line
Count
Source
489
4.19k
        typename internal::CallbackParamTraits<A2>::ForwardType a2) const {
490
4.19k
    PolymorphicInvoke f =
491
4.19k
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
492
493
4.19k
    return f(bind_state_.get(), internal::CallbackForward(a1),
494
4.19k
             internal::CallbackForward(a2));
495
4.19k
  }
_ZNK2yb8CallbackIFvRKNS_6StatusERKNS_8HostPortEEE3RunES3_S6_
Line
Count
Source
489
430k
        typename internal::CallbackParamTraits<A2>::ForwardType a2) const {
490
430k
    PolymorphicInvoke f =
491
430k
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
492
493
430k
    return f(bind_state_.get(), internal::CallbackForward(a1),
494
430k
             internal::CallbackForward(a2));
495
430k
  }
_ZNK2yb8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEE3RunES3_SA_
Line
Count
Source
489
5.04M
        typename internal::CallbackParamTraits<A2>::ForwardType a2) const {
490
5.04M
    PolymorphicInvoke f =
491
5.04M
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
492
493
5.04M
    return f(bind_state_.get(), internal::CallbackForward(a1),
494
5.04M
             internal::CallbackForward(a2));
495
5.04M
  }
_ZNK2yb8CallbackIFvRK13scoped_refptrINS_16RefCountedStringEEbEE3RunES5_RKb
Line
Count
Source
489
348
        typename internal::CallbackParamTraits<A2>::ForwardType a2) const {
490
348
    PolymorphicInvoke f =
491
348
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
492
493
348
    return f(bind_state_.get(), internal::CallbackForward(a1),
494
348
             internal::CallbackForward(a2));
495
348
  }
_ZNK2yb8CallbackIFvRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_6StatusEEE3RunES9_SC_
Line
Count
Source
489
1
        typename internal::CallbackParamTraits<A2>::ForwardType a2) const {
490
1
    PolymorphicInvoke f =
491
1
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
492
493
1
    return f(bind_state_.get(), internal::CallbackForward(a1),
494
1
             internal::CallbackForward(a2));
495
1
  }
496
497
 private:
498
  typedef R(*PolymorphicInvoke)(
499
      internal::BindStateBase*,
500
          typename internal::CallbackParamTraits<A1>::ForwardType,
501
          typename internal::CallbackParamTraits<A2>::ForwardType);
502
503
};
504
505
template <typename R, typename A1, typename A2, typename A3>
506
class Callback<R(A1, A2, A3)> : public internal::CallbackBase {
507
 public:
508
  typedef R(RunType)(A1, A2, A3);
509
510
  Callback() : CallbackBase(NULL) { }
511
512
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
513
  // return the exact Callback<> type.  See base/bind.h for details.
514
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
515
  Callback(internal::BindState<Runnable, BindRunType,
516
           BoundArgsType>* bind_state)
517
      : CallbackBase(bind_state) {
518
519
    // Force the assignment to a local variable of PolymorphicInvoke
520
    // so the compiler will typecheck that the passed in Run() method has
521
    // the correct type.
522
    PolymorphicInvoke invoke_func =
523
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
524
            ::InvokerType::Run;
525
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
526
  }
527
528
  bool Equals(const Callback& other) const {
529
    return CallbackBase::Equals(other);
530
  }
531
532
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
533
        typename internal::CallbackParamTraits<A2>::ForwardType a2,
534
        typename internal::CallbackParamTraits<A3>::ForwardType a3) const {
535
    PolymorphicInvoke f =
536
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
537
538
    return f(bind_state_.get(), internal::CallbackForward(a1),
539
             internal::CallbackForward(a2),
540
             internal::CallbackForward(a3));
541
  }
542
543
 private:
544
  typedef R(*PolymorphicInvoke)(
545
      internal::BindStateBase*,
546
          typename internal::CallbackParamTraits<A1>::ForwardType,
547
          typename internal::CallbackParamTraits<A2>::ForwardType,
548
          typename internal::CallbackParamTraits<A3>::ForwardType);
549
550
};
551
552
template <typename R, typename A1, typename A2, typename A3, typename A4>
553
class Callback<R(A1, A2, A3, A4)> : public internal::CallbackBase {
554
 public:
555
  typedef R(RunType)(A1, A2, A3, A4);
556
557
  Callback() : CallbackBase(NULL) { }
558
559
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
560
  // return the exact Callback<> type.  See base/bind.h for details.
561
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
562
  Callback(internal::BindState<Runnable, BindRunType,
563
           BoundArgsType>* bind_state)
564
      : CallbackBase(bind_state) {
565
566
    // Force the assignment to a local variable of PolymorphicInvoke
567
    // so the compiler will typecheck that the passed in Run() method has
568
    // the correct type.
569
    PolymorphicInvoke invoke_func =
570
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
571
            ::InvokerType::Run;
572
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
573
  }
574
575
  bool Equals(const Callback& other) const {
576
    return CallbackBase::Equals(other);
577
  }
578
579
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
580
        typename internal::CallbackParamTraits<A2>::ForwardType a2,
581
        typename internal::CallbackParamTraits<A3>::ForwardType a3,
582
        typename internal::CallbackParamTraits<A4>::ForwardType a4) const {
583
    PolymorphicInvoke f =
584
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
585
586
    return f(bind_state_.get(), internal::CallbackForward(a1),
587
             internal::CallbackForward(a2),
588
             internal::CallbackForward(a3),
589
             internal::CallbackForward(a4));
590
  }
591
592
 private:
593
  typedef R(*PolymorphicInvoke)(
594
      internal::BindStateBase*,
595
          typename internal::CallbackParamTraits<A1>::ForwardType,
596
          typename internal::CallbackParamTraits<A2>::ForwardType,
597
          typename internal::CallbackParamTraits<A3>::ForwardType,
598
          typename internal::CallbackParamTraits<A4>::ForwardType);
599
600
};
601
602
template <typename R, typename A1, typename A2, typename A3, typename A4,
603
    typename A5>
604
class Callback<R(A1, A2, A3, A4, A5)> : public internal::CallbackBase {
605
 public:
606
  typedef R(RunType)(A1, A2, A3, A4, A5);
607
608
  Callback() : CallbackBase(NULL) { }
609
610
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
611
  // return the exact Callback<> type.  See base/bind.h for details.
612
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
613
  Callback(internal::BindState<Runnable, BindRunType,
614
           BoundArgsType>* bind_state)
615
      : CallbackBase(bind_state) {
616
617
    // Force the assignment to a local variable of PolymorphicInvoke
618
    // so the compiler will typecheck that the passed in Run() method has
619
    // the correct type.
620
    PolymorphicInvoke invoke_func =
621
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
622
            ::InvokerType::Run;
623
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
624
  }
625
626
  bool Equals(const Callback& other) const {
627
    return CallbackBase::Equals(other);
628
  }
629
630
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
631
        typename internal::CallbackParamTraits<A2>::ForwardType a2,
632
        typename internal::CallbackParamTraits<A3>::ForwardType a3,
633
        typename internal::CallbackParamTraits<A4>::ForwardType a4,
634
        typename internal::CallbackParamTraits<A5>::ForwardType a5) const {
635
    PolymorphicInvoke f =
636
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
637
638
    return f(bind_state_.get(), internal::CallbackForward(a1),
639
             internal::CallbackForward(a2),
640
             internal::CallbackForward(a3),
641
             internal::CallbackForward(a4),
642
             internal::CallbackForward(a5));
643
  }
644
645
 private:
646
  typedef R(*PolymorphicInvoke)(
647
      internal::BindStateBase*,
648
          typename internal::CallbackParamTraits<A1>::ForwardType,
649
          typename internal::CallbackParamTraits<A2>::ForwardType,
650
          typename internal::CallbackParamTraits<A3>::ForwardType,
651
          typename internal::CallbackParamTraits<A4>::ForwardType,
652
          typename internal::CallbackParamTraits<A5>::ForwardType);
653
654
};
655
656
template <typename R, typename A1, typename A2, typename A3, typename A4,
657
    typename A5, typename A6>
658
class Callback<R(A1, A2, A3, A4, A5, A6)> : public internal::CallbackBase {
659
 public:
660
  typedef R(RunType)(A1, A2, A3, A4, A5, A6);
661
662
  Callback() : CallbackBase(NULL) { }
663
664
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
665
  // return the exact Callback<> type.  See base/bind.h for details.
666
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
667
  Callback(internal::BindState<Runnable, BindRunType,
668
           BoundArgsType>* bind_state)
669
0
      : CallbackBase(bind_state) {
670
671
    // Force the assignment to a local variable of PolymorphicInvoke
672
    // so the compiler will typecheck that the passed in Run() method has
673
    // the correct type.
674
0
    PolymorphicInvoke invoke_func =
675
0
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
676
0
            ::InvokerType::Run;
677
0
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
678
0
  }
679
680
  bool Equals(const Callback& other) const {
681
    return CallbackBase::Equals(other);
682
  }
683
684
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
685
        typename internal::CallbackParamTraits<A2>::ForwardType a2,
686
        typename internal::CallbackParamTraits<A3>::ForwardType a3,
687
        typename internal::CallbackParamTraits<A4>::ForwardType a4,
688
        typename internal::CallbackParamTraits<A5>::ForwardType a5,
689
0
        typename internal::CallbackParamTraits<A6>::ForwardType a6) const {
690
0
    PolymorphicInvoke f =
691
0
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
692
693
0
    return f(bind_state_.get(), internal::CallbackForward(a1),
694
0
             internal::CallbackForward(a2),
695
0
             internal::CallbackForward(a3),
696
0
             internal::CallbackForward(a4),
697
0
             internal::CallbackForward(a5),
698
0
             internal::CallbackForward(a6));
699
0
  }
700
701
 private:
702
  typedef R(*PolymorphicInvoke)(
703
      internal::BindStateBase*,
704
          typename internal::CallbackParamTraits<A1>::ForwardType,
705
          typename internal::CallbackParamTraits<A2>::ForwardType,
706
          typename internal::CallbackParamTraits<A3>::ForwardType,
707
          typename internal::CallbackParamTraits<A4>::ForwardType,
708
          typename internal::CallbackParamTraits<A5>::ForwardType,
709
          typename internal::CallbackParamTraits<A6>::ForwardType);
710
711
};
712
713
template <typename R, typename A1, typename A2, typename A3, typename A4,
714
    typename A5, typename A6, typename A7>
715
class Callback<R(A1, A2, A3, A4, A5, A6, A7)> : public internal::CallbackBase {
716
 public:
717
  typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7);
718
719
  Callback() : CallbackBase(NULL) { }
720
721
  // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
722
  // return the exact Callback<> type.  See base/bind.h for details.
723
  template <typename Runnable, typename BindRunType, typename BoundArgsType>
724
  Callback(internal::BindState<Runnable, BindRunType,
725
           BoundArgsType>* bind_state)
726
      : CallbackBase(bind_state) {
727
728
    // Force the assignment to a local variable of PolymorphicInvoke
729
    // so the compiler will typecheck that the passed in Run() method has
730
    // the correct type.
731
    PolymorphicInvoke invoke_func =
732
        &internal::BindState<Runnable, BindRunType, BoundArgsType>
733
            ::InvokerType::Run;
734
    polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
735
  }
736
737
  bool Equals(const Callback& other) const {
738
    return CallbackBase::Equals(other);
739
  }
740
741
  R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
742
        typename internal::CallbackParamTraits<A2>::ForwardType a2,
743
        typename internal::CallbackParamTraits<A3>::ForwardType a3,
744
        typename internal::CallbackParamTraits<A4>::ForwardType a4,
745
        typename internal::CallbackParamTraits<A5>::ForwardType a5,
746
        typename internal::CallbackParamTraits<A6>::ForwardType a6,
747
        typename internal::CallbackParamTraits<A7>::ForwardType a7) const {
748
    PolymorphicInvoke f =
749
        reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
750
751
    return f(bind_state_.get(), internal::CallbackForward(a1),
752
             internal::CallbackForward(a2),
753
             internal::CallbackForward(a3),
754
             internal::CallbackForward(a4),
755
             internal::CallbackForward(a5),
756
             internal::CallbackForward(a6),
757
             internal::CallbackForward(a7));
758
  }
759
760
 private:
761
  typedef R(*PolymorphicInvoke)(
762
      internal::BindStateBase*,
763
          typename internal::CallbackParamTraits<A1>::ForwardType,
764
          typename internal::CallbackParamTraits<A2>::ForwardType,
765
          typename internal::CallbackParamTraits<A3>::ForwardType,
766
          typename internal::CallbackParamTraits<A4>::ForwardType,
767
          typename internal::CallbackParamTraits<A5>::ForwardType,
768
          typename internal::CallbackParamTraits<A6>::ForwardType,
769
          typename internal::CallbackParamTraits<A7>::ForwardType);
770
771
};
772
773
774
// Syntactic sugar to make Callbacks<void(void)> easier to declare since it
775
// will be used in a lot of APIs with delayed execution.
776
typedef Callback<void(void)> Closure;
777
778
}  // namespace yb
779
780
#endif // YB_GUTIL_CALLBACK_H