Chromium Code Reviews| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 T* Unwrap(UnretainedWrapper<T> unretained) { | 424 T* Unwrap(UnretainedWrapper<T> unretained) { |
| 425 return unretained.get(); | 425 return unretained.get(); |
| 426 } | 426 } |
| 427 | 427 |
| 428 template <typename T> | 428 template <typename T> |
| 429 const T& Unwrap(ConstRefWrapper<T> const_ref) { | 429 const T& Unwrap(ConstRefWrapper<T> const_ref) { |
| 430 return const_ref.get(); | 430 return const_ref.get(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 template <typename T> | 433 template <typename T> |
| 434 T* Unwrap(const scoped_refptr<T>& o) { | |
| 435 return o.get(); | |
| 436 } | |
| 437 | |
| 438 template <typename T> | |
|
Nico
2016/03/18 21:01:01
I'd land this bit in a different CL, so that it ca
vmpstr
2016/03/18 22:20:23
Good idea. I've separated this.
| |
| 439 T* Unwrap(const RetainedRefWrapper<T>& o) { | 434 T* Unwrap(const RetainedRefWrapper<T>& o) { |
| 440 return o.get(); | 435 return o.get(); |
| 441 } | 436 } |
| 442 | 437 |
| 443 template <typename T> | 438 template <typename T> |
| 444 const WeakPtr<T>& Unwrap(const WeakPtr<T>& o) { | 439 const WeakPtr<T>& Unwrap(const WeakPtr<T>& o) { |
| 445 return o; | 440 return o; |
| 446 } | 441 } |
| 447 | 442 |
| 448 template <typename T> | 443 template <typename T> |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 627 BASE_EXPORT void DoNothing(); | 622 BASE_EXPORT void DoNothing(); |
| 628 | 623 |
| 629 template<typename T> | 624 template<typename T> |
| 630 void DeletePointer(T* obj) { | 625 void DeletePointer(T* obj) { |
| 631 delete obj; | 626 delete obj; |
| 632 } | 627 } |
| 633 | 628 |
| 634 } // namespace base | 629 } // namespace base |
| 635 | 630 |
| 636 #endif // BASE_BIND_HELPERS_H_ | 631 #endif // BASE_BIND_HELPERS_H_ |
| OLD | NEW |