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

Side by Side Diff: base/sequenced_task_runner.h

Issue 2164503002: Do not delete blink::WebRTCCertificateCallback on non-main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +std::move, -auto, s/std::move/&/ Created 4 years, 5 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
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 "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/sequenced_task_runner_helpers.h" 9 #include "base/sequenced_task_runner_helpers.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 bool DeleteSoonInternal(const tracked_objects::Location& from_here, 148 bool DeleteSoonInternal(const tracked_objects::Location& from_here,
149 void(*deleter)(const void*), 149 void(*deleter)(const void*),
150 const void* object); 150 const void* object);
151 151
152 bool ReleaseSoonInternal(const tracked_objects::Location& from_here, 152 bool ReleaseSoonInternal(const tracked_objects::Location& from_here,
153 void(*releaser)(const void*), 153 void(*releaser)(const void*),
154 const void* object); 154 const void* object);
155 }; 155 };
156 156
157 struct BASE_EXPORT OnTaskRunnerDeleter {
158 explicit OnTaskRunnerDeleter(scoped_refptr<SequencedTaskRunner> task_runner);
159 ~OnTaskRunnerDeleter();
160
161 OnTaskRunnerDeleter(OnTaskRunnerDeleter&&);
162 OnTaskRunnerDeleter& operator=(OnTaskRunnerDeleter&&);
163
164 template <typename T>
165 void operator()(const T* ptr) {
166 if (task_runner_->RunsTasksOnCurrentThread())
167 delete ptr;
168 else if (ptr)
169 task_runner_->DeleteSoon(FROM_HERE, ptr);
170 }
171
172 scoped_refptr<SequencedTaskRunner> task_runner_;
173 };
dcheng 2016/07/22 07:29:00 Do you anticipate this being used in a bunch of ot
tzik 2016/07/22 08:14:53 Yes. I saw several places that hold an object on a
174
157 } // namespace base 175 } // namespace base
158 176
159 #endif // BASE_SEQUENCED_TASK_RUNNER_H_ 177 #endif // BASE_SEQUENCED_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698