Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: base/sequenced_task_runner.h

Issue 2927993002: Add cross-reference documentation about the forgotten RefCountedDeleteOnSequence. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/public/browser/browser_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef BASE_SEQUENCED_TASK_RUNNER_H_
6 #define BASE_SEQUENCED_TASK_RUNNER_H_ 6 #define BASE_SEQUENCED_TASK_RUNNER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 private: 151 private:
152 bool DeleteOrReleaseSoonInternal(const tracked_objects::Location& from_here, 152 bool DeleteOrReleaseSoonInternal(const tracked_objects::Location& from_here,
153 void (*deleter)(const void*), 153 void (*deleter)(const void*),
154 const void* object); 154 const void* object);
155 }; 155 };
156 156
157 // Sample usage with std::unique_ptr : 157 // Sample usage with std::unique_ptr :
158 // std::unique_ptr<Foo, base::OnTaskRunnerDeleter> ptr( 158 // std::unique_ptr<Foo, base::OnTaskRunnerDeleter> ptr(
159 // new Foo, base::OnTaskRunnerDeleter(my_task_runner)); 159 // new Foo, base::OnTaskRunnerDeleter(my_task_runner));
160 // 160 //
161 // TODO: RefCounted isn't yet supported per RefCountedTraits using a static 161 // For RefCounted see base::RefCountedDeleteOnSequence.
162 // deleter and thus not be bindable to a specific TaskRunner.
163 struct BASE_EXPORT OnTaskRunnerDeleter { 162 struct BASE_EXPORT OnTaskRunnerDeleter {
164 explicit OnTaskRunnerDeleter(scoped_refptr<SequencedTaskRunner> task_runner); 163 explicit OnTaskRunnerDeleter(scoped_refptr<SequencedTaskRunner> task_runner);
165 ~OnTaskRunnerDeleter(); 164 ~OnTaskRunnerDeleter();
166 165
167 OnTaskRunnerDeleter(OnTaskRunnerDeleter&&); 166 OnTaskRunnerDeleter(OnTaskRunnerDeleter&&);
168 OnTaskRunnerDeleter& operator=(OnTaskRunnerDeleter&&); 167 OnTaskRunnerDeleter& operator=(OnTaskRunnerDeleter&&);
169 168
170 // For compatibility with std:: deleters. 169 // For compatibility with std:: deleters.
171 template <typename T> 170 template <typename T>
172 void operator()(const T* ptr) { 171 void operator()(const T* ptr) {
173 if (ptr) 172 if (ptr)
174 task_runner_->DeleteSoon(FROM_HERE, ptr); 173 task_runner_->DeleteSoon(FROM_HERE, ptr);
175 } 174 }
176 175
177 scoped_refptr<SequencedTaskRunner> task_runner_; 176 scoped_refptr<SequencedTaskRunner> task_runner_;
178 }; 177 };
179 178
180 } // namespace base 179 } // namespace base
181 180
182 #endif // BASE_SEQUENCED_TASK_RUNNER_H_ 181 #endif // BASE_SEQUENCED_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « no previous file | content/public/browser/browser_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698