OLD | NEW |
---|---|
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 Loading... | |
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 if (it != awaiting_ack_.end()) | |
piman
2013/04/03 18:31:26
Is there any case where we get here and this would
slavi
2013/04/03 21:38:22
Done.
| |
147 awaiting_ack_.erase(it); | |
147 } | 148 } |
148 | 149 |
149 } // namespace content | 150 } // namespace content |
OLD | NEW |