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 file contains utility functions and classes that help the | 5 // This file contains utility functions and classes that help the |
6 // implementation, and management of the Callback objects. | 6 // implementation, and management of the Callback objects. |
7 | 7 |
8 #ifndef BASE_CALLBACK_INTERNAL_H_ | 8 #ifndef BASE_CALLBACK_INTERNAL_H_ |
9 #define BASE_CALLBACK_INTERNAL_H_ | 9 #define BASE_CALLBACK_INTERNAL_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <stddef.h> | 12 #include <stddef.h> |
13 | 13 |
14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
| 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 // BindStateBase is used to provide an opaque handle that the Callback | 21 // BindStateBase is used to provide an opaque handle that the Callback |
21 // class can use to represent a function object with bound arguments. It | 22 // class can use to represent a function object with bound arguments. It |
22 // behaves as an existential type that is used by a corresponding | 23 // behaves as an existential type that is used by a corresponding |
23 // DoInvoke function to perform the function execution. This allows | 24 // DoInvoke function to perform the function execution. This allows |
24 // us to shield the Callback class from the types of the bound argument via | 25 // us to shield the Callback class from the types of the bound argument via |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 typedef const T* StorageType; | 124 typedef const T* StorageType; |
124 }; | 125 }; |
125 | 126 |
126 // See comment for CallbackParamTraits<T[n]>. | 127 // See comment for CallbackParamTraits<T[n]>. |
127 template <typename T> | 128 template <typename T> |
128 struct CallbackParamTraits<T[]> { | 129 struct CallbackParamTraits<T[]> { |
129 typedef const T* ForwardType; | 130 typedef const T* ForwardType; |
130 typedef const T* StorageType; | 131 typedef const T* StorageType; |
131 }; | 132 }; |
132 | 133 |
| 134 template <typename T> |
| 135 class PassScopedWrapper; |
| 136 |
| 137 template <typename T> |
| 138 struct CallbackParamTraits<scoped_ptr<T> > { |
| 139 typedef const PassScopedWrapper<scoped_ptr<T> >& ForwardType; |
| 140 typedef PassScopedWrapper<scoped_ptr<T> > StorageType; |
| 141 }; |
| 142 |
133 } // namespace internal | 143 } // namespace internal |
134 } // namespace base | 144 } // namespace base |
135 | 145 |
136 #endif // BASE_CALLBACK_INTERNAL_H_ | 146 #endif // BASE_CALLBACK_INTERNAL_H_ |
OLD | NEW |