Chromium Code Reviews| Index: content/renderer/gpu/compositor_software_output_device.cc |
| diff --git a/content/renderer/gpu/compositor_software_output_device.cc b/content/renderer/gpu/compositor_software_output_device.cc |
| index 77fbdb35a85472b5e19b8e6df404657576bf7d55..2c4cb95c635d5bdac988ec1b53cebd282ce79adf 100644 |
| --- a/content/renderer/gpu/compositor_software_output_device.cc |
| +++ b/content/renderer/gpu/compositor_software_output_device.cc |
| @@ -130,20 +130,22 @@ void CompositorSoftwareOutputDevice::EndPaint( |
| void CompositorSoftwareOutputDevice::ReclaimDIB(const TransportDIB::Id& id) { |
| DCHECK(CalledOnValidThread()); |
| - // The reclaimed handle might not be among the currently |
| + // The reclaimed dib id might not be among the currently |
| // active dibs if we got a resize event in the mean time. |
| ScopedVector<TransportDIB>::iterator it = |
| std::find_if(dibs_.begin(), dibs_.end(), CompareById(id)); |
| if (it != dibs_.end()) { |
| ++num_free_buffers_; |
| - } else { |
| - it = std::find_if(awaiting_ack_.begin(), |
| - awaiting_ack_.end(), |
| - CompareById(id)); |
| - awaiting_ack_.erase(it); |
| + DCHECK_LE(static_cast<size_t>(num_free_buffers_), dibs_.size()); |
| + return; |
| } |
| - DCHECK_LE(static_cast<size_t>(num_free_buffers_), dibs_.size()); |
| + // Check if this dib id is among awaiting_ack_. |
| + it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(), |
| + CompareById(id)); |
| + DCHECK(it != awaiting_ack_.end()); |
| + if (it != awaiting_ack_.end()) |
|
piman
2013/04/03 21:54:42
nit: with the DCHECK, the if is unnecessary, right
piman
2013/04/05 21:07:29
ping
|
| + awaiting_ack_.erase(it); |
| } |
| } // namespace content |