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
3 // found in the LICENSE file.
5 #ifndef BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_
6 #define BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_
10 class SequencedTaskRunner;
12 // Template helpers which use function indirection to erase T from the
13 // function signature while still remembering it so we can call the
14 // correct destructor/release function.
16 // We use this trick so we don't need to include bind.h in a header
17 // file like sequenced_task_runner.h. We also wrap the helpers in a
18 // templated class to make it easier for users of DeleteSoon to
19 // declare the helper as a friend.
23 static void DoDelete(const void* object) {
24 delete static_cast<const T*>(object);
27 friend class SequencedTaskRunner;
33 static void DoRelease(const void* object) {
34 static_cast<const T*>(object)->Release();
37 friend class SequencedTaskRunner;
42 #endif // BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_