Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: base/task.cc

Issue 7563025: TaskClosureAdapter::Run does not invoke the task if it is null. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698