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/threading/non_thread_safe.h"
9 #include "cc/output/output_surface.h"
10 #include "content/common/content_export.h"
11 #include "ui/compositor/compositor_vsync_manager.h"
14 class SoftwareOutputDevice
;
18 class ContextProviderCommandBuffer
;
20 class WebGraphicsContext3DCommandBufferImpl
;
22 class CONTENT_EXPORT BrowserCompositorOutputSurface
23 : public cc::OutputSurface
,
24 public ui::CompositorVSyncManager::Observer
{
26 ~BrowserCompositorOutputSurface() override
;
28 // cc::OutputSurface implementation.
29 bool BindToClient(cc::OutputSurfaceClient
* client
) override
;
31 // ui::CompositorOutputSurface::Observer implementation.
32 void OnUpdateVSyncParameters(base::TimeTicks timebase
,
33 base::TimeDelta interval
) override
;
35 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase
,
36 base::TimeDelta interval
);
38 void SetReflector(ReflectorImpl
* reflector
);
40 #if defined(OS_MACOSX)
41 virtual void OnSurfaceDisplayed() = 0;
42 virtual void OnSurfaceRecycled() = 0;
43 virtual bool ShouldNotShowFramesAfterRecycle() const = 0;
47 // Constructor used by the accelerated implementation.
48 BrowserCompositorOutputSurface(
49 const scoped_refptr
<cc::ContextProvider
>& context
,
50 const scoped_refptr
<ui::CompositorVSyncManager
>& vsync_manager
);
52 // Constructor used by the software implementation.
53 BrowserCompositorOutputSurface(
54 scoped_ptr
<cc::SoftwareOutputDevice
> software_device
,
55 const scoped_refptr
<ui::CompositorVSyncManager
>& vsync_manager
);
57 scoped_refptr
<ui::CompositorVSyncManager
> vsync_manager_
;
58 ReflectorImpl
* reflector_
;
63 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface
);
66 } // namespace content
68 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_