| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // the oldest texture we sent. | 177 // the oldest texture we sent. |
| 178 uint32 texture_id = pending_textures_.front().texture_id; | 178 uint32 texture_id = pending_textures_.front().texture_id; |
| 179 if (texture_id) | 179 if (texture_id) |
| 180 context3d_->deleteTexture(texture_id); | 180 context3d_->deleteTexture(texture_id); |
| 181 pending_textures_.pop_front(); | 181 pending_textures_.pop_front(); |
| 182 } | 182 } |
| 183 CompositorOutputSurface::OnSwapAck(ack); | 183 CompositorOutputSurface::OnSwapAck(ack); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) { | 186 void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) { |
| 187 NOTIMPLEMENTED(); |
| 187 } | 188 } |
| 188 | 189 |
| 189 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect, | 190 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect, |
| 190 const ui::LatencyInfo&) { | 191 const ui::LatencyInfo&) { |
| 191 NOTIMPLEMENTED() | 192 NOTIMPLEMENTED() |
| 192 << "Partial swap not supported with composite-to-mailbox yet."; | 193 << "Partial swap not supported with composite-to-mailbox yet."; |
| 193 | 194 |
| 194 // The browser only copies damage correctly for two buffers in use. | 195 // The browser only copies damage correctly for two buffers in use. |
| 195 DCHECK(GetNumAcksPending() < 2); | 196 DCHECK(GetNumAcksPending() < 2); |
| 196 } | 197 } |
| 197 | 198 |
| 198 void MailboxOutputSurface::ConsumeTexture(const TransferableFrame& frame) { | 199 void MailboxOutputSurface::ConsumeTexture(const TransferableFrame& frame) { |
| 199 DCHECK(!frame.mailbox.IsZero()); | 200 DCHECK(!frame.mailbox.IsZero()); |
| 200 if (frame.sync_point) | 201 if (frame.sync_point) |
| 201 context3d_->waitSyncPoint(frame.sync_point); | 202 context3d_->waitSyncPoint(frame.sync_point); |
| 202 | 203 |
| 203 context3d_->bindTexture(GL_TEXTURE_2D, frame.texture_id); | 204 context3d_->bindTexture(GL_TEXTURE_2D, frame.texture_id); |
| 204 context3d_->consumeTextureCHROMIUM(GL_TEXTURE_2D, frame.mailbox.name); | 205 context3d_->consumeTextureCHROMIUM(GL_TEXTURE_2D, frame.mailbox.name); |
| 205 } | 206 } |
| 206 | 207 |
| 207 size_t MailboxOutputSurface::GetNumAcksPending() { | 208 size_t MailboxOutputSurface::GetNumAcksPending() { |
| 208 DCHECK(pending_textures_.size()); | 209 DCHECK(pending_textures_.size()); |
| 209 return pending_textures_.size() - 1; | 210 return pending_textures_.size() - 1; |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace content | 213 } // namespace content |
| OLD | NEW |