OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ | 5 #ifndef BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ |
6 #define BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ | 6 #define BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/debug/alias.h" |
9 | 10 |
10 // TODO(akalin): Investigate whether it's possible to just have | 11 // TODO(akalin): Investigate whether it's possible to just have |
11 // SequencedTaskRunner use these helpers (instead of MessageLoop). | 12 // SequencedTaskRunner use these helpers (instead of MessageLoop). |
12 // Then we can just move these to sequenced_task_runner.h. | 13 // Then we can just move these to sequenced_task_runner.h. |
13 | 14 |
14 namespace tracked_objects { | 15 namespace tracked_objects { |
15 class Location; | 16 class Location; |
16 } | 17 } |
17 | 18 |
18 namespace base { | 19 namespace base { |
(...skipping 10 matching lines...) Expand all Loading... |
29 // We use this trick so we don't need to include bind.h in a header | 30 // We use this trick so we don't need to include bind.h in a header |
30 // file like sequenced_task_runner.h. We also wrap the helpers in a | 31 // file like sequenced_task_runner.h. We also wrap the helpers in a |
31 // templated class to make it easier for users of DeleteSoon to | 32 // templated class to make it easier for users of DeleteSoon to |
32 // declare the helper as a friend. | 33 // declare the helper as a friend. |
33 template <class T> | 34 template <class T> |
34 class DeleteHelper { | 35 class DeleteHelper { |
35 private: | 36 private: |
36 template <class T2, class R> friend class subtle::DeleteHelperInternal; | 37 template <class T2, class R> friend class subtle::DeleteHelperInternal; |
37 | 38 |
38 static void DoDelete(const void* object) { | 39 static void DoDelete(const void* object) { |
| 40 // TODO(tzik): Remove this after http://crbug.com/393634 is fixed. |
| 41 const char* function_name = __FUNCTION__; |
| 42 debug::Alias(&function_name); |
| 43 |
39 delete reinterpret_cast<const T*>(object); | 44 delete reinterpret_cast<const T*>(object); |
40 } | 45 } |
41 | 46 |
42 DISALLOW_COPY_AND_ASSIGN(DeleteHelper); | 47 DISALLOW_COPY_AND_ASSIGN(DeleteHelper); |
43 }; | 48 }; |
44 | 49 |
45 template <class T> | 50 template <class T> |
46 class ReleaseHelper { | 51 class ReleaseHelper { |
47 private: | 52 private: |
48 template <class T2, class R> friend class subtle::ReleaseHelperInternal; | 53 template <class T2, class R> friend class subtle::ReleaseHelperInternal; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 108 |
104 private: | 109 private: |
105 DISALLOW_COPY_AND_ASSIGN(ReleaseHelperInternal); | 110 DISALLOW_COPY_AND_ASSIGN(ReleaseHelperInternal); |
106 }; | 111 }; |
107 | 112 |
108 } // namespace subtle | 113 } // namespace subtle |
109 | 114 |
110 } // namespace base | 115 } // namespace base |
111 | 116 |
112 #endif // BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ | 117 #endif // BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ |
OLD | NEW |