OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/task.h" | 5 #include "base/task.h" |
6 | 6 |
7 Task::Task() { | 7 Task::Task() { |
8 } | 8 } |
9 | 9 |
10 Task::~Task() { | 10 Task::~Task() { |
11 } | 11 } |
12 | 12 |
13 CancelableTask::CancelableTask() { | 13 CancelableTask::CancelableTask() { |
14 } | 14 } |
15 | 15 |
16 CancelableTask::~CancelableTask() { | 16 CancelableTask::~CancelableTask() { |
17 } | 17 } |
| 18 |
| 19 namespace base { |
| 20 |
| 21 ScopedTaskRunner::ScopedTaskRunner(Task* task) : task_(task) { |
| 22 } |
| 23 |
| 24 ScopedTaskRunner::~ScopedTaskRunner() { |
| 25 if (task_) { |
| 26 task_->Run(); |
| 27 delete task_; |
| 28 } |
| 29 } |
| 30 |
| 31 Task* ScopedTaskRunner::Release() { |
| 32 Task* tmp = task_; |
| 33 task_ = NULL; |
| 34 return tmp; |
| 35 } |
| 36 |
| 37 } // namespace base |
OLD | NEW |