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_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
8 #include "base/id_map.h"
9 #include "base/threading/non_thread_safe.h"
10 #include "cc/output/output_surface.h"
11 #include "content/common/content_export.h"
12 #include "ui/compositor/compositor_vsync_manager.h"
15 class SoftwareOutputDevice
;
19 class ContextProviderCommandBuffer
;
21 class WebGraphicsContext3DCommandBufferImpl
;
23 class CONTENT_EXPORT BrowserCompositorOutputSurface
24 : public cc::OutputSurface
,
25 public ui::CompositorVSyncManager::Observer
,
26 public base::NonThreadSafe
{
28 virtual ~BrowserCompositorOutputSurface();
30 // cc::OutputSurface implementation.
31 virtual bool BindToClient(cc::OutputSurfaceClient
* client
) OVERRIDE
;
32 virtual void OnSwapBuffersComplete() OVERRIDE
;
34 // ui::CompositorOutputSurface::Observer implementation.
35 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase
,
36 base::TimeDelta interval
) OVERRIDE
;
38 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase
,
39 base::TimeDelta interval
);
41 void SetReflector(ReflectorImpl
* reflector
);
43 #if defined(OS_MACOSX)
44 void OnSurfaceDisplayed();
48 // Constructor used by the accelerated implementation.
49 BrowserCompositorOutputSurface(
50 const scoped_refptr
<ContextProviderCommandBuffer
>& context
,
52 IDMap
<BrowserCompositorOutputSurface
>* output_surface_map
,
53 const scoped_refptr
<ui::CompositorVSyncManager
>& vsync_manager
);
55 // Constructor used by the software implementation.
56 BrowserCompositorOutputSurface(
57 scoped_ptr
<cc::SoftwareOutputDevice
> software_device
,
59 IDMap
<BrowserCompositorOutputSurface
>* output_surface_map
,
60 const scoped_refptr
<ui::CompositorVSyncManager
>& vsync_manager
);
63 IDMap
<BrowserCompositorOutputSurface
>* output_surface_map_
;
65 scoped_refptr
<ui::CompositorVSyncManager
> vsync_manager_
;
66 scoped_refptr
<ReflectorImpl
> reflector_
;
71 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface
);
74 } // namespace content
76 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_