| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mailbox_output_surface.h" | 5 #include "content/renderer/gpu/mailbox_output_surface.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/compositor_frame_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
| 10 #include "cc/output/gl_frame_data.h" | 10 #include "cc/output/gl_frame_data.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // the oldest texture we sent. | 191 // the oldest texture we sent. |
| 192 uint32 texture_id = pending_textures_.front().texture_id; | 192 uint32 texture_id = pending_textures_.front().texture_id; |
| 193 if (texture_id) | 193 if (texture_id) |
| 194 context3d_->deleteTexture(texture_id); | 194 context3d_->deleteTexture(texture_id); |
| 195 pending_textures_.pop_front(); | 195 pending_textures_.pop_front(); |
| 196 } | 196 } |
| 197 CompositorOutputSurface::OnSwapAck(ack); | 197 CompositorOutputSurface::OnSwapAck(ack); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) { | 200 void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) { |
| 201 DCHECK(GetNumAcksPending() < 2); |
| 201 } | 202 } |
| 202 | 203 |
| 203 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect, | 204 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect, |
| 204 const ui::LatencyInfo&) { | 205 const ui::LatencyInfo&) { |
| 205 NOTIMPLEMENTED() | 206 NOTIMPLEMENTED() |
| 206 << "Partial swap not supported with composite-to-mailbox yet."; | 207 << "Partial swap not supported with composite-to-mailbox yet."; |
| 207 | 208 |
| 208 // The browser only copies damage correctly for two buffers in use. | 209 // The browser only copies damage correctly for two buffers in use. |
| 209 DCHECK(GetNumAcksPending() < 2); | 210 DCHECK(GetNumAcksPending() < 2); |
| 210 } | 211 } |
| 211 | 212 |
| 212 void MailboxOutputSurface::ConsumeTexture(const TransferableFrame& frame) { | 213 void MailboxOutputSurface::ConsumeTexture(const TransferableFrame& frame) { |
| 213 DCHECK(!frame.mailbox.IsZero()); | 214 DCHECK(!frame.mailbox.IsZero()); |
| 214 if (frame.sync_point) | 215 if (frame.sync_point) |
| 215 context3d_->waitSyncPoint(frame.sync_point); | 216 context3d_->waitSyncPoint(frame.sync_point); |
| 216 | 217 |
| 217 context3d_->bindTexture(GL_TEXTURE_2D, frame.texture_id); | 218 context3d_->bindTexture(GL_TEXTURE_2D, frame.texture_id); |
| 218 context3d_->consumeTextureCHROMIUM(GL_TEXTURE_2D, frame.mailbox.name); | 219 context3d_->consumeTextureCHROMIUM(GL_TEXTURE_2D, frame.mailbox.name); |
| 219 } | 220 } |
| 220 | 221 |
| 221 size_t MailboxOutputSurface::GetNumAcksPending() { | 222 size_t MailboxOutputSurface::GetNumAcksPending() { |
| 222 DCHECK(pending_textures_.size()); | 223 DCHECK(pending_textures_.size()); |
| 223 return pending_textures_.size() - 1; | 224 return pending_textures_.size() - 1; |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace content | 227 } // namespace content |
| OLD | NEW |