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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
8 #include "base/cancelable_callback.h"
9 #include "content/browser/compositor/browser_compositor_output_surface.h"
12 class CompositorVSyncManager
;
16 class OverlayCandidateValidator
;
20 class CommandBufferProxyImpl
;
22 // Adapts a WebGraphicsContext3DCommandBufferImpl into a
23 // cc::OutputSurface that also handles vsync parameter updates
24 // arriving from the GPU process.
25 class GpuBrowserCompositorOutputSurface
26 : public BrowserCompositorOutputSurface
{
28 GpuBrowserCompositorOutputSurface(
29 const scoped_refptr
<ContextProviderCommandBuffer
>& context
,
30 const scoped_refptr
<ui::CompositorVSyncManager
>& vsync_manager
,
31 scoped_ptr
<cc::OverlayCandidateValidator
> overlay_candidate_validator
);
33 ~GpuBrowserCompositorOutputSurface() override
;
36 // cc::OutputSurface implementation.
37 void SwapBuffers(cc::CompositorFrame
* frame
) override
;
38 bool BindToClient(cc::OutputSurfaceClient
* client
) override
;
40 #if defined(OS_MACOSX)
41 void OnSurfaceDisplayed() override
;
42 void OnSurfaceRecycled() override
;
43 bool ShouldNotShowFramesAfterRecycle() const override
;
44 bool should_not_show_frames_
;
47 CommandBufferProxyImpl
* GetCommandBufferProxy();
48 void OnSwapBuffersCompleted(const std::vector
<ui::LatencyInfo
>& latency_info
);
50 base::CancelableCallback
<void(const std::vector
<ui::LatencyInfo
>&)>
51 swap_buffers_completion_callback_
;
52 base::CancelableCallback
<void(base::TimeTicks timebase
,
53 base::TimeDelta interval
)>
54 update_vsync_parameters_callback_
;
56 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface
);
59 } // namespace content
61 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_