| 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 25 matching lines...) Expand all Loading... |
| 36 nullptr, | 36 nullptr, |
| 37 swap_frame_message_queue, | 37 swap_frame_message_queue, |
| 38 true), | 38 true), |
| 39 fbo_(0), | 39 fbo_(0), |
| 40 is_backbuffer_discarded_(false), | 40 is_backbuffer_discarded_(false), |
| 41 format_(format) { | 41 format_(format) { |
| 42 pending_textures_.push_back(TransferableFrame()); | 42 pending_textures_.push_back(TransferableFrame()); |
| 43 capabilities_.uses_default_gl_framebuffer = false; | 43 capabilities_.uses_default_gl_framebuffer = false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 MailboxOutputSurface::~MailboxOutputSurface() { | 46 MailboxOutputSurface::~MailboxOutputSurface() {} |
| 47 |
| 48 void MailboxOutputSurface::DetachFromClient() { |
| 47 DiscardBackbuffer(); | 49 DiscardBackbuffer(); |
| 48 while (!pending_textures_.empty()) { | 50 while (!pending_textures_.empty()) { |
| 49 if (pending_textures_.front().texture_id) { | 51 if (pending_textures_.front().texture_id) { |
| 50 context_provider_->ContextGL()->DeleteTextures( | 52 context_provider_->ContextGL()->DeleteTextures( |
| 51 1, &pending_textures_.front().texture_id); | 53 1, &pending_textures_.front().texture_id); |
| 52 } | 54 } |
| 53 pending_textures_.pop_front(); | 55 pending_textures_.pop_front(); |
| 54 } | 56 } |
| 57 cc::OutputSurface::DetachFromClient(); |
| 55 } | 58 } |
| 56 | 59 |
| 57 void MailboxOutputSurface::EnsureBackbuffer() { | 60 void MailboxOutputSurface::EnsureBackbuffer() { |
| 58 is_backbuffer_discarded_ = false; | 61 is_backbuffer_discarded_ = false; |
| 59 | 62 |
| 60 GLES2Interface* gl = context_provider_->ContextGL(); | 63 GLES2Interface* gl = context_provider_->ContextGL(); |
| 61 | 64 |
| 62 if (!current_backing_.texture_id) { | 65 if (!current_backing_.texture_id) { |
| 63 // Find a texture of matching size to recycle. | 66 // Find a texture of matching size to recycle. |
| 64 while (!returned_textures_.empty()) { | 67 while (!returned_textures_.empty()) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 pending_textures_.push_back(current_backing_); | 213 pending_textures_.push_back(current_backing_); |
| 211 current_backing_ = TransferableFrame(); | 214 current_backing_ = TransferableFrame(); |
| 212 } | 215 } |
| 213 | 216 |
| 214 size_t MailboxOutputSurface::GetNumAcksPending() { | 217 size_t MailboxOutputSurface::GetNumAcksPending() { |
| 215 DCHECK(pending_textures_.size()); | 218 DCHECK(pending_textures_.size()); |
| 216 return pending_textures_.size() - 1; | 219 return pending_textures_.size() - 1; |
| 217 } | 220 } |
| 218 | 221 |
| 219 } // namespace content | 222 } // namespace content |
| OLD | NEW |