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 "content/renderer/render_process.h" | 9 #include "content/renderer/render_process.h" |
10 #include "third_party/skia/include/core/SkBitmapDevice.h" | 10 #include "third_party/skia/include/core/SkBitmapDevice.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void CompositorSoftwareOutputDevice::EndPaint( | 194 void CompositorSoftwareOutputDevice::EndPaint( |
195 cc::SoftwareFrameData* frame_data) { | 195 cc::SoftwareFrameData* frame_data) { |
196 DCHECK(CalledOnValidThread()); | 196 DCHECK(CalledOnValidThread()); |
197 DCHECK(frame_data); | 197 DCHECK(frame_data); |
198 | 198 |
199 Buffer* buffer = buffers_[current_index_]; | 199 Buffer* buffer = buffers_[current_index_]; |
200 frame_data->id = buffer->id(); | 200 frame_data->id = buffer->id(); |
201 frame_data->size = viewport_size_; | 201 frame_data->size = viewport_size_; |
202 frame_data->damage_rect = damage_rect_; | 202 frame_data->damage_rect = damage_rect_; |
203 frame_data->handle = buffer->handle(); | 203 frame_data->handle = buffer->handle(); |
| 204 |
| 205 CHECK_LE(static_cast<size_t>(frame_data->size.GetArea()) * 4, |
| 206 buffer->shared_memory()->mapped_size()); |
204 } | 207 } |
205 | 208 |
206 void CompositorSoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) { | 209 void CompositorSoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) { |
207 DCHECK(CalledOnValidThread()); | 210 DCHECK(CalledOnValidThread()); |
208 | 211 |
209 if (!id) | 212 if (!id) |
210 return; | 213 return; |
211 | 214 |
212 // The reclaimed buffer id might not be among the currently | 215 // The reclaimed buffer id might not be among the currently |
213 // active buffers if we got a resize event in the mean time. | 216 // active buffers if we got a resize event in the mean time. |
214 ScopedVector<Buffer>::iterator it = | 217 ScopedVector<Buffer>::iterator it = |
215 std::find_if(buffers_.begin(), buffers_.end(), CompareById(id)); | 218 std::find_if(buffers_.begin(), buffers_.end(), CompareById(id)); |
216 if (it != buffers_.end()) { | 219 if (it != buffers_.end()) { |
217 DCHECK(!(*it)->free()); | 220 DCHECK(!(*it)->free()); |
218 (*it)->SetFree(true); | 221 (*it)->SetFree(true); |
219 return; | 222 return; |
220 } else { | 223 } else { |
221 it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(), | 224 it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(), |
222 CompareById(id)); | 225 CompareById(id)); |
223 DCHECK(it != awaiting_ack_.end()); | 226 DCHECK(it != awaiting_ack_.end()); |
224 awaiting_ack_.erase(it); | 227 awaiting_ack_.erase(it); |
225 } | 228 } |
226 } | 229 } |
227 | 230 |
228 } // namespace content | 231 } // namespace content |
OLD | NEW |