1 // Copyright (c) 2011 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.
13 CancelableTask::CancelableTask() {
16 CancelableTask::~CancelableTask() {
21 ScopedTaskRunner::ScopedTaskRunner(Task
* task
) : task_(task
) {
24 ScopedTaskRunner::~ScopedTaskRunner() {
31 Task
* ScopedTaskRunner::Release() {
37 ScopedClosureRunner::ScopedClosureRunner(const Closure
& closure
)
41 ScopedClosureRunner::~ScopedClosureRunner() {
42 if (!closure_
.is_null())
46 Closure
ScopedClosureRunner::Release() {
47 Closure result
= closure_
;
54 TaskClosureAdapter::TaskClosureAdapter(Task
* task
)
56 should_leak_task_(&kTaskLeakingDefault
) {
59 TaskClosureAdapter::TaskClosureAdapter(Task
* task
, bool* should_leak_task
)
61 should_leak_task_(should_leak_task
) {
64 TaskClosureAdapter::~TaskClosureAdapter() {
65 if (!*should_leak_task_
) {
70 void TaskClosureAdapter::Run() {
76 // Don't leak tasks by default.
77 bool TaskClosureAdapter::kTaskLeakingDefault
= false;