| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 const T& Unwrap(const ConstRefWrapper<T>& const_ref) { | 434 const T& Unwrap(const ConstRefWrapper<T>& const_ref) { |
| 435 return const_ref.get(); | 435 return const_ref.get(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 template <typename T> | 438 template <typename T> |
| 439 T* Unwrap(const RetainedRefWrapper<T>& o) { | 439 T* Unwrap(const RetainedRefWrapper<T>& o) { |
| 440 return o.get(); | 440 return o.get(); |
| 441 } | 441 } |
| 442 | 442 |
| 443 template <typename T> | 443 template <typename T> |
| 444 const WeakPtr<T>& Unwrap(const WeakPtr<T>& o) { | |
| 445 return o; | |
| 446 } | |
| 447 | |
| 448 template <typename T> | |
| 449 T* Unwrap(const OwnedWrapper<T>& o) { | 444 T* Unwrap(const OwnedWrapper<T>& o) { |
| 450 return o.get(); | 445 return o.get(); |
| 451 } | 446 } |
| 452 | 447 |
| 453 template <typename T> | 448 template <typename T> |
| 454 T Unwrap(const PassedWrapper<T>& o) { | 449 T Unwrap(const PassedWrapper<T>& o) { |
| 455 return o.Take(); | 450 return o.Take(); |
| 456 } | 451 } |
| 457 | 452 |
| 458 // IsWeakMethod is a helper that determine if we are binding a WeakPtr<> to a | 453 // IsWeakMethod is a helper that determine if we are binding a WeakPtr<> to a |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 643 |
| 649 template <typename T> | 644 template <typename T> |
| 650 struct IsWeakReceiver<internal::ConstRefWrapper<T>> : IsWeakReceiver<T> {}; | 645 struct IsWeakReceiver<internal::ConstRefWrapper<T>> : IsWeakReceiver<T> {}; |
| 651 | 646 |
| 652 template <typename T> | 647 template <typename T> |
| 653 struct IsWeakReceiver<WeakPtr<T>> : std::true_type {}; | 648 struct IsWeakReceiver<WeakPtr<T>> : std::true_type {}; |
| 654 | 649 |
| 655 } // namespace base | 650 } // namespace base |
| 656 | 651 |
| 657 #endif // BASE_BIND_HELPERS_H_ | 652 #endif // BASE_BIND_HELPERS_H_ |
| OLD | NEW |