/Users/deen/code/yugabyte-db/src/yb/gutil/bind_helpers.h
Line | Count | Source |
1 | | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 | | // Use of this source code is governed by a BSD-style license that can be |
3 | | // found in the LICENSE file. |
4 | | // |
5 | | // The following only applies to changes made to this file as part of YugaByte development. |
6 | | // |
7 | | // Portions Copyright (c) YugaByte, Inc. |
8 | | // |
9 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
10 | | // in compliance with the License. You may obtain a copy of the License at |
11 | | // |
12 | | // http://www.apache.org/licenses/LICENSE-2.0 |
13 | | // |
14 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
15 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
16 | | // or implied. See the License for the specific language governing permissions and limitations |
17 | | // under the License. |
18 | | // |
19 | | |
20 | | // This defines a set of argument wrappers and related factory methods that |
21 | | // can be used specify the refcounting and reference semantics of arguments |
22 | | // that are bound by the Bind() function in yb/gutil/bind.h. |
23 | | // |
24 | | // It also defines a set of simple functions and utilities that people want |
25 | | // when using Callback<> and Bind(). |
26 | | // |
27 | | // |
28 | | // ARGUMENT BINDING WRAPPERS |
29 | | // |
30 | | // The wrapper functions are yb::Unretained(), yb::Owned(), yb::Passed(), |
31 | | // yb::ConstRef(), and yb::IgnoreResult(). |
32 | | // |
33 | | // Unretained() allows Bind() to bind a non-refcounted class, and to disable |
34 | | // refcounting on arguments that are refcounted objects. |
35 | | // |
36 | | // Owned() transfers ownership of an object to the Callback resulting from |
37 | | // bind; the object will be deleted when the Callback is deleted. |
38 | | // |
39 | | // Passed() is for transferring movable-but-not-copyable types (eg. scoped_ptr) |
40 | | // through a Callback. Logically, this signifies a destructive transfer of |
41 | | // the state of the argument into the target function. Invoking |
42 | | // Callback::Run() twice on a Callback that was created with a Passed() |
43 | | // argument will CHECK() because the first invocation would have already |
44 | | // transferred ownership to the target function. |
45 | | // |
46 | | // ConstRef() allows binding a constant reference to an argument rather |
47 | | // than a copy. |
48 | | // |
49 | | // IgnoreResult() is used to adapt a function or Callback with a return type to |
50 | | // one with a void return. This is most useful if you have a function with, |
51 | | // say, a pesky ignorable bool return that you want to use with PostTask or |
52 | | // something else that expect a Callback with a void return. |
53 | | // |
54 | | // EXAMPLE OF Unretained(): |
55 | | // |
56 | | // class Foo { |
57 | | // public: |
58 | | // void func() { cout << "Foo:f" << endl; } |
59 | | // }; |
60 | | // |
61 | | // // In some function somewhere. |
62 | | // Foo foo; |
63 | | // Closure foo_callback = |
64 | | // Bind(&Foo::func, Unretained(&foo)); |
65 | | // foo_callback.Run(); // Prints "Foo:f". |
66 | | // |
67 | | // Without the Unretained() wrapper on |&foo|, the above call would fail |
68 | | // to compile because Foo does not support the AddRef() and Release() methods. |
69 | | // |
70 | | // |
71 | | // EXAMPLE OF Owned(): |
72 | | // |
73 | | // void foo(int* arg) { cout << *arg << endl } |
74 | | // |
75 | | // int* pn = new int(1); |
76 | | // Closure foo_callback = Bind(&foo, Owned(pn)); |
77 | | // |
78 | | // foo_callback.Run(); // Prints "1" |
79 | | // foo_callback.Run(); // Prints "1" |
80 | | // *n = 2; |
81 | | // foo_callback.Run(); // Prints "2" |
82 | | // |
83 | | // foo_callback.Reset(); // |pn| is deleted. Also will happen when |
84 | | // // |foo_callback| goes out of scope. |
85 | | // |
86 | | // Without Owned(), someone would have to know to delete |pn| when the last |
87 | | // reference to the Callback is deleted. |
88 | | // |
89 | | // |
90 | | // EXAMPLE OF ConstRef(): |
91 | | // |
92 | | // void foo(int arg) { cout << arg << endl } |
93 | | // |
94 | | // int n = 1; |
95 | | // Closure no_ref = Bind(&foo, n); |
96 | | // Closure has_ref = Bind(&foo, ConstRef(n)); |
97 | | // |
98 | | // no_ref.Run(); // Prints "1" |
99 | | // has_ref.Run(); // Prints "1" |
100 | | // |
101 | | // n = 2; |
102 | | // no_ref.Run(); // Prints "1" |
103 | | // has_ref.Run(); // Prints "2" |
104 | | // |
105 | | // Note that because ConstRef() takes a reference on |n|, |n| must outlive all |
106 | | // its bound callbacks. |
107 | | // |
108 | | // |
109 | | // EXAMPLE OF IgnoreResult(): |
110 | | // |
111 | | // int DoSomething(int arg) { cout << arg << endl; } |
112 | | // |
113 | | // // Assign to a Callback with a void return type. |
114 | | // Callback<void(int)> cb = Bind(IgnoreResult(&DoSomething)); |
115 | | // cb->Run(1); // Prints "1". |
116 | | // |
117 | | // // Prints "1" on |ml|. |
118 | | // ml->PostTask(FROM_HERE, Bind(IgnoreResult(&DoSomething), 1); |
119 | | // |
120 | | // |
121 | | // EXAMPLE OF Passed(): |
122 | | // |
123 | | // void TakesOwnership(scoped_ptr<Foo> arg) { } |
124 | | // scoped_ptr<Foo> CreateFoo() { return scoped_ptr<Foo>(new Foo()); } |
125 | | // |
126 | | // scoped_ptr<Foo> f(new Foo()); |
127 | | // |
128 | | // // |cb| is given ownership of Foo(). |f| is now NULL. |
129 | | // // You can use f.Pass() in place of &f, but it's more verbose. |
130 | | // Closure cb = Bind(&TakesOwnership, Passed(&f)); |
131 | | // |
132 | | // // Run was never called so |cb| still owns Foo() and deletes |
133 | | // // it on Reset(). |
134 | | // cb.Reset(); |
135 | | // |
136 | | // // |cb| is given a new Foo created by CreateFoo(). |
137 | | // cb = Bind(&TakesOwnership, Passed(CreateFoo())); |
138 | | // |
139 | | // // |arg| in TakesOwnership() is given ownership of Foo(). |cb| |
140 | | // // no longer owns Foo() and, if reset, would not delete Foo(). |
141 | | // cb.Run(); // Foo() is now transferred to |arg| and deleted. |
142 | | // cb.Run(); // This CHECK()s since Foo() already been used once. |
143 | | // |
144 | | // Passed() is particularly useful with PostTask() when you are transferring |
145 | | // ownership of an argument into a task, but don't necessarily know if the |
146 | | // task will always be executed. This can happen if the task is cancellable |
147 | | // or if it is posted to a MessageLoopProxy. |
148 | | // |
149 | | // |
150 | | // SIMPLE FUNCTIONS AND UTILITIES. |
151 | | // |
152 | | // DoNothing() - Useful for creating a Closure that does nothing when called. |
153 | | // DeletePointer<T>() - Useful for creating a Closure that will delete a |
154 | | // pointer when invoked. Only use this when necessary. |
155 | | // In most cases MessageLoop::DeleteSoon() is a better |
156 | | // fit. |
157 | | |
158 | | #ifndef YB_GUTIL_BIND_HELPERS_H_ |
159 | | #define YB_GUTIL_BIND_HELPERS_H_ |
160 | | |
161 | | #include <assert.h> |
162 | | |
163 | | #include "yb/gutil/callback.h" |
164 | | #include "yb/gutil/integral_types.h" |
165 | | #include "yb/gutil/macros.h" |
166 | | #include "yb/gutil/template_util.h" |
167 | | |
168 | | // Unneeded define from Chromium |
169 | | #define BASE_EXPORT |
170 | | |
171 | | |
172 | | namespace yb { |
173 | | namespace internal { |
174 | | |
175 | | // Use the Substitution Failure Is Not An Error (SFINAE) trick to inspect T |
176 | | // for the existence of AddRef() and Release() functions of the correct |
177 | | // signature. |
178 | | // |
179 | | // http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error |
180 | | // http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence |
181 | | // http://stackoverflow.com/questions/4358584/sfinae-approach-comparison |
182 | | // http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions |
183 | | // |
184 | | // The last link in particular show the method used below. |
185 | | // |
186 | | // For SFINAE to work with inherited methods, we need to pull some extra tricks |
187 | | // with multiple inheritance. In the more standard formulation, the overloads |
188 | | // of Check would be: |
189 | | // |
190 | | // template <typename C> |
191 | | // Yes NotTheCheckWeWant(Helper<&C::TargetFunc>*); |
192 | | // |
193 | | // template <typename C> |
194 | | // No NotTheCheckWeWant(...); |
195 | | // |
196 | | // static const bool value = sizeof(NotTheCheckWeWant<T>(0)) == sizeof(Yes); |
197 | | // |
198 | | // The problem here is that template resolution will not match |
199 | | // C::TargetFunc if TargetFunc does not exist directly in C. That is, if |
200 | | // TargetFunc in inherited from an ancestor, &C::TargetFunc will not match, |
201 | | // |value| will be false. This formulation only checks for whether or |
202 | | // not TargetFunc exist directly in the class being introspected. |
203 | | // |
204 | | // To get around this, we play a dirty trick with multiple inheritance. |
205 | | // First, We create a class BaseMixin that declares each function that we |
206 | | // want to probe for. Then we create a class Base that inherits from both T |
207 | | // (the class we wish to probe) and BaseMixin. Note that the function |
208 | | // signature in BaseMixin does not need to match the signature of the function |
209 | | // we are probing for; thus it's easiest to just use void(void). |
210 | | // |
211 | | // Now, if TargetFunc exists somewhere in T, then &Base::TargetFunc has an |
212 | | // ambiguous resolution between BaseMixin and T. This lets us write the |
213 | | // following: |
214 | | // |
215 | | // template <typename C> |
216 | | // No GoodCheck(Helper<&C::TargetFunc>*); |
217 | | // |
218 | | // template <typename C> |
219 | | // Yes GoodCheck(...); |
220 | | // |
221 | | // static const bool value = sizeof(GoodCheck<Base>(0)) == sizeof(Yes); |
222 | | // |
223 | | // Notice here that the variadic version of GoodCheck() returns Yes here |
224 | | // instead of No like the previous one. Also notice that we calculate |value| |
225 | | // by specializing GoodCheck() on Base instead of T. |
226 | | // |
227 | | // We've reversed the roles of the variadic, and Helper overloads. |
228 | | // GoodCheck(Helper<&C::TargetFunc>*), when C = Base, fails to be a valid |
229 | | // substitution if T::TargetFunc exists. Thus GoodCheck<Base>(0) will resolve |
230 | | // to the variadic version if T has TargetFunc. If T::TargetFunc does not |
231 | | // exist, then &C::TargetFunc is not ambiguous, and the overload resolution |
232 | | // will prefer GoodCheck(Helper<&C::TargetFunc>*). |
233 | | // |
234 | | // This method of SFINAE will correctly probe for inherited names, but it cannot |
235 | | // typecheck those names. It's still a good enough sanity check though. |
236 | | // |
237 | | // Works on gcc-4.2, gcc-4.4, and Visual Studio 2008. |
238 | | // |
239 | | // TODO(ajwong): Move to ref_counted.h or template_util.h when we've vetted |
240 | | // this works well. |
241 | | // |
242 | | // TODO(ajwong): Make this check for Release() as well. |
243 | | // See http://crbug.com/82038. |
244 | | template <typename T> |
245 | | class SupportsAddRefAndRelease { |
246 | | typedef char Yes[1]; |
247 | | typedef char No[2]; |
248 | | |
249 | | struct BaseMixin { |
250 | | void AddRef(); |
251 | | }; |
252 | | |
253 | | // MSVC warns when you try to use Base if T has a private destructor, the |
254 | | // common pattern for refcounted types. It does this even though no attempt to |
255 | | // instantiate Base is made. We disable the warning for this definition. |
256 | | #if defined(OS_WIN) |
257 | | #pragma warning(push) |
258 | | #pragma warning(disable:4624) |
259 | | #endif |
260 | | struct Base : public T, public BaseMixin { |
261 | | }; |
262 | | #if defined(OS_WIN) |
263 | | #pragma warning(pop) |
264 | | #endif |
265 | | |
266 | | template <void(BaseMixin::*)(void)> struct Helper {}; |
267 | | |
268 | | template <typename C> |
269 | | static No& Check(Helper<&C::AddRef>*); |
270 | | |
271 | | template <typename > |
272 | | static Yes& Check(...); |
273 | | |
274 | | public: |
275 | | static const bool value = sizeof(Check<Base>(0)) == sizeof(Yes); |
276 | | }; |
277 | | |
278 | | // Helpers to assert that arguments of a recounted type are bound with a |
279 | | // scoped_refptr. |
280 | | template <bool IsClasstype, typename T> |
281 | | struct UnsafeBindtoRefCountedArgHelper : base::false_type { |
282 | | }; |
283 | | |
284 | | template <typename T> |
285 | | struct UnsafeBindtoRefCountedArgHelper<true, T> |
286 | | : base::integral_constant<bool, SupportsAddRefAndRelease<T>::value> { |
287 | | }; |
288 | | |
289 | | template <typename T> |
290 | | struct UnsafeBindtoRefCountedArg : base::false_type { |
291 | | }; |
292 | | |
293 | | template <typename T> |
294 | | struct UnsafeBindtoRefCountedArg<T*> |
295 | | : UnsafeBindtoRefCountedArgHelper<base::is_class<T>::value, T> { |
296 | | }; |
297 | | |
298 | | template <typename T> |
299 | | class HasIsMethodTag { |
300 | | typedef char Yes[1]; |
301 | | typedef char No[2]; |
302 | | |
303 | | template <typename U> |
304 | | static Yes& Check(typename U::IsMethod*); |
305 | | |
306 | | template <typename U> |
307 | | static No& Check(...); |
308 | | |
309 | | public: |
310 | | static const bool value = sizeof(Check<T>(0)) == sizeof(Yes); |
311 | | }; |
312 | | |
313 | | template <typename T> |
314 | | class UnretainedWrapper { |
315 | | public: |
316 | 43.1M | explicit UnretainedWrapper(T* o) : ptr_(o) {} _ZN2yb8internal17UnretainedWrapperINS_6master49SystemTableFaultTolerance_TestFaultTolerance_TestEEC2EPS3_ Line | Count | Source | 316 | 1 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_12SynchronizerEEC2EPS2_ Line | Count | Source | 316 | 854k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
Unexecuted instantiation: _ZN2yb8internal17UnretainedWrapperINS_2ql15TestQLStatementEEC2EPS3_ _ZN2yb8internal17UnretainedWrapperINS_6tablet14TabletPeerTestEEC2EPS3_ Line | Count | Source | 316 | 4 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_43FailureDetectorTest_TestDetectsFailure_TestEEC2EPS2_ Line | Count | Source | 316 | 1 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperIiEC2EPi Line | Count | Source | 316 | 3 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperIKcEC2EPS2_ Line | Count | Source | 316 | 105k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_7PromiseIiEEEC2EPS3_ Line | Count | Source | 316 | 1 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_9consensus16PeerMessageQueueEEC2EPS3_ Line | Count | Source | 316 | 28.2M | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_9consensus8LogCacheEEC2EPS3_ Line | Count | Source | 316 | 13.1M | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_3log3LogEEC2EPS3_ Line | Count | Source | 316 | 96.9k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_6master14CatalogManagerEEC2EPS3_ Line | Count | Source | 316 | 7.46k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_6master6MasterEEC2EPS3_ Line | Count | Source | 316 | 5.42k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_6master15SysCatalogTableEEC2EPS3_ Line | Count | Source | 316 | 5.35k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
Unexecuted instantiation: _ZN2yb8internal17UnretainedWrapperINS_6master10enterprise14CatalogManagerEEC2EPS4_ _ZN2yb8internal17UnretainedWrapperINS_2ql11QLProcessorEEC2EPS3_ Line | Count | Source | 316 | 331k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
Unexecuted instantiation: _ZN2yb8internal17UnretainedWrapperINS_2ql15TestQLProcessorEEC2EPS3_ Unexecuted instantiation: _ZN2yb8internal17UnretainedWrapperINS_2ql9ParseTreeEEC2EPS3_ _ZN2yb8internal17UnretainedWrapperINS_6server11HybridClockEEC2EPS3_ Line | Count | Source | 316 | 51.3k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_6server12LogicalClockEEC2EPS3_ Line | Count | Source | 316 | 72 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_6tablet14AbstractTabletEEC2EPS3_ Line | Count | Source | 316 | 42.9k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_15RedisResponsePBEEC2EPS2_ Line | Count | Source | 316 | 42.9k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_7tserver15TSTabletManagerEEC2EPS3_ Line | Count | Source | 316 | 83.2k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_7tserver26RemoteBootstrapSessionTestEEC2EPS3_ Line | Count | Source | 316 | 4 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_9cqlserver12CQLProcessorEEC2EPS3_ Line | Count | Source | 316 | 16.9k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
Unexecuted instantiation: _ZN2yb8internal17UnretainedWrapperINS_6client17YBLoggingCallbackEEC2EPS3_ _ZN2yb8internal17UnretainedWrapperINS_6client8YBClient4DataEEC2EPS4_ Line | Count | Source | 316 | 28.8k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_5debug17TraceResultBufferEEC2EPS3_ Line | Count | Source | 316 | 23 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
_ZN2yb8internal17UnretainedWrapperINS_5debug8TraceLogEEC2EPS3_ Line | Count | Source | 316 | 8 | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
thread.cc:_ZN2yb8internal17UnretainedWrapperINS_12_GLOBAL__N_19ThreadMgrEEC2EPS3_ Line | Count | Source | 316 | 35.0k | explicit UnretainedWrapper(T* o) : ptr_(o) {} |
|
317 | 47.8M | T* get() const { return ptr_; } _ZNK2yb8internal17UnretainedWrapperINS_12SynchronizerEE3getEv Line | Count | Source | 317 | 853k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_6master49SystemTableFaultTolerance_TestFaultTolerance_TestEE3getEv Line | Count | Source | 317 | 1 | T* get() const { return ptr_; } |
Unexecuted instantiation: _ZNK2yb8internal17UnretainedWrapperINS_2ql15TestQLStatementEE3getEv _ZNK2yb8internal17UnretainedWrapperINS_6tablet14TabletPeerTestEE3getEv Line | Count | Source | 317 | 11 | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_43FailureDetectorTest_TestDetectsFailure_TestEE3getEv Line | Count | Source | 317 | 1 | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperIiE3getEv Line | Count | Source | 317 | 12 | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperIKcE3getEv Line | Count | Source | 317 | 91.0k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_7PromiseIiEEE3getEv Line | Count | Source | 317 | 1 | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_9consensus16PeerMessageQueueEE3getEv Line | Count | Source | 317 | 28.2M | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_9consensus8LogCacheEE3getEv Line | Count | Source | 317 | 13.1M | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_3log3LogEE3getEv Line | Count | Source | 317 | 97.0k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_6master14CatalogManagerEE3getEv Line | Count | Source | 317 | 4.02k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_6master6MasterEE3getEv Line | Count | Source | 317 | 5.42k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_6master15SysCatalogTableEE3getEv Line | Count | Source | 317 | 19.3k | T* get() const { return ptr_; } |
Unexecuted instantiation: _ZNK2yb8internal17UnretainedWrapperINS_6master10enterprise14CatalogManagerEE3getEv _ZNK2yb8internal17UnretainedWrapperINS_2ql11QLProcessorEE3getEv Line | Count | Source | 317 | 330k | T* get() const { return ptr_; } |
Unexecuted instantiation: _ZNK2yb8internal17UnretainedWrapperINS_2ql15TestQLProcessorEE3getEv Unexecuted instantiation: _ZNK2yb8internal17UnretainedWrapperINS_2ql9ParseTreeEE3getEv _ZNK2yb8internal17UnretainedWrapperINS_6server11HybridClockEE3getEv Line | Count | Source | 317 | 45.8k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_6server12LogicalClockEE3getEv Line | Count | Source | 317 | 28 | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_6tablet14AbstractTabletEE3getEv Line | Count | Source | 317 | 42.9k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_15RedisResponsePBEE3getEv Line | Count | Source | 317 | 42.9k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_7tserver15TSTabletManagerEE3getEv Line | Count | Source | 317 | 338k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_7tserver26RemoteBootstrapSessionTestEE3getEv Line | Count | Source | 317 | 12 | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_9cqlserver12CQLProcessorEE3getEv Line | Count | Source | 317 | 4.52M | T* get() const { return ptr_; } |
Unexecuted instantiation: _ZNK2yb8internal17UnretainedWrapperINS_6client17YBLoggingCallbackEE3getEv _ZNK2yb8internal17UnretainedWrapperINS_6client8YBClient4DataEE3getEv Line | Count | Source | 317 | 27.3k | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_5debug17TraceResultBufferEE3getEv Line | Count | Source | 317 | 348 | T* get() const { return ptr_; } |
_ZNK2yb8internal17UnretainedWrapperINS_5debug8TraceLogEE3getEv Line | Count | Source | 317 | 8 | T* get() const { return ptr_; } |
thread.cc:_ZNK2yb8internal17UnretainedWrapperINS_12_GLOBAL__N_19ThreadMgrEE3getEv Line | Count | Source | 317 | 30.3k | T* get() const { return ptr_; } |
|
318 | | private: |
319 | | T* ptr_; |
320 | | }; |
321 | | |
322 | | template <typename T> |
323 | | class ConstRefWrapper { |
324 | | public: |
325 | 661k | explicit ConstRefWrapper(const T& o) : ptr_(&o) {} _ZN2yb8internal15ConstRefWrapperINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEC2ERKS8_ Line | Count | Source | 325 | 330k | explicit ConstRefWrapper(const T& o) : ptr_(&o) {} |
_ZN2yb8internal15ConstRefWrapperINS_2ql19StatementParametersEEC2ERKS3_ Line | Count | Source | 325 | 330k | explicit ConstRefWrapper(const T& o) : ptr_(&o) {} |
|
326 | 660k | const T& get() const { return *ptr_; } _ZNK2yb8internal15ConstRefWrapperINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE3getEv Line | Count | Source | 326 | 329k | const T& get() const { return *ptr_; } |
_ZNK2yb8internal15ConstRefWrapperINS_2ql19StatementParametersEE3getEv Line | Count | Source | 326 | 330k | const T& get() const { return *ptr_; } |
|
327 | | private: |
328 | | const T* ptr_; |
329 | | }; |
330 | | |
331 | | template <typename T> |
332 | | struct IgnoreResultHelper { |
333 | | explicit IgnoreResultHelper(T functor) : functor_(functor) {} |
334 | | |
335 | | T functor_; |
336 | | }; |
337 | | |
338 | | template <typename T> |
339 | | struct IgnoreResultHelper<Callback<T> > { |
340 | | explicit IgnoreResultHelper(const Callback<T>& functor) : functor_(functor) {} |
341 | | |
342 | | const Callback<T>& functor_; |
343 | | }; |
344 | | |
345 | | // An alternate implementation is to avoid the destructive copy, and instead |
346 | | // specialize ParamTraits<> for OwnedWrapper<> to change the StorageType to |
347 | | // a class that is essentially a scoped_ptr<>. |
348 | | // |
349 | | // The current implementation has the benefit though of leaving ParamTraits<> |
350 | | // fully in callback_internal.h as well as avoiding type conversions during |
351 | | // storage. |
352 | | template <typename T> |
353 | | class OwnedWrapper { |
354 | | public: |
355 | 330k | explicit OwnedWrapper(T* o) : ptr_(o) {} |
356 | 991k | ~OwnedWrapper() { delete ptr_; } |
357 | 328k | T* get() const { return ptr_; } |
358 | 660k | OwnedWrapper(const OwnedWrapper& other) { |
359 | 660k | ptr_ = other.ptr_; |
360 | 660k | other.ptr_ = NULL; |
361 | 660k | } |
362 | | |
363 | | private: |
364 | | mutable T* ptr_; |
365 | | }; |
366 | | |
367 | | // PassedWrapper is a copyable adapter for a scoper that ignores const. |
368 | | // |
369 | | // It is needed to get around the fact that Bind() takes a const reference to |
370 | | // all its arguments. Because Bind() takes a const reference to avoid |
371 | | // unnecessary copies, it is incompatible with movable-but-not-copyable |
372 | | // types; doing a destructive "move" of the type into Bind() would violate |
373 | | // the const correctness. |
374 | | // |
375 | | // This conundrum cannot be solved without either C++11 rvalue references or |
376 | | // a O(2^n) blowup of Bind() templates to handle each combination of regular |
377 | | // types and movable-but-not-copyable types. Thus we introduce a wrapper type |
378 | | // that is copyable to transmit the correct type information down into |
379 | | // BindState<>. Ignoring const in this type makes sense because it is only |
380 | | // created when we are explicitly trying to do a destructive move. |
381 | | // |
382 | | // Two notes: |
383 | | // 1) PassedWrapper supports any type that has a "Pass()" function. |
384 | | // This is intentional. The whitelisting of which specific types we |
385 | | // support is maintained by CallbackParamTraits<>. |
386 | | // 2) is_valid_ is distinct from NULL because it is valid to bind a "NULL" |
387 | | // scoper to a Callback and allow the Callback to execute once. |
388 | | template <typename T> |
389 | | class PassedWrapper { |
390 | | public: |
391 | | explicit PassedWrapper(T scoper) : is_valid_(true), scoper_(scoper.Pass()) {} |
392 | | PassedWrapper(const PassedWrapper& other) |
393 | | : is_valid_(other.is_valid_), scoper_(other.scoper_.Pass()) { |
394 | | } |
395 | | T Pass() const { |
396 | | assert(is_valid_); |
397 | | is_valid_ = false; |
398 | | return scoper_.Pass(); |
399 | | } |
400 | | |
401 | | private: |
402 | | mutable bool is_valid_; |
403 | | mutable T scoper_; |
404 | | }; |
405 | | |
406 | | // Unwrap the stored parameters for the wrappers above. |
407 | | template <typename T> |
408 | | struct UnwrapTraits { |
409 | | typedef const T& ForwardType; |
410 | 56.2M | static ForwardType Unwrap(const T& o) { return o; } _ZN2yb8internal12UnwrapTraitsINSt3__110shared_ptrINS_9consensus12ReplicateMsgEEEE6UnwrapERKS6_ Line | Count | Source | 410 | 250 | static ForwardType Unwrap(const T& o) { return o; } |
mt-log-test.cc:_ZN2yb8internal12UnwrapTraitsIPNS_3log12_GLOBAL__N_119CustomLatchCallbackEE6UnwrapERKS5_ Line | Count | Source | 410 | 2.00k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIPNS_12SynchronizerEE6UnwrapERKS3_ Line | Count | Source | 410 | 579k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINS_8CallbackIFvRKNS_6StatusEEEEE6UnwrapERKS7_ Line | Count | Source | 410 | 13.1M | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE6UnwrapERKS8_ Line | Count | Source | 410 | 362k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIiE6UnwrapERKi Line | Count | Source | 410 | 3 | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIPNS_12RefCountableEE6UnwrapERKS3_ Line | Count | Source | 410 | 1 | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIxE6UnwrapERKx Line | Count | Source | 410 | 13.1M | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE6UnwrapERKS9_ Line | Count | Source | 410 | 2 | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIPiE6UnwrapERKS2_ Line | Count | Source | 410 | 1 | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINS_4OpIdEE6UnwrapERKS2_ Line | Count | Source | 410 | 13.1M | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINS_9consensus22MajorityReplicatedDataEE6UnwrapERKS3_ Line | Count | Source | 410 | 15.1M | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIPNS_8HostPortEE6UnwrapERKS3_ Line | Count | Source | 410 | 2.28k | static ForwardType Unwrap(const T& o) { return o; } |
Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINSt3__110shared_ptrINS2_6vectorINS_6client11YBTableInfoENS2_9allocatorIS6_EEEEEEE6UnwrapERKSA_ Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINSt3__113unordered_mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES9_NS2_4hashIS9_EENS2_8equal_toIS9_EENS7_INS2_4pairIKS9_S9_EEEEEEE6UnwrapERKSI_ Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINSt3__110shared_ptrINS_6client11YBTableInfoEEEE6UnwrapERKS6_ _ZN2yb8internal12UnwrapTraitsINS_8CallbackIFvRKNS_6StatusERKNSt3__110shared_ptrINS_2ql14ExecutedResultEEEEEEE6UnwrapERKSE_ Line | Count | Source | 410 | 331k | static ForwardType Unwrap(const T& o) { return o; } |
Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsIyE6UnwrapERKy heartbeater.cc:_ZN2yb8internal12UnwrapTraitsINSt3__110shared_ptrINS_7tserver12_GLOBAL__N_120FindLeaderMasterDataEEEE6UnwrapERKS7_ Line | Count | Source | 410 | 5.42k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINSt3__16chrono10time_pointINS_15CoarseMonoClockENS3_8durationIxNS2_5ratioILl1ELl1000000000EEEEEEEE6UnwrapERKSA_ Line | Count | Source | 410 | 42.9k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINS_14ReadHybridTimeEE6UnwrapERKS2_ Line | Count | Source | 410 | 42.9k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINS_18RedisReadRequestPBEE6UnwrapERKS2_ Line | Count | Source | 410 | 42.9k | static ForwardType Unwrap(const T& o) { return o; } |
read_query.cc:_ZN2yb8internal12UnwrapTraitsIZNS_7tserver12_GLOBAL__N_19ReadQuery10DoReadImplEvE3$_1E6UnwrapERKS5_ Line | Count | Source | 410 | 42.9k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsIPNSt3__110shared_ptrINS_2ql14ExecutedResultEEEE6UnwrapERKS7_ Line | Count | Source | 410 | 181k | static ForwardType Unwrap(const T& o) { return o; } |
Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINSt3__18weak_ptrINS_12SynchronizerEEEE6UnwrapERKS5_ _ZN2yb8internal12UnwrapTraitsINSt3__110shared_ptrINS_5tools16YsckTabletServerEEEE6UnwrapERKS6_ Line | Count | Source | 410 | 4.19k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINSt3__110shared_ptrINS_13BlockingQueueINS2_4pairINS_6SchemaENS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEENS_18DefaultLogicalSizeEEEEEE6UnwrapERKSG_ Line | Count | Source | 410 | 4.19k | static ForwardType Unwrap(const T& o) { return o; } |
_ZN2yb8internal12UnwrapTraitsINS_5tools15ChecksumOptionsEE6UnwrapERKS3_ Line | Count | Source | 410 | 4.19k | static ForwardType Unwrap(const T& o) { return o; } |
|
411 | | }; |
412 | | |
413 | | template <typename T> |
414 | | struct UnwrapTraits<UnretainedWrapper<T> > { |
415 | | typedef T* ForwardType; |
416 | 47.9M | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { |
417 | 47.9M | return unretained.get(); |
418 | 47.9M | } _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_12SynchronizerEEEE6UnwrapES4_ Line | Count | Source | 416 | 853k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 853k | return unretained.get(); | 418 | 853k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6master49SystemTableFaultTolerance_TestFaultTolerance_TestEEEE6UnwrapES5_ Line | Count | Source | 416 | 1 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 1 | return unretained.get(); | 418 | 1 | } |
Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_2ql15TestQLStatementEEEE6UnwrapES5_ _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6tablet14TabletPeerTestEEEE6UnwrapES5_ Line | Count | Source | 416 | 11 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 11 | return unretained.get(); | 418 | 11 | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_43FailureDetectorTest_TestDetectsFailure_TestEEEE6UnwrapES4_ Line | Count | Source | 416 | 1 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 1 | return unretained.get(); | 418 | 1 | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperIiEEE6UnwrapES3_ Line | Count | Source | 416 | 12 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 12 | return unretained.get(); | 418 | 12 | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperIKcEEE6UnwrapES4_ Line | Count | Source | 416 | 91.0k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 91.0k | return unretained.get(); | 418 | 91.0k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_7PromiseIiEEEEE6UnwrapES5_ Line | Count | Source | 416 | 1 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 1 | return unretained.get(); | 418 | 1 | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_9consensus16PeerMessageQueueEEEE6UnwrapES5_ Line | Count | Source | 416 | 28.2M | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 28.2M | return unretained.get(); | 418 | 28.2M | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_9consensus8LogCacheEEEE6UnwrapES5_ Line | Count | Source | 416 | 13.1M | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 13.1M | return unretained.get(); | 418 | 13.1M | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_3log3LogEEEE6UnwrapES5_ Line | Count | Source | 416 | 97.0k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 97.0k | return unretained.get(); | 418 | 97.0k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6master14CatalogManagerEEEE6UnwrapES5_ Line | Count | Source | 416 | 4.02k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 4.02k | return unretained.get(); | 418 | 4.02k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6master6MasterEEEE6UnwrapES5_ Line | Count | Source | 416 | 5.42k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 5.42k | return unretained.get(); | 418 | 5.42k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6master15SysCatalogTableEEEE6UnwrapES5_ Line | Count | Source | 416 | 19.3k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 19.3k | return unretained.get(); | 418 | 19.3k | } |
Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6master10enterprise14CatalogManagerEEEE6UnwrapES6_ _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_2ql11QLProcessorEEEE6UnwrapES5_ Line | Count | Source | 416 | 328k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 328k | return unretained.get(); | 418 | 328k | } |
Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_2ql15TestQLProcessorEEEE6UnwrapES5_ Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_2ql9ParseTreeEEEE6UnwrapES5_ _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6server11HybridClockEEEE6UnwrapES5_ Line | Count | Source | 416 | 45.8k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 45.8k | return unretained.get(); | 418 | 45.8k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6server12LogicalClockEEEE6UnwrapES5_ Line | Count | Source | 416 | 28 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 28 | return unretained.get(); | 418 | 28 | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6tablet14AbstractTabletEEEE6UnwrapES5_ Line | Count | Source | 416 | 42.9k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 42.9k | return unretained.get(); | 418 | 42.9k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_15RedisResponsePBEEEE6UnwrapES4_ Line | Count | Source | 416 | 42.9k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 42.9k | return unretained.get(); | 418 | 42.9k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_7tserver15TSTabletManagerEEEE6UnwrapES5_ Line | Count | Source | 416 | 338k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 338k | return unretained.get(); | 418 | 338k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_7tserver26RemoteBootstrapSessionTestEEEE6UnwrapES5_ Line | Count | Source | 416 | 12 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 12 | return unretained.get(); | 418 | 12 | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_9cqlserver12CQLProcessorEEEE6UnwrapES5_ Line | Count | Source | 416 | 4.53M | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 4.53M | return unretained.get(); | 418 | 4.53M | } |
Unexecuted instantiation: _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6client17YBLoggingCallbackEEEE6UnwrapES5_ _ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_6client8YBClient4DataEEEE6UnwrapES6_ Line | Count | Source | 416 | 27.3k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 27.3k | return unretained.get(); | 418 | 27.3k | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_5debug17TraceResultBufferEEEE6UnwrapES5_ Line | Count | Source | 416 | 348 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 348 | return unretained.get(); | 418 | 348 | } |
_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_5debug8TraceLogEEEE6UnwrapES5_ Line | Count | Source | 416 | 8 | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 8 | return unretained.get(); | 418 | 8 | } |
thread.cc:_ZN2yb8internal12UnwrapTraitsINS0_17UnretainedWrapperINS_12_GLOBAL__N_19ThreadMgrEEEE6UnwrapES5_ Line | Count | Source | 416 | 30.3k | static ForwardType Unwrap(UnretainedWrapper<T> unretained) { | 417 | 30.3k | return unretained.get(); | 418 | 30.3k | } |
|
419 | | }; |
420 | | |
421 | | template <typename T> |
422 | | struct UnwrapTraits<ConstRefWrapper<T> > { |
423 | | typedef const T& ForwardType; |
424 | 657k | static ForwardType Unwrap(ConstRefWrapper<T> const_ref) { |
425 | 657k | return const_ref.get(); |
426 | 657k | } _ZN2yb8internal12UnwrapTraitsINS0_15ConstRefWrapperINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEEE6UnwrapESA_ Line | Count | Source | 424 | 328k | static ForwardType Unwrap(ConstRefWrapper<T> const_ref) { | 425 | 328k | return const_ref.get(); | 426 | 328k | } |
_ZN2yb8internal12UnwrapTraitsINS0_15ConstRefWrapperINS_2ql19StatementParametersEEEE6UnwrapES5_ Line | Count | Source | 424 | 329k | static ForwardType Unwrap(ConstRefWrapper<T> const_ref) { | 425 | 329k | return const_ref.get(); | 426 | 329k | } |
|
427 | | }; |
428 | | |
429 | | template <typename T> |
430 | | struct UnwrapTraits<scoped_refptr<T> > { |
431 | | typedef T* ForwardType; |
432 | 4.19k | static ForwardType Unwrap(const scoped_refptr<T>& o) { return o.get(); } _ZN2yb8internal12UnwrapTraitsI13scoped_refptrINS_3RefEEE6UnwrapERKS4_ Line | Count | Source | 432 | 1 | static ForwardType Unwrap(const scoped_refptr<T>& o) { return o.get(); } |
_ZN2yb8internal12UnwrapTraitsI13scoped_refptrINS_5tools22ChecksumResultReporterEEE6UnwrapERKS5_ Line | Count | Source | 432 | 4.19k | static ForwardType Unwrap(const scoped_refptr<T>& o) { return o.get(); } |
|
433 | | }; |
434 | | |
435 | | // We didn't import WeakPtr from Chromium. |
436 | | // |
437 | | // template <typename T> |
438 | | // struct UnwrapTraits<WeakPtr<T> > { |
439 | | // typedef const WeakPtr<T>& ForwardType; |
440 | | // static ForwardType Unwrap(const WeakPtr<T>& o) { return o; } |
441 | | // }; |
442 | | |
443 | | template <typename T> |
444 | | struct UnwrapTraits<OwnedWrapper<T> > { |
445 | | typedef T* ForwardType; |
446 | 331k | static ForwardType Unwrap(const OwnedWrapper<T>& o) { |
447 | 331k | return o.get(); |
448 | 331k | } |
449 | | }; |
450 | | |
451 | | template <typename T> |
452 | | struct UnwrapTraits<PassedWrapper<T> > { |
453 | | typedef T ForwardType; |
454 | | static T Unwrap(PassedWrapper<T>& o) { // NOLINT |
455 | | return o.Pass(); |
456 | | } |
457 | | }; |
458 | | |
459 | | // Utility for handling different refcounting semantics in the Bind() |
460 | | // function. |
461 | | template <bool is_method, typename T> |
462 | | struct MaybeRefcount; |
463 | | |
464 | | template <typename T> |
465 | | struct MaybeRefcount<false, T> { |
466 | 738k | static void AddRef(const T&) {} _ZN2yb8internal13MaybeRefcountILb0ENSt3__110shared_ptrINS_9consensus12ReplicateMsgEEEE6AddRefERKS6_ Line | Count | Source | 466 | 250 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EPNS_12SynchronizerEE6AddRefERKS3_ Line | Count | Source | 466 | 577k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EiE6AddRefERKi Line | Count | Source | 466 | 2 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperIiEEE6AddRefERKS3_ Line | Count | Source | 466 | 3 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ExE6AddRefERKx Line | Count | Source | 466 | 133 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE6AddRefERKS9_ Line | Count | Source | 466 | 2 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EPNS_8HostPortEE6AddRefERKS3_ Line | Count | Source | 466 | 2.28k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EyE6AddRefERKy Line | Count | Source | 466 | 286 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperIKcEEE6AddRefERKS4_ Line | Count | Source | 466 | 105k | static void AddRef(const T&) {} |
heartbeater.cc:_ZN2yb8internal13MaybeRefcountILb0ENSt3__110shared_ptrINS_7tserver12_GLOBAL__N_120FindLeaderMasterDataEEEE6AddRefERKS7_ Line | Count | Source | 466 | 5.72k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperINS_6tablet14AbstractTabletEEEE6AddRefERKS5_ Line | Count | Source | 466 | 42.9k | static void AddRef(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperINS_6client17YBLoggingCallbackEEEE6AddRefERKS5_ Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb0ENSt3__18weak_ptrINS_12SynchronizerEEEE6AddRefERKS5_ _ZN2yb8internal13MaybeRefcountILb0E13scoped_refptrINS_5tools22ChecksumResultReporterEEE6AddRefERKS5_ Line | Count | Source | 466 | 4.19k | static void AddRef(const T&) {} |
|
467 | 634k | static void Release(const T&) {} _ZN2yb8internal13MaybeRefcountILb0ENSt3__110shared_ptrINS_9consensus12ReplicateMsgEEEE7ReleaseERKS6_ Line | Count | Source | 467 | 250 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EPNS_12SynchronizerEE7ReleaseERKS3_ Line | Count | Source | 467 | 577k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EiE7ReleaseERKi Line | Count | Source | 467 | 2 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperIiEEE7ReleaseERKS3_ Line | Count | Source | 467 | 3 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ExE7ReleaseERKx Line | Count | Source | 467 | 133 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE7ReleaseERKS9_ Line | Count | Source | 467 | 2 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EPNS_8HostPortEE7ReleaseERKS3_ Line | Count | Source | 467 | 2.28k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0EyE7ReleaseERKy Line | Count | Source | 467 | 284 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperIKcEEE7ReleaseERKS4_ Line | Count | Source | 467 | 972 | static void Release(const T&) {} |
heartbeater.cc:_ZN2yb8internal13MaybeRefcountILb0ENSt3__110shared_ptrINS_7tserver12_GLOBAL__N_120FindLeaderMasterDataEEEE7ReleaseERKS7_ Line | Count | Source | 467 | 5.42k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperINS_6tablet14AbstractTabletEEEE7ReleaseERKS5_ Line | Count | Source | 467 | 42.9k | static void Release(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb0ENS0_17UnretainedWrapperINS_6client17YBLoggingCallbackEEEE7ReleaseERKS5_ Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb0ENSt3__18weak_ptrINS_12SynchronizerEEEE7ReleaseERKS5_ _ZN2yb8internal13MaybeRefcountILb0E13scoped_refptrINS_5tools22ChecksumResultReporterEEE7ReleaseERKS5_ Line | Count | Source | 467 | 4.19k | static void Release(const T&) {} |
|
468 | | }; |
469 | | |
470 | | template <typename T, size_t n> |
471 | | struct MaybeRefcount<false, T[n]> { |
472 | | static void AddRef(const T*) {} |
473 | | static void Release(const T*) {} |
474 | | }; |
475 | | |
476 | | template <typename T> |
477 | | struct MaybeRefcount<true, T> { |
478 | 42.9M | static void AddRef(const T&) {} _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_12SynchronizerEEEE6AddRefERKS4_ Line | Count | Source | 478 | 854k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master49SystemTableFaultTolerance_TestFaultTolerance_TestEEEE6AddRefERKS5_ Line | Count | Source | 478 | 1 | static void AddRef(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_2ql15TestQLStatementEEEE6AddRefERKS5_ _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6tablet14TabletPeerTestEEEE6AddRefERKS5_ Line | Count | Source | 478 | 4 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_43FailureDetectorTest_TestDetectsFailure_TestEEEE6AddRefERKS4_ Line | Count | Source | 478 | 1 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_7PromiseIiEEEEE6AddRefERKS5_ Line | Count | Source | 478 | 1 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_9consensus16PeerMessageQueueEEEE6AddRefERKS5_ Line | Count | Source | 478 | 28.2M | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_9consensus8LogCacheEEEE6AddRefERKS5_ Line | Count | Source | 478 | 13.1M | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_3log3LogEEEE6AddRefERKS5_ Line | Count | Source | 478 | 96.9k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master14CatalogManagerEEEE6AddRefERKS5_ Line | Count | Source | 478 | 7.46k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master6MasterEEEE6AddRefERKS5_ Line | Count | Source | 478 | 5.42k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master15SysCatalogTableEEEE6AddRefERKS5_ Line | Count | Source | 478 | 5.35k | static void AddRef(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master10enterprise14CatalogManagerEEEE6AddRefERKS6_ _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_2ql11QLProcessorEEEE6AddRefERKS5_ Line | Count | Source | 478 | 331k | static void AddRef(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_2ql15TestQLProcessorEEEE6AddRefERKS5_ _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6server11HybridClockEEEE6AddRefERKS5_ Line | Count | Source | 478 | 51.3k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6server12LogicalClockEEEE6AddRefERKS5_ Line | Count | Source | 478 | 72 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_7tserver15TSTabletManagerEEEE6AddRefERKS5_ Line | Count | Source | 478 | 83.3k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_7tserver26RemoteBootstrapSessionTestEEEE6AddRefERKS5_ Line | Count | Source | 478 | 4 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_9cqlserver12CQLProcessorEEEE6AddRefERKS5_ Line | Count | Source | 478 | 17.0k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6client8YBClient4DataEEEE6AddRefERKS6_ Line | Count | Source | 478 | 28.3k | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_5debug17TraceResultBufferEEEE6AddRefERKS5_ Line | Count | Source | 478 | 23 | static void AddRef(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_5debug8TraceLogEEEE6AddRefERKS5_ Line | Count | Source | 478 | 8 | static void AddRef(const T&) {} |
thread.cc:_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_12_GLOBAL__N_19ThreadMgrEEEE6AddRefERKS5_ Line | Count | Source | 478 | 35.0k | static void AddRef(const T&) {} |
|
479 | 42.7M | static void Release(const T&) {} _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_12SynchronizerEEEE7ReleaseERKS4_ Line | Count | Source | 479 | 854k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master49SystemTableFaultTolerance_TestFaultTolerance_TestEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 1 | static void Release(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_2ql15TestQLStatementEEEE7ReleaseERKS5_ _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6tablet14TabletPeerTestEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 4 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_43FailureDetectorTest_TestDetectsFailure_TestEEEE7ReleaseERKS4_ Line | Count | Source | 479 | 1 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_7PromiseIiEEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 1 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_9consensus16PeerMessageQueueEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 28.2M | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_9consensus8LogCacheEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 13.1M | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_3log3LogEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 97.0k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master14CatalogManagerEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 2.10k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master6MasterEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 5.36k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master15SysCatalogTableEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 90 | static void Release(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6master10enterprise14CatalogManagerEEEE7ReleaseERKS6_ _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_2ql11QLProcessorEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 331k | static void Release(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_2ql15TestQLProcessorEEEE7ReleaseERKS5_ _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6server11HybridClockEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 387 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6server12LogicalClockEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 28 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_7tserver15TSTabletManagerEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 46.9k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_7tserver26RemoteBootstrapSessionTestEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 4 | static void Release(const T&) {} |
Unexecuted instantiation: _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_9cqlserver12CQLProcessorEEEE7ReleaseERKS5_ _ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_6client8YBClient4DataEEEE7ReleaseERKS6_ Line | Count | Source | 479 | 27.2k | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_5debug17TraceResultBufferEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 23 | static void Release(const T&) {} |
_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_5debug8TraceLogEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 8 | static void Release(const T&) {} |
thread.cc:_ZN2yb8internal13MaybeRefcountILb1ENS0_17UnretainedWrapperINS_12_GLOBAL__N_19ThreadMgrEEEE7ReleaseERKS5_ Line | Count | Source | 479 | 328 | static void Release(const T&) {} |
|
480 | | }; |
481 | | |
482 | | template <typename T> |
483 | | struct MaybeRefcount<true, T*> { |
484 | 2.00k | static void AddRef(T* o) { o->AddRef(); } mt-log-test.cc:_ZN2yb8internal13MaybeRefcountILb1EPNS_3log12_GLOBAL__N_119CustomLatchCallbackEE6AddRefES5_ Line | Count | Source | 484 | 2.00k | static void AddRef(T* o) { o->AddRef(); } |
_ZN2yb8internal13MaybeRefcountILb1EPNS_12RefCountableEE6AddRefES3_ Line | Count | Source | 484 | 1 | static void AddRef(T* o) { o->AddRef(); } |
|
485 | 2.00k | static void Release(T* o) { o->Release(); } mt-log-test.cc:_ZN2yb8internal13MaybeRefcountILb1EPNS_3log12_GLOBAL__N_119CustomLatchCallbackEE7ReleaseES5_ Line | Count | Source | 485 | 2.00k | static void Release(T* o) { o->Release(); } |
_ZN2yb8internal13MaybeRefcountILb1EPNS_12RefCountableEE7ReleaseES3_ Line | Count | Source | 485 | 1 | static void Release(T* o) { o->Release(); } |
|
486 | | }; |
487 | | |
488 | | // No need to additionally AddRef() and Release() since we are storing a |
489 | | // scoped_refptr<> inside the storage object already. |
490 | | template <typename T> |
491 | | struct MaybeRefcount<true, scoped_refptr<T> > { |
492 | 1 | static void AddRef(const scoped_refptr<T>& o) {} |
493 | 1 | static void Release(const scoped_refptr<T>& o) {} |
494 | | }; |
495 | | |
496 | | template <typename T> |
497 | | struct MaybeRefcount<true, const T*> { |
498 | | static void AddRef(const T* o) { o->AddRef(); } |
499 | | static void Release(const T* o) { o->Release(); } |
500 | | }; |
501 | | |
502 | | // We didn't import WeakPtr from Chromium. |
503 | | // |
504 | | //// IsWeakMethod is a helper that determine if we are binding a WeakPtr<> to a |
505 | | //// method. It is used internally by Bind() to select the correct |
506 | | //// InvokeHelper that will no-op itself in the event the WeakPtr<> for |
507 | | //// the target object is invalidated. |
508 | | //// |
509 | | //// P1 should be the type of the object that will be received of the method. |
510 | | // template <bool IsMethod, typename P1> |
511 | | // struct IsWeakMethod : public false_type {}; |
512 | | // |
513 | | // template <typename T> |
514 | | // struct IsWeakMethod<true, WeakPtr<T> > : public true_type {}; |
515 | | // |
516 | | // template <typename T> |
517 | | // struct IsWeakMethod<true, ConstRefWrapper<WeakPtr<T> > > : public true_type {}; |
518 | | |
519 | | } // namespace internal |
520 | | |
521 | | template <typename T> |
522 | 43.1M | static inline internal::UnretainedWrapper<T> Unretained(T* o) { |
523 | 43.1M | return internal::UnretainedWrapper<T>(o); |
524 | 43.1M | } system_table_fault_tolerance.cc:_ZN2ybL10UnretainedINS_6master49SystemTableFaultTolerance_TestFaultTolerance_TestEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 1 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 1 | return internal::UnretainedWrapper<T>(o); | 524 | 1 | } |
system_table_fault_tolerance.cc:_ZN2ybL10UnretainedINS_12SynchronizerEEENS_8internal17UnretainedWrapperIT_EEPS4_ Line | Count | Source | 522 | 1 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 1 | return internal::UnretainedWrapper<T>(o); | 524 | 1 | } |
Unexecuted instantiation: ql-statement-test.cc:_ZN2ybL10UnretainedINS_2ql15TestQLStatementEEENS_8internal17UnretainedWrapperIT_EEPS5_ Unexecuted instantiation: ql-statement-test.cc:_ZN2ybL10UnretainedINS_12SynchronizerEEENS_8internal17UnretainedWrapperIT_EEPS4_ tablet_peer-test.cc:_ZN2ybL10UnretainedINS_6tablet14TabletPeerTestEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 4 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 4 | return internal::UnretainedWrapper<T>(o); | 524 | 4 | } |
failure_detector-test.cc:_ZN2ybL10UnretainedINS_43FailureDetectorTest_TestDetectsFailure_TestEEENS_8internal17UnretainedWrapperIT_EEPS4_ Line | Count | Source | 522 | 1 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 1 | return internal::UnretainedWrapper<T>(o); | 524 | 1 | } |
metrics-test.cc:_ZN2ybL10UnretainedIiEENS_8internal17UnretainedWrapperIT_EEPS3_ Line | Count | Source | 522 | 3 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 3 | return internal::UnretainedWrapper<T>(o); | 524 | 3 | } |
thread-test.cc:_ZN2ybL10UnretainedIKcEENS_8internal17UnretainedWrapperIT_EEPS4_ Line | Count | Source | 522 | 2 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 2 | return internal::UnretainedWrapper<T>(o); | 524 | 2 | } |
threadpool-test.cc:_ZN2ybL10UnretainedINS_7PromiseIiEEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 1 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 1 | return internal::UnretainedWrapper<T>(o); | 524 | 1 | } |
consensus_queue.cc:_ZN2ybL10UnretainedINS_9consensus16PeerMessageQueueEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 28.2M | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 28.2M | return internal::UnretainedWrapper<T>(o); | 524 | 28.2M | } |
log_cache.cc:_ZN2ybL10UnretainedINS_9consensus8LogCacheEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 13.1M | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 13.1M | return internal::UnretainedWrapper<T>(o); | 524 | 13.1M | } |
log.cc:_ZN2ybL10UnretainedINS_3log3LogEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 96.9k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 96.9k | return internal::UnretainedWrapper<T>(o); | 524 | 96.9k | } |
catalog_manager.cc:_ZN2ybL10UnretainedINS_6master14CatalogManagerEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 7.46k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 7.46k | return internal::UnretainedWrapper<T>(o); | 524 | 7.46k | } |
master.cc:_ZN2ybL10UnretainedINS_6master6MasterEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 5.42k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 5.42k | return internal::UnretainedWrapper<T>(o); | 524 | 5.42k | } |
sys_catalog.cc:_ZN2ybL10UnretainedINS_6master15SysCatalogTableEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 5.35k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 5.35k | return internal::UnretainedWrapper<T>(o); | 524 | 5.35k | } |
Unexecuted instantiation: catalog_manager_ent.cc:_ZN2ybL10UnretainedINS_6master10enterprise14CatalogManagerEEENS_8internal17UnretainedWrapperIT_EEPS6_ ql_processor.cc:_ZN2ybL10UnretainedINS_2ql11QLProcessorEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 330k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 330k | return internal::UnretainedWrapper<T>(o); | 524 | 330k | } |
Unexecuted instantiation: ql-test-base.cc:_ZN2ybL10UnretainedINS_2ql15TestQLProcessorEEENS_8internal17UnretainedWrapperIT_EEPS5_ Unexecuted instantiation: ql-test-base.cc:_ZN2ybL10UnretainedINS_2ql11QLProcessorEEENS_8internal17UnretainedWrapperIT_EEPS5_ Unexecuted instantiation: ql-test-base.cc:_ZN2ybL10UnretainedINS_2ql9ParseTreeEEENS_8internal17UnretainedWrapperIT_EEPS5_ hybrid_clock.cc:_ZN2ybL10UnretainedINS_6server11HybridClockEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 51.3k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 51.3k | return internal::UnretainedWrapper<T>(o); | 524 | 51.3k | } |
logical_clock.cc:_ZN2ybL10UnretainedINS_6server12LogicalClockEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 72 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 72 | return internal::UnretainedWrapper<T>(o); | 524 | 72 | } |
tcmalloc_metrics.cc:_ZN2ybL10UnretainedIKcEENS_8internal17UnretainedWrapperIT_EEPS4_ Line | Count | Source | 522 | 105k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 105k | return internal::UnretainedWrapper<T>(o); | 524 | 105k | } |
read_query.cc:_ZN2ybL10UnretainedINS_6tablet14AbstractTabletEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 42.9k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 42.9k | return internal::UnretainedWrapper<T>(o); | 524 | 42.9k | } |
read_query.cc:_ZN2ybL10UnretainedINS_15RedisResponsePBEEENS_8internal17UnretainedWrapperIT_EEPS4_ Line | Count | Source | 522 | 42.9k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 42.9k | return internal::UnretainedWrapper<T>(o); | 524 | 42.9k | } |
ts_tablet_manager.cc:_ZN2ybL10UnretainedINS_7tserver15TSTabletManagerEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 83.3k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 83.3k | return internal::UnretainedWrapper<T>(o); | 524 | 83.3k | } |
remote_bootstrap_session-test.cc:_ZN2ybL10UnretainedINS_7tserver26RemoteBootstrapSessionTestEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 4 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 4 | return internal::UnretainedWrapper<T>(o); | 524 | 4 | } |
cql_processor.cc:_ZN2ybL10UnretainedINS_9cqlserver12CQLProcessorEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 17.0k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 17.0k | return internal::UnretainedWrapper<T>(o); | 524 | 17.0k | } |
Unexecuted instantiation: client.cc:_ZN2ybL10UnretainedINS_6client17YBLoggingCallbackEEENS_8internal17UnretainedWrapperIT_EEPS5_ client-internal.cc:_ZN2ybL10UnretainedINS_6client8YBClient4DataEEENS_8internal17UnretainedWrapperIT_EEPS6_ Line | Count | Source | 522 | 29.1k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 29.1k | return internal::UnretainedWrapper<T>(o); | 524 | 29.1k | } |
trace_event_impl.cc:_ZN2ybL10UnretainedINS_5debug17TraceResultBufferEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 23 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 23 | return internal::UnretainedWrapper<T>(o); | 524 | 23 | } |
trace_event_impl.cc:_ZN2ybL10UnretainedINS_5debug8TraceLogEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 8 | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 8 | return internal::UnretainedWrapper<T>(o); | 524 | 8 | } |
thread.cc:_ZN2ybL10UnretainedINS_12_GLOBAL__N_19ThreadMgrEEENS_8internal17UnretainedWrapperIT_EEPS5_ Line | Count | Source | 522 | 35.0k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 35.0k | return internal::UnretainedWrapper<T>(o); | 524 | 35.0k | } |
async_util.cc:_ZN2ybL10UnretainedINS_12SynchronizerEEENS_8internal17UnretainedWrapperIT_EEPS4_ Line | Count | Source | 522 | 854k | static inline internal::UnretainedWrapper<T> Unretained(T* o) { | 523 | 854k | return internal::UnretainedWrapper<T>(o); | 524 | 854k | } |
|
525 | | |
526 | | template <typename T> |
527 | 660k | static inline internal::ConstRefWrapper<T> ConstRef(const T& o) { |
528 | 660k | return internal::ConstRefWrapper<T>(o); |
529 | 660k | } ql_processor.cc:_ZN2ybL8ConstRefINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS_8internal15ConstRefWrapperIT_EERKSA_ Line | Count | Source | 527 | 330k | static inline internal::ConstRefWrapper<T> ConstRef(const T& o) { | 528 | 330k | return internal::ConstRefWrapper<T>(o); | 529 | 330k | } |
ql_processor.cc:_ZN2ybL8ConstRefINS_2ql19StatementParametersEEENS_8internal15ConstRefWrapperIT_EERKS5_ Line | Count | Source | 527 | 330k | static inline internal::ConstRefWrapper<T> ConstRef(const T& o) { | 528 | 330k | return internal::ConstRefWrapper<T>(o); | 529 | 330k | } |
Unexecuted instantiation: ql-test-base.cc:_ZN2ybL8ConstRefINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS_8internal15ConstRefWrapperIT_EERKSA_ Unexecuted instantiation: ql-test-base.cc:_ZN2ybL8ConstRefINS_2ql19StatementParametersEEENS_8internal15ConstRefWrapperIT_EERKS5_ |
530 | | |
531 | | template <typename T> |
532 | 330k | static inline internal::OwnedWrapper<T> Owned(T* o) { |
533 | 330k | return internal::OwnedWrapper<T>(o); |
534 | 330k | } |
535 | | |
536 | | // We offer 2 syntaxes for calling Passed(). The first takes a temporary and |
537 | | // is best suited for use with the return value of a function. The second |
538 | | // takes a pointer to the scoper and is just syntactic sugar to avoid having |
539 | | // to write Passed(scoper.Pass()). |
540 | | template <typename T> |
541 | | static inline internal::PassedWrapper<T> Passed(T scoper) { |
542 | | return internal::PassedWrapper<T>(scoper.Pass()); |
543 | | } |
544 | | template <typename T> |
545 | | static inline internal::PassedWrapper<T> Passed(T* scoper) { |
546 | | return internal::PassedWrapper<T>(scoper->Pass()); |
547 | | } |
548 | | |
549 | | template <typename T> |
550 | | static inline internal::IgnoreResultHelper<T> IgnoreResult(T data) { |
551 | | return internal::IgnoreResultHelper<T>(data); |
552 | | } |
553 | | |
554 | | template <typename T> |
555 | | static inline internal::IgnoreResultHelper<Callback<T> > |
556 | | IgnoreResult(const Callback<T>& data) { |
557 | | return internal::IgnoreResultHelper<Callback<T> >(data); |
558 | | } |
559 | | |
560 | | template<typename T> |
561 | | void DeletePointer(T* obj) { |
562 | | delete obj; |
563 | | } |
564 | | |
565 | | } // namespace yb |
566 | | |
567 | | #endif // YB_GUTIL_BIND_HELPERS_H_ |