| 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 task_->Run(); | 56 if (task_) { |
| 57 delete task_; | 57 task_->Run(); |
| 58 task_ = NULL; | 58 delete task_; |
| 59 task_ = NULL; |
| 60 } |
| 59 } | 61 } |
| 60 | 62 |
| 61 // Don't leak tasks by default. | 63 // Don't leak tasks by default. |
| 62 bool TaskClosureAdapter::kTaskLeakingDefault = false; | 64 bool TaskClosureAdapter::kTaskLeakingDefault = false; |
| 63 | 65 |
| 64 } // namespace subtle | 66 } // namespace subtle |
| 65 | 67 |
| 66 } // namespace base | 68 } // namespace base |
| OLD | NEW |