Increases consumption of this tracker and its ancestors by 'bytes'.
| 135 | |
| 136 | /// Increases consumption of this tracker and its ancestors by 'bytes'. |
| 137 | void Consume(int64_t bytes) { |
| 138 | DCHECK_GE(bytes, 0); |
| 139 | DCHECK(!closed_) << label_; |
| 140 | if (UNLIKELY(bytes <= 0)) return; // < 0 needed in RELEASE, hits DCHECK in DEBUG |
| 141 | |
| 142 | if (consumption_metric_ != nullptr) { |
| 143 | RefreshConsumptionFromMetric(); |
| 144 | return; |
| 145 | } |
| 146 | for (MemTracker* tracker : all_trackers_) { |
| 147 | tracker->consumption_->Add(bytes); |
| 148 | if (tracker->consumption_metric_ == nullptr) { |
| 149 | DCHECK_GE(tracker->consumption_->current_value(), 0); |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /// Increases the consumption of this tracker and the ancestors up to (but |
| 155 | /// not including) end_tracker. This is useful if we want to move tracking between |