OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This defines a set of argument wrappers and related factory methods that | 5 // This defines a set of argument wrappers and related factory methods that |
6 // can be used specify the refcounting and reference semantics of arguments | 6 // can be used specify the refcounting and reference semantics of arguments |
7 // that are bound by the Bind() function in base/bind.h. | 7 // that are bound by the Bind() function in base/bind.h. |
8 // | 8 // |
9 // It also defines a set of simple functions and utilities that people want | 9 // It also defines a set of simple functions and utilities that people want |
10 // when using Callback<> and Bind(). | 10 // when using Callback<> and Bind(). |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // | 136 // |
137 // DoNothing() - Useful for creating a Closure that does nothing when called. | 137 // DoNothing() - Useful for creating a Closure that does nothing when called. |
138 // DeletePointer<T>() - Useful for creating a Closure that will delete a | 138 // DeletePointer<T>() - Useful for creating a Closure that will delete a |
139 // pointer when invoked. Only use this when necessary. | 139 // pointer when invoked. Only use this when necessary. |
140 // In most cases MessageLoop::DeleteSoon() is a better | 140 // In most cases MessageLoop::DeleteSoon() is a better |
141 // fit. | 141 // fit. |
142 | 142 |
143 #ifndef BASE_BIND_HELPERS_H_ | 143 #ifndef BASE_BIND_HELPERS_H_ |
144 #define BASE_BIND_HELPERS_H_ | 144 #define BASE_BIND_HELPERS_H_ |
145 | 145 |
| 146 #include <stddef.h> |
| 147 |
146 #include <type_traits> | 148 #include <type_traits> |
147 #include <utility> | 149 #include <utility> |
148 | 150 |
149 #include "base/basictypes.h" | |
150 #include "base/callback.h" | 151 #include "base/callback.h" |
151 #include "base/memory/weak_ptr.h" | 152 #include "base/memory/weak_ptr.h" |
152 #include "base/template_util.h" | 153 #include "base/template_util.h" |
| 154 #include "build/build_config.h" |
153 | 155 |
154 namespace base { | 156 namespace base { |
155 namespace internal { | 157 namespace internal { |
156 | 158 |
157 // Use the Substitution Failure Is Not An Error (SFINAE) trick to inspect T | 159 // Use the Substitution Failure Is Not An Error (SFINAE) trick to inspect T |
158 // for the existence of AddRef() and Release() functions of the correct | 160 // for the existence of AddRef() and Release() functions of the correct |
159 // signature. | 161 // signature. |
160 // | 162 // |
161 // http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error | 163 // http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error |
162 // http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-templat
e-to-check-for-a-functions-existence | 164 // http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-templat
e-to-check-for-a-functions-existence |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 BASE_EXPORT void DoNothing(); | 649 BASE_EXPORT void DoNothing(); |
648 | 650 |
649 template<typename T> | 651 template<typename T> |
650 void DeletePointer(T* obj) { | 652 void DeletePointer(T* obj) { |
651 delete obj; | 653 delete obj; |
652 } | 654 } |
653 | 655 |
654 } // namespace base | 656 } // namespace base |
655 | 657 |
656 #endif // BASE_BIND_HELPERS_H_ | 658 #endif // BASE_BIND_HELPERS_H_ |
OLD | NEW |