| OLD | NEW | 
|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/mailbox_output_surface.h" | 5 #include "content/test/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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 149 | 149 | 
| 150   GLES2Interface* gl = context_provider_->ContextGL(); | 150   GLES2Interface* gl = context_provider_->ContextGL(); | 
| 151 | 151 | 
| 152   if (!fbo_) | 152   if (!fbo_) | 
| 153     gl->GenFramebuffers(1, &fbo_); | 153     gl->GenFramebuffers(1, &fbo_); | 
| 154   gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 154   gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 
| 155   gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 155   gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 
| 156                            current_backing_.texture_id, 0); | 156                            current_backing_.texture_id, 0); | 
| 157 } | 157 } | 
| 158 | 158 | 
|  | 159 uint32_t MailboxOutputSurface::GetFramebufferCopyTextureFormat() { | 
|  | 160   return GLCopyTextureInternalFormat(cc::RGBA_8888); | 
|  | 161 } | 
|  | 162 | 
| 159 void MailboxOutputSurface::OnSwapAck(uint32_t output_surface_id, | 163 void MailboxOutputSurface::OnSwapAck(uint32_t output_surface_id, | 
| 160                                      const cc::CompositorFrameAck& ack) { | 164                                      const cc::CompositorFrameAck& ack) { | 
| 161   // Ignore message if it's a stale one coming from a different output surface | 165   // Ignore message if it's a stale one coming from a different output surface | 
| 162   // (e.g. after a lost context). | 166   // (e.g. after a lost context). | 
| 163   if (output_surface_id != output_surface_id_) | 167   if (output_surface_id != output_surface_id_) | 
| 164     return; | 168     return; | 
| 165 | 169 | 
| 166   if (!ack.gl_frame_data->mailbox.IsZero()) { | 170   if (!ack.gl_frame_data->mailbox.IsZero()) { | 
| 167     DCHECK(!ack.gl_frame_data->size.IsEmpty()); | 171     DCHECK(!ack.gl_frame_data->size.IsEmpty()); | 
| 168     // The browser could be returning the oldest or any other pending texture | 172     // The browser could be returning the oldest or any other pending texture | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 259 | 263 | 
| 260 MailboxOutputSurface::TransferableFrame::TransferableFrame() : texture_id(0) {} | 264 MailboxOutputSurface::TransferableFrame::TransferableFrame() : texture_id(0) {} | 
| 261 | 265 | 
| 262 MailboxOutputSurface::TransferableFrame::TransferableFrame( | 266 MailboxOutputSurface::TransferableFrame::TransferableFrame( | 
| 263     uint32_t texture_id, | 267     uint32_t texture_id, | 
| 264     const gpu::Mailbox& mailbox, | 268     const gpu::Mailbox& mailbox, | 
| 265     const gfx::Size size) | 269     const gfx::Size size) | 
| 266     : texture_id(texture_id), mailbox(mailbox), size(size) {} | 270     : texture_id(texture_id), mailbox(mailbox), size(size) {} | 
| 267 | 271 | 
| 268 }  // namespace content | 272 }  // namespace content | 
| OLD | NEW | 
|---|