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

Side by Side Diff: webrtc/base/taskparent.cc

Issue 1429513004: Switch usage of _DEBUG macro to NDEBUG. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: REBASE Created 5 years, 1 month 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
« no previous file with comments | « webrtc/base/taskparent.h ('k') | webrtc/base/taskrunner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 28 matching lines...) Expand all
39 // Does common initialization of member variables 39 // Does common initialization of member variables
40 void TaskParent::Initialize() { 40 void TaskParent::Initialize() {
41 children_.reset(new ChildSet()); 41 children_.reset(new ChildSet());
42 child_error_ = false; 42 child_error_ = false;
43 } 43 }
44 44
45 void TaskParent::AddChild(Task *child) { 45 void TaskParent::AddChild(Task *child) {
46 children_->insert(child); 46 children_->insert(child);
47 } 47 }
48 48
49 #ifdef _DEBUG 49 #if !defined(NDEBUG)
50 bool TaskParent::IsChildTask(Task *task) { 50 bool TaskParent::IsChildTask(Task *task) {
51 ASSERT(task != NULL); 51 ASSERT(task != NULL);
52 return task->parent_ == this && children_->find(task) != children_->end(); 52 return task->parent_ == this && children_->find(task) != children_->end();
53 } 53 }
54 #endif 54 #endif
55 55
56 bool TaskParent::AllChildrenDone() { 56 bool TaskParent::AllChildrenDone() {
57 for (ChildSet::iterator it = children_->begin(); 57 for (ChildSet::iterator it = children_->begin();
58 it != children_->end(); 58 it != children_->end();
59 ++it) { 59 ++it) {
60 if (!(*it)->IsDone()) 60 if (!(*it)->IsDone())
61 return false; 61 return false;
62 } 62 }
63 return true; 63 return true;
64 } 64 }
65 65
66 bool TaskParent::AnyChildError() { 66 bool TaskParent::AnyChildError() {
67 return child_error_; 67 return child_error_;
68 } 68 }
69 69
70 void TaskParent::AbortAllChildren() { 70 void TaskParent::AbortAllChildren() {
71 if (children_->size() > 0) { 71 if (children_->size() > 0) {
72 #ifdef _DEBUG 72 #if !defined(NDEBUG)
73 runner_->IncrementAbortCount(); 73 runner_->IncrementAbortCount();
74 #endif 74 #endif
75 75
76 ChildSet copy = *children_; 76 ChildSet copy = *children_;
77 for (ChildSet::iterator it = copy.begin(); it != copy.end(); ++it) { 77 for (ChildSet::iterator it = copy.begin(); it != copy.end(); ++it) {
78 (*it)->Abort(true); // Note we do not wake 78 (*it)->Abort(true); // Note we do not wake
79 } 79 }
80 80
81 #ifdef _DEBUG 81 #if !defined(NDEBUG)
82 runner_->DecrementAbortCount(); 82 runner_->DecrementAbortCount();
83 #endif 83 #endif
84 } 84 }
85 } 85 }
86 86
87 void TaskParent::OnStopped(Task *task) { 87 void TaskParent::OnStopped(Task *task) {
88 AbortAllChildren(); 88 AbortAllChildren();
89 parent_->OnChildStopped(task); 89 parent_->OnChildStopped(task);
90 } 90 }
91 91
92 void TaskParent::OnChildStopped(Task *child) { 92 void TaskParent::OnChildStopped(Task *child) {
93 if (child->HasError()) 93 if (child->HasError())
94 child_error_ = true; 94 child_error_ = true;
95 children_->erase(child); 95 children_->erase(child);
96 } 96 }
97 97
98 } // namespace rtc 98 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/taskparent.h ('k') | webrtc/base/taskrunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698