Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / compositor / offscreen_browser_compositor_output_surface.h
blobc9e32e7876dd50df94b4d32fa8d12819cb643f84
1 // Copyright 2015 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_OFFSCREEN_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_OFFSCREEN_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
8 #include "base/cancelable_callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/browser/compositor/browser_compositor_output_surface.h"
13 namespace ui {
14 class CompositorVSyncManager;
17 namespace content {
18 class CommandBufferProxyImpl;
19 class ReflectorTexture;
21 class OffscreenBrowserCompositorOutputSurface
22 : public BrowserCompositorOutputSurface {
23 public:
24 OffscreenBrowserCompositorOutputSurface(
25 const scoped_refptr<ContextProviderCommandBuffer>& context,
26 const scoped_refptr<ContextProviderCommandBuffer>& worker_context,
27 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
28 scoped_ptr<BrowserCompositorOverlayCandidateValidator>
29 overlay_candidate_validator);
31 ~OffscreenBrowserCompositorOutputSurface() override;
33 protected:
34 // cc::OutputSurface:
35 void EnsureBackbuffer() override;
36 void DiscardBackbuffer() override;
37 void Reshape(const gfx::Size& size, float scale_factor) override;
38 void BindFramebuffer() override;
39 void SwapBuffers(cc::CompositorFrame* frame) override;
41 // BrowserCompositorOutputSurface
42 void OnReflectorChanged() override;
43 base::Closure CreateCompositionStartedCallback() override;
44 #if defined(OS_MACOSX)
45 void OnSurfaceDisplayed() override {};
46 void SetSurfaceSuspendedForRecycle(bool suspended) override {};
47 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const override;
48 #endif
50 uint32 fbo_;
51 bool is_backbuffer_discarded_;
52 scoped_ptr<ReflectorTexture> reflector_texture_;
54 base::WeakPtrFactory<OffscreenBrowserCompositorOutputSurface>
55 weak_ptr_factory_;
57 private:
58 DISALLOW_COPY_AND_ASSIGN(OffscreenBrowserCompositorOutputSurface);
61 } // namespace content
63 #endif // CONTENT_BROWSER_COMPOSITOR_OFFSCREEN_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_