OLD | NEW |
1 // Copyright (c) 2011 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() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 should_leak_task_(should_leak_task) { | 46 should_leak_task_(should_leak_task) { |
47 } | 47 } |
48 | 48 |
49 TaskClosureAdapter::~TaskClosureAdapter() { | 49 TaskClosureAdapter::~TaskClosureAdapter() { |
50 if (!*should_leak_task_) { | 50 if (!*should_leak_task_) { |
51 delete task_; | 51 delete task_; |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 void TaskClosureAdapter::Run() { | 55 void TaskClosureAdapter::Run() { |
56 if (task_) { | 56 task_->Run(); |
57 task_->Run(); | 57 delete task_; |
58 delete task_; | 58 task_ = NULL; |
59 task_ = NULL; | |
60 } | |
61 } | 59 } |
62 | 60 |
63 // Don't leak tasks by default. | 61 // Don't leak tasks by default. |
64 bool TaskClosureAdapter::kTaskLeakingDefault = false; | 62 bool TaskClosureAdapter::kTaskLeakingDefault = false; |
65 | 63 |
66 } // namespace subtle | 64 } // namespace subtle |
67 | 65 |
68 } // namespace base | 66 } // namespace base |
OLD | NEW |