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

Unified Diff: content/renderer/gpu/compositor_software_output_device.cc

Issue 13042012: Browser side changes for software compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't ACK invalid dib ids. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698