Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / browser / compositor / browser_compositor_output_surface.h
blobf582776734fded73a1f040aa242f19a7858083e6
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 BrowserCompositorOverlayCandidateValidator;
19 class ContextProviderCommandBuffer;
20 class ReflectorImpl;
21 class WebGraphicsContext3DCommandBufferImpl;
23 class CONTENT_EXPORT BrowserCompositorOutputSurface
24 : public cc::OutputSurface,
25 public ui::CompositorVSyncManager::Observer {
26 public:
27 ~BrowserCompositorOutputSurface() override;
29 // cc::OutputSurface implementation.
30 bool BindToClient(cc::OutputSurfaceClient* client) override;
31 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override;
33 // ui::CompositorOutputSurface::Observer implementation.
34 void OnUpdateVSyncParameters(base::TimeTicks timebase,
35 base::TimeDelta interval) override;
37 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase,
38 base::TimeDelta interval);
40 void SetReflector(ReflectorImpl* reflector);
42 // Called when |reflector_| was updated.
43 virtual void OnReflectorChanged();
45 // Returns a callback that will be called when all mirroring
46 // compositors have started composition.
47 virtual base::Closure CreateCompositionStartedCallback();
49 #if defined(OS_MACOSX)
50 virtual void OnSurfaceDisplayed() = 0;
51 virtual void SetSurfaceSuspendedForRecycle(bool suspended) = 0;
52 virtual bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const = 0;
53 #endif
55 protected:
56 // Constructor used by the accelerated implementation.
57 BrowserCompositorOutputSurface(
58 const scoped_refptr<cc::ContextProvider>& context,
59 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
60 scoped_ptr<BrowserCompositorOverlayCandidateValidator>
61 overlay_candidate_validator);
63 // Constructor used by the software implementation.
64 BrowserCompositorOutputSurface(
65 scoped_ptr<cc::SoftwareOutputDevice> software_device,
66 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager);
68 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_;
69 ReflectorImpl* reflector_;
71 // True when BeginFrame scheduling is enabled.
72 bool use_begin_frame_scheduling_;
74 private:
75 void Initialize();
77 scoped_ptr<BrowserCompositorOverlayCandidateValidator>
78 overlay_candidate_validator_;
80 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface);
83 } // namespace content
85 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_