| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/compositor/gpu_browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 void GpuBrowserCompositorOutputSurface::OnReflectorChanged() { | 73 void GpuBrowserCompositorOutputSurface::OnReflectorChanged() { |
| 74 if (!reflector_) { | 74 if (!reflector_) { |
| 75 reflector_texture_.reset(); | 75 reflector_texture_.reset(); |
| 76 } else { | 76 } else { |
| 77 reflector_texture_.reset(new ReflectorTexture(context_provider())); | 77 reflector_texture_.reset(new ReflectorTexture(context_provider())); |
| 78 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox()); | 78 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox()); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void GpuBrowserCompositorOutputSurface::SwapBuffers( | 82 void GpuBrowserCompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) { |
| 83 cc::CompositorFrame* frame) { | 83 DCHECK(frame.gl_frame_data); |
| 84 DCHECK(frame->gl_frame_data); | |
| 85 | 84 |
| 86 GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); | 85 GetCommandBufferProxy()->SetLatencyInfo(frame.metadata.latency_info); |
| 87 | 86 |
| 88 if (reflector_) { | 87 if (reflector_) { |
| 89 if (frame->gl_frame_data->sub_buffer_rect == | 88 if (frame.gl_frame_data->sub_buffer_rect == |
| 90 gfx::Rect(frame->gl_frame_data->size)) { | 89 gfx::Rect(frame.gl_frame_data->size)) { |
| 91 reflector_texture_->CopyTextureFullImage(SurfaceSize()); | 90 reflector_texture_->CopyTextureFullImage(SurfaceSize()); |
| 92 reflector_->OnSourceSwapBuffers(); | 91 reflector_->OnSourceSwapBuffers(); |
| 93 } else { | 92 } else { |
| 94 const gfx::Rect& rect = frame->gl_frame_data->sub_buffer_rect; | 93 const gfx::Rect& rect = frame.gl_frame_data->sub_buffer_rect; |
| 95 reflector_texture_->CopyTextureSubImage(rect); | 94 reflector_texture_->CopyTextureSubImage(rect); |
| 96 reflector_->OnSourcePostSubBuffer(rect); | 95 reflector_->OnSourcePostSubBuffer(rect); |
| 97 } | 96 } |
| 98 } | 97 } |
| 99 | 98 |
| 100 if (frame->gl_frame_data->sub_buffer_rect == | 99 if (frame.gl_frame_data->sub_buffer_rect == |
| 101 gfx::Rect(frame->gl_frame_data->size)) { | 100 gfx::Rect(frame.gl_frame_data->size)) { |
| 102 context_provider_->ContextSupport()->Swap(); | 101 context_provider_->ContextSupport()->Swap(); |
| 103 } else { | 102 } else { |
| 104 context_provider_->ContextSupport()->PartialSwapBuffers( | 103 context_provider_->ContextSupport()->PartialSwapBuffers( |
| 105 frame->gl_frame_data->sub_buffer_rect); | 104 frame.gl_frame_data->sub_buffer_rect); |
| 106 } | 105 } |
| 107 | 106 |
| 108 client_->DidSwapBuffers(); | 107 client_->DidSwapBuffers(); |
| 109 } | 108 } |
| 110 | 109 |
| 111 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 110 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| 112 const std::vector<ui::LatencyInfo>& latency_info, | 111 const std::vector<ui::LatencyInfo>& latency_info, |
| 113 gfx::SwapResult result, | 112 gfx::SwapResult result, |
| 114 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { | 113 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| 115 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 114 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 116 OnSwapBuffersComplete(); | 115 OnSwapBuffersComplete(); |
| 117 } | 116 } |
| 118 | 117 |
| 119 #if defined(OS_MACOSX) | 118 #if defined(OS_MACOSX) |
| 120 void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( | 119 void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( |
| 121 bool suspended) {} | 120 bool suspended) {} |
| 122 #endif | 121 #endif |
| 123 | 122 |
| 124 } // namespace content | 123 } // namespace content |
| OLD | NEW |