Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / compositor / browser_compositor_output_surface.h
blobd3d8f2630ce8721e537406032b77220ece18d42a
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"
13 namespace cc {
14 class SoftwareOutputDevice;
17 namespace content {
18 class ContextProviderCommandBuffer;
19 class ReflectorImpl;
20 class WebGraphicsContext3DCommandBufferImpl;
22 class CONTENT_EXPORT BrowserCompositorOutputSurface
23 : public cc::OutputSurface,
24 public ui::CompositorVSyncManager::Observer {
25 public:
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;
44 #endif
46 protected:
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_;
60 private:
61 void Initialize();
63 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface);
66 } // namespace content
68 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_