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 // ============================================================================ | 5 // ============================================================================ |
6 // **************************************************************************** | 6 // **************************************************************************** |
7 // * THIS HEADER IS DEPRECATED, SEE base/callback.h FOR NEW IMPLEMENTATION * | 7 // * THIS HEADER IS DEPRECATED, SEE base/callback.h FOR NEW IMPLEMENTATION * |
8 // **************************************************************************** | 8 // **************************************************************************** |
9 // ============================================================================ | 9 // ============================================================================ |
10 // ============================================================================ | 10 // ============================================================================ |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Tasks are automatically deleted after Run is called. | 55 // Tasks are automatically deleted after Run is called. |
56 virtual void Run() = 0; | 56 virtual void Run() = 0; |
57 }; | 57 }; |
58 | 58 |
59 template<typename T> | 59 template<typename T> |
60 void DeletePointer(T* obj) { | 60 void DeletePointer(T* obj) { |
61 delete obj; | 61 delete obj; |
62 } | 62 } |
63 | 63 |
64 template<typename T> | |
65 void ReleasePointer(T* obj) { | |
66 obj->Release(); | |
67 } | |
68 | |
69 namespace base { | 64 namespace base { |
70 | 65 |
71 // ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the | 66 // ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the |
72 // Closure is executed and deleted no matter how the current scope exits. | 67 // Closure is executed and deleted no matter how the current scope exits. |
73 class BASE_EXPORT ScopedClosureRunner { | 68 class BASE_EXPORT ScopedClosureRunner { |
74 public: | 69 public: |
75 explicit ScopedClosureRunner(const Closure& closure); | 70 explicit ScopedClosureRunner(const Closure& closure); |
76 ~ScopedClosureRunner(); | 71 ~ScopedClosureRunner(); |
77 | 72 |
78 Closure Release(); | 73 Closure Release(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 Task* task_; | 112 Task* task_; |
118 bool* should_leak_task_; | 113 bool* should_leak_task_; |
119 static bool kTaskLeakingDefault; | 114 static bool kTaskLeakingDefault; |
120 }; | 115 }; |
121 | 116 |
122 } // namespace subtle | 117 } // namespace subtle |
123 | 118 |
124 } // namespace base | 119 } // namespace base |
125 | 120 |
126 #endif // BASE_TASK_H_ | 121 #endif // BASE_TASK_H_ |
OLD | NEW |