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_SURFACE_DISPLAY_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_SURFACE_DISPLAY_OUTPUT_SURFACE_H_
8 #include "cc/output/output_surface.h"
9 #include "cc/surfaces/surface_factory.h"
10 #include "cc/surfaces/surface_factory_client.h"
11 #include "cc/surfaces/surface_id_allocator.h"
20 // This class is maps a compositor OutputSurface to the surface system's Display
21 // concept, allowing a compositor client to submit frames for a native root
22 // window or physical display.
23 class SurfaceDisplayOutputSurface
: public cc::OutputSurface
,
24 public cc::SurfaceFactoryClient
{
26 // The underlying cc::Display and cc::SurfaceManager must outlive this class.
27 SurfaceDisplayOutputSurface(
28 cc::SurfaceManager
* surface_manager
,
29 uint32_t surface_id_namespace
,
30 const scoped_refptr
<cc::ContextProvider
>& context_provider
);
31 virtual ~SurfaceDisplayOutputSurface();
33 void set_display(cc::Display
* display
) { display_
= display
; }
34 cc::SurfaceFactory
* factory() { return &factory_
; }
36 // cc::OutputSurface implementation.
37 virtual void SwapBuffers(cc::CompositorFrame
* frame
) OVERRIDE
;
39 // cc::SurfaceFactoryClient implementation.
40 virtual void ReturnResources(
41 const cc::ReturnedResourceArray
& resources
) OVERRIDE
;
44 void SwapBuffersComplete();
46 cc::Display
* display_
;
47 cc::SurfaceManager
* surface_manager_
;
48 cc::SurfaceFactory factory_
;
49 gfx::Size display_size_
;
50 cc::SurfaceId surface_id_
;
51 cc::SurfaceIdAllocator allocator_
;
53 DISALLOW_COPY_AND_ASSIGN(SurfaceDisplayOutputSurface
);
56 } // namespace content
58 #endif // CONTENT_BROWSER_COMPOSITOR_SURFACE_DISPLAY_OUTPUT_SURFACE_H_