| 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 // The public functions are base::Unretained() and base::ConstRef(). | 9 // The public functions are base::Unretained() and base::ConstRef(). |
| 10 // Unretained() allows Bind() to bind a non-refcounted class. | 10 // Unretained() allows Bind() to bind a non-refcounted class. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // instantiate Base is made. We disable the warning for this definition. | 138 // instantiate Base is made. We disable the warning for this definition. |
| 139 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 140 #pragma warning(disable:4624) | 140 #pragma warning(disable:4624) |
| 141 #endif | 141 #endif |
| 142 struct Base : public T, public BaseMixin { | 142 struct Base : public T, public BaseMixin { |
| 143 }; | 143 }; |
| 144 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
| 145 #pragma warning(default:4624) | 145 #pragma warning(default:4624) |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 template <void(BaseMixin::*)(void)> struct Helper {}; | 148 template <void(BaseMixin::*)(void)> struct Helper {}; |
| 149 | 149 |
| 150 template <typename C> | 150 template <typename C> |
| 151 static No& Check(Helper<&C::AddRef>*, Helper<&C::Release>*); | 151 static No& Check(Helper<&C::AddRef>*, Helper<&C::Release>*); |
| 152 | 152 |
| 153 template <typename > | 153 template <typename > |
| 154 static Yes& Check(...); | 154 static Yes& Check(...); |
| 155 | 155 |
| 156 public: | 156 public: |
| 157 static const bool value = sizeof(Check<Base>(0,0)) == sizeof(Yes); | 157 static const bool value = sizeof(Check<Base>(0,0)) == sizeof(Yes); |
| 158 }; | 158 }; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 | 255 |
| 256 template <typename T> | 256 template <typename T> |
| 257 inline internal::ConstRefWrapper<T> ConstRef(const T& o) { | 257 inline internal::ConstRefWrapper<T> ConstRef(const T& o) { |
| 258 return internal::ConstRefWrapper<T>(o); | 258 return internal::ConstRefWrapper<T>(o); |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace base | 261 } // namespace base |
| 262 | 262 |
| 263 #endif // BASE_BIND_HELPERS_H_ | 263 #endif // BASE_BIND_HELPERS_H_ |
| OLD | NEW |