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

Side by Side 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, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/gpu/compositor_software_output_device.h" 5 #include "content/renderer/gpu/compositor_software_output_device.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/output/software_frame_data.h" 8 #include "cc/output/software_frame_data.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkDevice.h" 10 #include "third_party/skia/include/core/SkDevice.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 last_buffer_ = front_buffer_; 124 last_buffer_ = front_buffer_;
125 front_buffer_ = (front_buffer_ + 1) % dibs_.size(); 125 front_buffer_ = (front_buffer_ + 1) % dibs_.size();
126 --num_free_buffers_; 126 --num_free_buffers_;
127 DCHECK_GE(num_free_buffers_, 0); 127 DCHECK_GE(num_free_buffers_, 0);
128 } 128 }
129 129
130 void CompositorSoftwareOutputDevice::ReclaimDIB(const TransportDIB::Id& id) { 130 void CompositorSoftwareOutputDevice::ReclaimDIB(const TransportDIB::Id& id) {
131 DCHECK(CalledOnValidThread()); 131 DCHECK(CalledOnValidThread());
132 132
133 // The reclaimed handle might not be among the currently 133 // The reclaimed dib id might not be among the currently
134 // active dibs if we got a resize event in the mean time. 134 // active dibs if we got a resize event in the mean time.
135 ScopedVector<TransportDIB>::iterator it = 135 ScopedVector<TransportDIB>::iterator it =
136 std::find_if(dibs_.begin(), dibs_.end(), CompareById(id)); 136 std::find_if(dibs_.begin(), dibs_.end(), CompareById(id));
137 if (it != dibs_.end()) { 137 if (it != dibs_.end()) {
138 ++num_free_buffers_; 138 ++num_free_buffers_;
139 } else { 139 DCHECK_LE(static_cast<size_t>(num_free_buffers_), dibs_.size());
140 it = std::find_if(awaiting_ack_.begin(), 140 return;
141 awaiting_ack_.end(),
142 CompareById(id));
143 awaiting_ack_.erase(it);
144 } 141 }
145 142
146 DCHECK_LE(static_cast<size_t>(num_free_buffers_), dibs_.size()); 143 // Check if this dib id is among awaiting_ack_.
144 it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(),
145 CompareById(id));
146 DCHECK(it != awaiting_ack_.end());
147 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
148 awaiting_ack_.erase(it);
147 } 149 }
148 150
149 } // namespace content 151 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698