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 // CancelableCallback is a wrapper around base::Callback that allows | 5 // CancelableCallback is a wrapper around base::Callback that allows |
6 // cancellation of a callback. CancelableCallback takes a reference on the | 6 // cancellation of a callback. CancelableCallback takes a reference on the |
7 // wrapped callback until this object is destroyed or Reset()/Cancel() are | 7 // wrapped callback until this object is destroyed or Reset()/Cancel() are |
8 // called. | 8 // called. |
9 // | 9 // |
10 // NOTE: | 10 // NOTE: |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 #ifndef BASE_CANCELABLE_CALLBACK_H_ | 42 #ifndef BASE_CANCELABLE_CALLBACK_H_ |
43 #define BASE_CANCELABLE_CALLBACK_H_ | 43 #define BASE_CANCELABLE_CALLBACK_H_ |
44 | 44 |
45 #include "base/base_export.h" | 45 #include "base/base_export.h" |
46 #include "base/bind.h" | 46 #include "base/bind.h" |
47 #include "base/callback.h" | 47 #include "base/callback.h" |
48 #include "base/callback_internal.h" | 48 #include "base/callback_internal.h" |
49 #include "base/compiler_specific.h" | 49 #include "base/compiler_specific.h" |
50 #include "base/logging.h" | 50 #include "base/logging.h" |
| 51 #include "base/macros.h" |
51 #include "base/memory/weak_ptr.h" | 52 #include "base/memory/weak_ptr.h" |
52 | 53 |
53 namespace base { | 54 namespace base { |
54 | 55 |
55 template <typename Sig> | 56 template <typename Sig> |
56 class CancelableCallback; | 57 class CancelableCallback; |
57 | 58 |
58 template <typename... A> | 59 template <typename... A> |
59 class CancelableCallback<void(A...)> { | 60 class CancelableCallback<void(A...)> { |
60 public: | 61 public: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 base::WeakPtrFactory<CancelableCallback<void(A...)>> weak_factory_; | 123 base::WeakPtrFactory<CancelableCallback<void(A...)>> weak_factory_; |
123 | 124 |
124 DISALLOW_COPY_AND_ASSIGN(CancelableCallback); | 125 DISALLOW_COPY_AND_ASSIGN(CancelableCallback); |
125 }; | 126 }; |
126 | 127 |
127 typedef CancelableCallback<void(void)> CancelableClosure; | 128 typedef CancelableCallback<void(void)> CancelableClosure; |
128 | 129 |
129 } // namespace base | 130 } // namespace base |
130 | 131 |
131 #endif // BASE_CANCELABLE_CALLBACK_H_ | 132 #endif // BASE_CANCELABLE_CALLBACK_H_ |
OLD | NEW |